Skip to content

Commit 8ce5818

Browse files
committed
Disable some rails cops inline
1 parent 530001d commit 8ce5818

File tree

11 files changed

+24
-22
lines changed

11 files changed

+24
-22
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,6 @@ Rails/HelperInstanceVariable:
121121
- 'app/helpers/devise_helper.rb'
122122
- 'app/helpers/petition_helper.rb'
123123

124-
# Offense count: 2
125-
# Configuration parameters: Include.
126-
# Include: app/models/**/*.rb
127-
Rails/InverseOf:
128-
Exclude:
129-
- 'app/models/action_page.rb'
130-
131124
# Offense count: 6
132125
# Configuration parameters: Include.
133126
# Include: app/controllers/**/*.rb
@@ -139,19 +132,6 @@ Rails/LexicallyScopedActionFilter:
139132
- 'app/controllers/sessions_controller.rb'
140133
- 'app/controllers/tools_controller.rb'
141134

142-
# Offense count: 9
143-
# Configuration parameters: Blacklist, Whitelist.
144-
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
145-
Rails/SkipsModelValidations:
146-
Exclude:
147-
- 'app/controllers/registrations_controller.rb'
148-
- 'app/controllers/users_controller.rb'
149-
- 'app/models/congress_scorecard.rb'
150-
- 'lib/tasks/ahoy.rake'
151-
- 'lib/tasks/congress.rake'
152-
- 'spec/requests/congress_messages_spec.rb'
153-
- 'spec/tasks/signatures_spec.rb'
154-
155135
# Offense count: 3
156136
# Configuration parameters: Include.
157137
# Include: app/models/**/*.rb

app/controllers/registrations_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ def handle_nonunique_email
3131
existing.update(sign_up_params) unless existing.confirmed?
3232

3333
if resource.persisted?
34+
# rubocop:todo Rails/SkipsModelValidations
3435
resource.update_attribute(:unconfirmed_email, account_update_params[:email])
36+
# rubocop:enable Rails/SkipsModelValidations
3537
flash[:notice] = I18n.t "devise.registrations.update_needs_confirmation"
3638
respond_with resource, location: after_update_path_for(resource)
3739
else

app/controllers/tools_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def set_user
155155
end
156156

157157
# rubocop:todo Naming/MemoizedInstanceVariableName
158-
def set_action_page # rubocop:todo Naming/MemoizedInstanceVariableName
158+
def set_action_page
159159
@action_page ||= ActionPage.find_by(id: params[:action_id])
160160
end
161161
# rubocop:enable Naming/MemoizedInstanceVariableName

app/controllers/users_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ def update
2121
end
2222

2323
def clear_activity
24+
# rubocop:todo Rails/SkipsModelValidations
2425
current_user.events.update_all(user_id: nil)
26+
# rubocop:enable Rails/SkipsModelValidations
2527
redirect_to user_path
2628
end
2729

app/models/action_page.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ class ActionPage < ActiveRecord::Base
3636
belongs_to :congress_message_campaign
3737
belongs_to :call_campaign
3838
belongs_to :category, optional: true
39+
# rubocop:todo Rails/InverseOf
3940
belongs_to :active_action_page_for_redirect, class_name: "ActionPage",
4041
foreign_key: "archived_redirect_action_page_id"
42+
# rubocop:enable Rails/InverseOf
43+
# rubocop:todo Rails/InverseOf
4144
belongs_to :author, class_name: "User", foreign_key: :user_id, optional: true
45+
# rubocop:enable Rails/InverseOf
4246

4347
accepts_nested_attributes_for :tweet, :petition, :email_campaign,
4448
:call_campaign, :congress_message_campaign, :affiliation_types, :partnerships,

app/models/congress_scorecard.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ class CongressScorecard < ActiveRecord::Base
66
belongs_to :action_page
77

88
def increment!
9+
# rubocop:todo Rails/SkipsModelValidations
910
CongressScorecard.increment_counter(:counter, id) # Increments counter atomically
11+
# rubocop:enable Rails/SkipsModelValidations
1012
end
1113
end

lib/related_content.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def image
3838
attr_reader :url, :page, :loaded_successfully
3939

4040
# rubocop:todo Naming/MemoizedInstanceVariableName
41-
def open_page # rubocop:todo Naming/MemoizedInstanceVariableName
41+
def open_page
4242
@page ||= Nokogiri::HTML(open(url))
4343
end
4444
# rubocop:enable Naming/MemoizedInstanceVariableName

lib/tasks/ahoy.rake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
namespace :ahoy do
22
desc "Fix name for view events"
33
task fix_views: :environment do
4+
# rubocop:todo Rails/SkipsModelValidations
45
Ahoy::Event.where("properties ->> 'actionType' = 'view'").update_all(name: "View")
6+
# rubocop:enable Rails/SkipsModelValidations
57
end
68

79
task fix_action_page_ids: :environment do

lib/tasks/congress.rake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ namespace :congress do
4343
twitter_id = info["social"]["twitter"]
4444
next unless twitter_id
4545

46+
# rubocop:todo Rails/SkipsModelValidations
4647
CongressMember
4748
.where(bioguide_id: info["id"]["bioguide"])
4849
.update_all(twitter_id: twitter_id)
50+
# rubocop:enable Rails/SkipsModelValidations
4951
end
5052
end
5153
end

spec/requests/congress_messages_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ def get_congress_message_form # rubocop:todo Naming/AccessorMethodName
7474

7575
it "to target bioguide_ids" do
7676
campaign = FactoryGirl.create(:congress_message_campaign, :targeting_bioguide_ids)
77+
# rubocop:todo Rails/SkipsModelValidations
7778
action_page.update_attribute(:congress_message_campaign, campaign)
79+
# rubocop:enable Rails/SkipsModelValidations
7880
get_congress_message_form
7981
expect(response.body).to include("C000880")
8082
expect(response.body).not_to include("A000360")
@@ -83,7 +85,9 @@ def get_congress_message_form # rubocop:todo Naming/AccessorMethodName
8385
it "to target a single chamber" do
8486
members.last.update(chamber: "house", district: 10)
8587
campaign = FactoryGirl.create(:congress_message_campaign, :targeting_senate)
88+
# rubocop:todo Rails/SkipsModelValidations
8689
action_page.update_attribute(:congress_message_campaign, campaign)
90+
# rubocop:enable Rails/SkipsModelValidations
8791
get_congress_message_form
8892
expect(response.body).to include("C000880")
8993
expect(response.body).not_to include("A000360")

0 commit comments

Comments
 (0)