Skip to content

Commit 530001d

Browse files
committed
Disable some naming cops inline
1 parent 7954031 commit 530001d

16 files changed

+24
-50
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,6 @@
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 3
10-
Naming/AccessorMethodName:
11-
Exclude:
12-
- 'spec/requests/congress_messages_spec.rb'
13-
- 'spec/spec_helper.rb'
14-
15-
# Offense count: 2
16-
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
17-
Naming/BlockParameterName:
18-
Exclude:
19-
- 'app/views/action_page/index.atom.builder'
20-
- 'app/views/action_page/index.json.jbuilder'
21-
22-
# Offense count: 3
23-
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
24-
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
25-
Naming/MemoizedInstanceVariableName:
26-
Exclude:
27-
- 'app/controllers/tools_controller.rb'
28-
- 'app/models/action_page.rb'
29-
- 'lib/related_content.rb'
30-
31-
# Offense count: 7
32-
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
33-
# AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
34-
Naming/MethodParameterName:
35-
Exclude:
36-
- 'app/helpers/application_helper.rb'
37-
- 'app/mailers/user_mailer.rb'
38-
- 'app/models/congress_message_campaign.rb'
39-
- 'app/models/institution.rb'
40-
- 'app/queries/action_page_filters.rb'
41-
429
# Offense count: 3
4310
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
4411
# NamePrefix: is_, has_, have_
@@ -48,9 +15,6 @@ Naming/MethodParameterName:
4815
Naming/PredicateName:
4916
Exclude:
5017
- 'spec/**/*'
51-
- 'app/models/source_file.rb'
52-
- 'app/models/twitter.rb'
53-
- 'lib/congress_forms.rb'
5418

5519
# Offense count: 45
5620
# Configuration parameters: EnforcedStyle.

app/controllers/tools_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,11 @@ def set_user
154154
@user = current_user
155155
end
156156

157-
def set_action_page
157+
# rubocop:todo Naming/MemoizedInstanceVariableName
158+
def set_action_page # rubocop:todo Naming/MemoizedInstanceVariableName
158159
@action_page ||= ActionPage.find_by(id: params[:action_id])
159160
end
161+
# rubocop:enable Naming/MemoizedInstanceVariableName
160162

161163
def create_newsletter_subscription
162164
if params[:subscribe] && EmailValidator.valid?(params[:subscription][:email])

app/helpers/application_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def messages
110110
safe_join(messages)
111111
end
112112

113-
def percentage(x, y, precision: 0)
113+
def percentage(x, y, precision: 0) # rubocop:todo Naming/MethodParameterName
114114
return "-" unless y > 0
115115

116116
number_to_percentage((x / y.to_f) * 100, precision: precision)

app/mailers/user_mailer.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ class UserMailer < ActionMailer::Base
44
layout "email"
55
after_action :check_bounces
66

7+
# rubocop:todo Naming/MethodParameterName
78
def thanks_message(email, actionPage, options = {})
89
@email = email
910
@user = options[:user]
1011
@actionPage = actionPage
1112
@name = options[:name].presence || "Friend of Digital Freedom"
1213
mail(to: email, subject: "Thanks for taking action")
1314
end
15+
# rubocop:enable Naming/MethodParameterName
1416

1517
def signup_attempt_with_existing_email(user, _options = {})
1618
@user = user

app/models/action_page.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@ def image
147147
[og_image, background_image, featured_image].find(&:present?)
148148
end
149149

150+
# rubocop:todo Naming/MemoizedInstanceVariableName
150151
def actions_taken_percent
151152
return 0 if view_count == 0
152153

153154
@percent ||= (action_count / view_count.to_f) * 100
154155
end
156+
# rubocop:enable Naming/MemoizedInstanceVariableName
155157

156158
def status
157159
if archived?

app/models/congress_message_campaign.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def member_fills_url
5050
CongressForms.member_fills_url(campaign_tag)
5151
end
5252

53-
def target_bioguide_list=(x)
53+
def target_bioguide_list=(x) # rubocop:todo Naming/MethodParameterName
5454
self.target_bioguide_ids = x.map(&:presence).compact.join(",")
5555
end
5656

app/models/institution.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def self.categories
4545

4646
# Sort institutions by most popular.
4747
# Put `first` at the top of the list if it exists.
48-
def self.top(n, first: 0)
48+
def self.top(n, first: 0) # rubocop:todo Naming/MethodParameterName
4949
select("institutions.*, COUNT(signatures.id) AS s_count")
5050
.joins("LEFT OUTER JOIN affiliations ON institutions.id = affiliations.institution_id")
5151
.joins("LEFT OUTER JOIN signatures ON affiliations.signature_id = signatures.id")

app/models/source_file.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def to_jq_upload
5656
}
5757
end
5858

59-
def is_image?
59+
def is_image? # rubocop:todo Naming/PredicateName
6060
!!file_content_type.try(:match, /image/)
6161
end
6262

app/models/twitter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Twitter
2-
def self.has_api_keys?
2+
def self.has_api_keys? # rubocop:todo Naming/PredicateName
33
Rails.application.secrets.twitter_api_key.present? &&
44
Rails.application.secrets.twitter_api_secret.present? &&
55
Rails.application.secrets.twitter_oauth_token.present? &&

app/queries/action_page_filters.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ def parse_date_range
4646
filters[:date_range].split(" - ").map { |d| Time.zone.parse(d) }
4747
end
4848

49-
def valid_query?(f, val)
49+
def valid_query?(f, val) # rubocop:todo Naming/MethodParameterName
5050
validate_filter_name f
5151
!empty_value? val
5252
end
5353

54-
def validate_filter_name(f)
54+
def validate_filter_name(f) # rubocop:todo Naming/MethodParameterName
5555
raise ArgumentError, "unrecognized filter #{f}" unless VALID_FILTERS.include? f
5656
end
5757
end

0 commit comments

Comments
 (0)