Commit 1095d7830db91ac55b5dc0140597f76700c8d3ff
1 parent
af87b10a
Exists in
master
and in
1 other branch
Rubocop: space after comma,consistently
Showing
20 changed files
with
32 additions
and
37 deletions
Show diff stats
.rubocop_todo.yml
@@ -311,11 +311,6 @@ Style/SingleSpaceBeforeFirstArg: | @@ -311,11 +311,6 @@ Style/SingleSpaceBeforeFirstArg: | ||
311 | - 'spec/fabricators/notice_fabricator.rb' | 311 | - 'spec/fabricators/notice_fabricator.rb' |
312 | - 'spec/fabricators/user_fabricator.rb' | 312 | - 'spec/fabricators/user_fabricator.rb' |
313 | 313 | ||
314 | -# Offense count: 43 | ||
315 | -# Cop supports --auto-correct. | ||
316 | -Style/SpaceAfterComma: | ||
317 | - Enabled: false | ||
318 | - | ||
319 | # Offense count: 2 | 314 | # Offense count: 2 |
320 | # Cop supports --auto-correct. | 315 | # Cop supports --auto-correct. |
321 | # Configuration parameters: EnforcedStyle, SupportedStyles. | 316 | # Configuration parameters: EnforcedStyle, SupportedStyles. |
app/controllers/apps_controller.rb
@@ -116,7 +116,7 @@ protected | @@ -116,7 +116,7 @@ protected | ||
116 | # Sanitize negative values, split on comma, | 116 | # Sanitize negative values, split on comma, |
117 | # strip, parse as integer, remove all '0's. | 117 | # strip, parse as integer, remove all '0's. |
118 | # If empty, set as default and show an error message. | 118 | # If empty, set as default and show an error message. |
119 | - email_at_notices = val.gsub(/-\d+/,"").split(",").map{|v| v.strip.to_i }.reject{|v| v == 0} | 119 | + email_at_notices = val.gsub(/-\d+/, "").split(",").map{|v| v.strip.to_i }.reject{|v| v == 0} |
120 | if email_at_notices.any? | 120 | if email_at_notices.any? |
121 | params[:app][:email_at_notices] = email_at_notices | 121 | params[:app][:email_at_notices] = email_at_notices |
122 | else | 122 | else |
@@ -131,7 +131,7 @@ protected | @@ -131,7 +131,7 @@ protected | ||
131 | # Sanitize negative values, split on comma, | 131 | # Sanitize negative values, split on comma, |
132 | # strip, parse as integer, remove all '0's. | 132 | # strip, parse as integer, remove all '0's. |
133 | # If empty, set as default and show an error message. | 133 | # If empty, set as default and show an error message. |
134 | - notify_at_notices = val.gsub(/-\d+/,"").split(",").map{|v| v.strip.to_i } | 134 | + notify_at_notices = val.gsub(/-\d+/, "").split(",").map{|v| v.strip.to_i } |
135 | if notify_at_notices.any? | 135 | if notify_at_notices.any? |
136 | params[:app][:notification_service_attributes][:notify_at_notices] = notify_at_notices | 136 | params[:app][:notification_service_attributes][:notify_at_notices] = notify_at_notices |
137 | else | 137 | else |
app/controllers/users_controller.rb
@@ -63,7 +63,7 @@ protected | @@ -63,7 +63,7 @@ protected | ||
63 | end | 63 | end |
64 | 64 | ||
65 | def user_permit_params | 65 | def user_permit_params |
66 | - @user_permit_params ||= [:name,:username, :email, :github_login, :per_page, :time_zone] | 66 | + @user_permit_params ||= [:name, :username, :email, :github_login, :per_page, :time_zone] |
67 | @user_permit_params << :admin if current_user.admin? && current_user.id != params[:id] | 67 | @user_permit_params << :admin if current_user.admin? && current_user.id != params[:id] |
68 | @user_permit_params |= [:password, :password_confirmation] if user_password_params.values.all?{|pa| !pa.blank? } | 68 | @user_permit_params |= [:password, :password_confirmation] if user_password_params.values.all?{|pa| !pa.blank? } |
69 | @user_permit_params | 69 | @user_permit_params |
app/decorators/issue_tracker_type_decorator.rb
@@ -6,7 +6,7 @@ class IssueTrackerTypeDecorator < Draper::Decorator | @@ -6,7 +6,7 @@ class IssueTrackerTypeDecorator < Draper::Decorator | ||
6 | def icons | 6 | def icons |
7 | return unless object.icons | 7 | return unless object.icons |
8 | 8 | ||
9 | - object.icons.reduce({}) do |c, (k,v)| | 9 | + object.icons.reduce({}) do |c, (k, v)| |
10 | c[k] = "data:#{v[0]};base64,#{Base64.encode64(v[1])}"; c | 10 | c[k] = "data:#{v[0]};base64,#{Base64.encode64(v[1])}"; c |
11 | end | 11 | end |
12 | end | 12 | end |
app/helpers/application_helper.rb
@@ -5,7 +5,7 @@ module ApplicationHelper | @@ -5,7 +5,7 @@ module ApplicationHelper | ||
5 | 5 | ||
6 | def generate_problem_ical(notices) | 6 | def generate_problem_ical(notices) |
7 | RiCal.Calendar do |cal| | 7 | RiCal.Calendar do |cal| |
8 | - notices.each_with_index do |notice,idx| | 8 | + notices.each_with_index do |notice, idx| |
9 | cal.event do |event| | 9 | cal.event do |event| |
10 | event.summary = "#{idx+1} #{notice.message}" | 10 | event.summary = "#{idx+1} #{notice.message}" |
11 | event.description = notice.url if notice.url | 11 | event.description = notice.url if notice.url |
@@ -21,7 +21,7 @@ module ApplicationHelper | @@ -21,7 +21,7 @@ module ApplicationHelper | ||
21 | 21 | ||
22 | def generate_ical(deploys) | 22 | def generate_ical(deploys) |
23 | RiCal.Calendar { |cal| | 23 | RiCal.Calendar { |cal| |
24 | - deploys.each_with_index do |deploy,idx| | 24 | + deploys.each_with_index do |deploy, idx| |
25 | cal.event do |event| | 25 | cal.event do |event| |
26 | event.summary = "#{idx+1} #{deploy.repository}" | 26 | event.summary = "#{idx+1} #{deploy.repository}" |
27 | event.description = deploy.revision.to_s | 27 | event.description = deploy.revision.to_s |
app/helpers/form_helper.rb
@@ -11,6 +11,6 @@ module FormHelper | @@ -11,6 +11,6 @@ module FormHelper | ||
11 | end | 11 | end |
12 | 12 | ||
13 | def label_for_attr(builder, field) | 13 | def label_for_attr(builder, field) |
14 | - (builder.object_name + field).gsub(/[\[\]]/,'_').squeeze('_') | 14 | + (builder.object_name + field).gsub(/[\[\]]/, '_').squeeze('_') |
15 | end | 15 | end |
16 | end | 16 | end |
app/mailers/mailer.rb
@@ -59,6 +59,6 @@ class Mailer < ActionMailer::Base | @@ -59,6 +59,6 @@ class Mailer < ActionMailer::Base | ||
59 | end | 59 | end |
60 | 60 | ||
61 | private def errbit_headers(header) | 61 | private def errbit_headers(header) |
62 | - header.each { |key,value| headers["X-Errbit-#{key}"] = value.to_s } | 62 | + header.each { |key, value| headers["X-Errbit-#{key}"] = value.to_s } |
63 | end | 63 | end |
64 | end | 64 | end |
app/models/deploy.rb
app/models/issue_tracker.rb
@@ -27,7 +27,7 @@ class IssueTracker | @@ -27,7 +27,7 @@ class IssueTracker | ||
27 | 27 | ||
28 | # Allow the tracker to validate its own params | 28 | # Allow the tracker to validate its own params |
29 | def validate_tracker | 29 | def validate_tracker |
30 | - (tracker.errors || {}).each do |k,v| | 30 | + (tracker.errors || {}).each do |k, v| |
31 | errors.add k, v | 31 | errors.add k, v |
32 | end | 32 | end |
33 | end | 33 | end |
app/models/notice.rb
@@ -132,15 +132,15 @@ protected | @@ -132,15 +132,15 @@ protected | ||
132 | 132 | ||
133 | def sanitize | 133 | def sanitize |
134 | [:server_environment, :request, :notifier].each do |h| | 134 | [:server_environment, :request, :notifier].each do |h| |
135 | - send("#{h}=",sanitize_hash(send(h))) | 135 | + send("#{h}=", sanitize_hash(send(h))) |
136 | end | 136 | end |
137 | end | 137 | end |
138 | 138 | ||
139 | def sanitize_hash(hash) | 139 | def sanitize_hash(hash) |
140 | hash.recurse do |recurse_hash| | 140 | hash.recurse do |recurse_hash| |
141 | - recurse_hash.inject({}) do |h,(k,v)| | 141 | + recurse_hash.inject({}) do |h, (k, v)| |
142 | if k.is_a?(String) | 142 | if k.is_a?(String) |
143 | - h[k.gsub(/\./,'.').gsub(/^\$/,'$')] = v | 143 | + h[k.gsub(/\./, '.').gsub(/^\$/, '$')] = v |
144 | else | 144 | else |
145 | h[k] = v | 145 | h[k] = v |
146 | end | 146 | end |
app/models/problem.rb
@@ -118,7 +118,7 @@ class Problem | @@ -118,7 +118,7 @@ class Problem | ||
118 | 'notices_count' => notices_count.to_i > 1 ? notices_count - 1 : 0 | 118 | 'notices_count' => notices_count.to_i > 1 ? notices_count - 1 : 0 |
119 | ) | 119 | ) |
120 | 120 | ||
121 | - CACHED_NOTICE_ATTRIBUTES.each do |k,v| | 121 | + CACHED_NOTICE_ATTRIBUTES.each do |k, v| |
122 | digest = Digest::MD5.hexdigest(notice.send(v)) | 122 | digest = Digest::MD5.hexdigest(notice.send(v)) |
123 | field = "#{k}.#{digest}" | 123 | field = "#{k}.#{digest}" |
124 | 124 | ||
@@ -132,7 +132,7 @@ class Problem | @@ -132,7 +132,7 @@ class Problem | ||
132 | end | 132 | end |
133 | 133 | ||
134 | def recache | 134 | def recache |
135 | - CACHED_NOTICE_ATTRIBUTES.each do |k,v| | 135 | + CACHED_NOTICE_ATTRIBUTES.each do |k, v| |
136 | # clear all cached attributes | 136 | # clear all cached attributes |
137 | send("#{k}=", {}) | 137 | send("#{k}=", {}) |
138 | 138 |
db/seeds.rb
@@ -6,7 +6,7 @@ puts "-------------------------------" | @@ -6,7 +6,7 @@ puts "-------------------------------" | ||
6 | # Create an initial Admin User | 6 | # Create an initial Admin User |
7 | admin_username = "errbit" | 7 | admin_username = "errbit" |
8 | admin_email = "errbit@#{Errbit::Config.host}" | 8 | admin_email = "errbit@#{Errbit::Config.host}" |
9 | -admin_pass = SecureRandom.urlsafe_base64(12)[0,12] | 9 | +admin_pass = SecureRandom.urlsafe_base64(12)[0, 12] |
10 | 10 | ||
11 | puts "Creating an initial admin user:" | 11 | puts "Creating an initial admin user:" |
12 | puts "-- username: #{admin_username}" if Errbit::Config.user_has_username | 12 | puts "-- username: #{admin_username}" if Errbit::Config.user_has_username |
spec/controllers/notices_controller_spec.rb
@@ -2,7 +2,7 @@ describe NoticesController, type: 'controller' do | @@ -2,7 +2,7 @@ describe NoticesController, type: 'controller' do | ||
2 | it_requires_authentication :for => { :locate => :get } | 2 | it_requires_authentication :for => { :locate => :get } |
3 | 3 | ||
4 | let(:notice) { Fabricate(:notice) } | 4 | let(:notice) { Fabricate(:notice) } |
5 | - let(:xml) { Rails.root.join('spec','fixtures','hoptoad_test_notice.xml').read } | 5 | + let(:xml) { Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice.xml').read } |
6 | let(:app) { Fabricate(:app) } | 6 | let(:app) { Fabricate(:app) } |
7 | let(:error_report) { double(:valid? => true, :generate_notice! => true, :notice => notice, :should_keep? => true) } | 7 | let(:error_report) { double(:valid? => true, :generate_notice! => true, :notice => notice, :should_keep? => true) } |
8 | 8 |
spec/decorators/app_decorator_spec.rb
1 | describe AppDecorator do | 1 | describe AppDecorator do |
2 | describe "#email_at_notices" do | 2 | describe "#email_at_notices" do |
3 | it 'return the list separate by comma' do | 3 | it 'return the list separate by comma' do |
4 | - expect(AppDecorator.new(double(:email_at_notices => [2,3])).email_at_notices).to eql '2, 3' | 4 | + expect(AppDecorator.new(double(:email_at_notices => [2, 3])).email_at_notices).to eql '2, 3' |
5 | end | 5 | end |
6 | end | 6 | end |
7 | 7 |
spec/models/app_spec.rb
@@ -188,7 +188,7 @@ describe App, type: 'model' do | @@ -188,7 +188,7 @@ describe App, type: 'model' do | ||
188 | expect(Err.where(conditions).first).to be_nil | 188 | expect(Err.where(conditions).first).to be_nil |
189 | expect { | 189 | expect { |
190 | app.find_or_create_err!(conditions) | 190 | app.find_or_create_err!(conditions) |
191 | - }.to change(Problem,:count).by(1) | 191 | + }.to change(Problem, :count).by(1) |
192 | end | 192 | end |
193 | 193 | ||
194 | context "without error_class" do | 194 | context "without error_class" do |
@@ -201,7 +201,7 @@ describe App, type: 'model' do | @@ -201,7 +201,7 @@ describe App, type: 'model' do | ||
201 | expect(Err.where(conditions).first).to be_nil | 201 | expect(Err.where(conditions).first).to be_nil |
202 | expect { | 202 | expect { |
203 | app.find_or_create_err!(conditions) | 203 | app.find_or_create_err!(conditions) |
204 | - }.to change(Problem,:count).by(1) | 204 | + }.to change(Problem, :count).by(1) |
205 | end | 205 | end |
206 | end | 206 | end |
207 | end | 207 | end |
spec/models/error_report_spec.rb
@@ -18,7 +18,7 @@ end | @@ -18,7 +18,7 @@ end | ||
18 | 18 | ||
19 | describe ErrorReport do | 19 | describe ErrorReport do |
20 | let(:xml){ | 20 | let(:xml){ |
21 | - Rails.root.join('spec','fixtures','hoptoad_test_notice.xml').read | 21 | + Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice.xml').read |
22 | } | 22 | } |
23 | 23 | ||
24 | let(:error_report) { ErrorReport.new(xml) } | 24 | let(:error_report) { ErrorReport.new(xml) } |
@@ -53,7 +53,7 @@ describe ErrorReport do | @@ -53,7 +53,7 @@ describe ErrorReport do | ||
53 | 53 | ||
54 | context "with a minimal notice" do | 54 | context "with a minimal notice" do |
55 | let(:xml){ | 55 | let(:xml){ |
56 | - Rails.root.join('spec','fixtures','minimal_test_notice.xml').read | 56 | + Rails.root.join('spec', 'fixtures', 'minimal_test_notice.xml').read |
57 | } | 57 | } |
58 | 58 | ||
59 | it 'save a notice' do | 59 | it 'save a notice' do |
@@ -236,7 +236,7 @@ describe ErrorReport do | @@ -236,7 +236,7 @@ describe ErrorReport do | ||
236 | 236 | ||
237 | context "with xml without request section" do | 237 | context "with xml without request section" do |
238 | let(:xml){ | 238 | let(:xml){ |
239 | - Rails.root.join('spec','fixtures','hoptoad_test_notice_without_request_section.xml').read | 239 | + Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice_without_request_section.xml').read |
240 | } | 240 | } |
241 | it "save a notice" do | 241 | it "save a notice" do |
242 | expect { | 242 | expect { |
@@ -249,7 +249,7 @@ describe ErrorReport do | @@ -249,7 +249,7 @@ describe ErrorReport do | ||
249 | 249 | ||
250 | context "with xml with only a single line of backtrace" do | 250 | context "with xml with only a single line of backtrace" do |
251 | let(:xml){ | 251 | let(:xml){ |
252 | - Rails.root.join('spec','fixtures','hoptoad_test_notice_with_one_line_of_backtrace.xml').read | 252 | + Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice_with_one_line_of_backtrace.xml').read |
253 | } | 253 | } |
254 | it "save a notice" do | 254 | it "save a notice" do |
255 | expect { | 255 | expect { |
spec/models/notice_observer_spec.rb
@@ -78,7 +78,7 @@ describe "Callback on Notice", type: 'model' do | @@ -78,7 +78,7 @@ describe "Callback on Notice", type: 'model' do | ||
78 | Fabricate( | 78 | Fabricate( |
79 | :app_with_watcher, | 79 | :app_with_watcher, |
80 | notify_on_errs: true, | 80 | notify_on_errs: true, |
81 | - email_at_notices: [1,100] | 81 | + email_at_notices: [1, 100] |
82 | ) | 82 | ) |
83 | end | 83 | end |
84 | let(:notice_attrs) { notice_attrs_for.call(app.api_key) } | 84 | let(:notice_attrs) { notice_attrs_for.call(app.api_key) } |
@@ -161,7 +161,7 @@ describe "Callback on Notice", type: 'model' do | @@ -161,7 +161,7 @@ describe "Callback on Notice", type: 'model' do | ||
161 | 161 | ||
162 | describe "should send a notification at desired intervals" do | 162 | describe "should send a notification at desired intervals" do |
163 | let(:notification_service) do | 163 | let(:notification_service) do |
164 | - Fabricate(:campfire_notification_service, notify_at_notices: [1,2]) | 164 | + Fabricate(:campfire_notification_service, notify_at_notices: [1, 2]) |
165 | end | 165 | end |
166 | let(:app) { Fabricate(:app, notification_service: notification_service) } | 166 | let(:app) { Fabricate(:app, notification_service: notification_service) } |
167 | let(:notice_attrs) { notice_attrs_for.call(app.api_key) } | 167 | let(:notice_attrs) { notice_attrs_for.call(app.api_key) } |
spec/requests/notices_controller_spec.rb
@@ -3,7 +3,7 @@ describe "Notices management", type: 'request' do | @@ -3,7 +3,7 @@ describe "Notices management", type: 'request' do | ||
3 | 3 | ||
4 | describe "create a new notice" do | 4 | describe "create a new notice" do |
5 | context "with valide notice" do | 5 | context "with valide notice" do |
6 | - let(:xml) { Rails.root.join('spec','fixtures','hoptoad_test_notice.xml').read } | 6 | + let(:xml) { Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice.xml').read } |
7 | it 'save a new notice' do | 7 | it 'save a new notice' do |
8 | expect { | 8 | expect { |
9 | post '/notifier_api/v2/notices', :data => xml | 9 | post '/notifier_api/v2/notices', :data => xml |
@@ -15,7 +15,7 @@ describe "Notices management", type: 'request' do | @@ -15,7 +15,7 @@ describe "Notices management", type: 'request' do | ||
15 | end | 15 | end |
16 | 16 | ||
17 | context "with notice with empty backtrace" do | 17 | context "with notice with empty backtrace" do |
18 | - let(:xml) { Rails.root.join('spec','fixtures','hoptoad_test_notice_without_line_of_backtrace.xml').read } | 18 | + let(:xml) { Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice_without_line_of_backtrace.xml').read } |
19 | it 'save a new notice' do | 19 | it 'save a new notice' do |
20 | expect { | 20 | expect { |
21 | post '/notifier_api/v2/notices', :data => xml | 21 | post '/notifier_api/v2/notices', :data => xml |
@@ -28,7 +28,7 @@ describe "Notices management", type: 'request' do | @@ -28,7 +28,7 @@ describe "Notices management", type: 'request' do | ||
28 | 28 | ||
29 | context "with notice with bad api_key" do | 29 | context "with notice with bad api_key" do |
30 | let(:errbit_app) { Fabricate(:app) } | 30 | let(:errbit_app) { Fabricate(:app) } |
31 | - let(:xml) { Rails.root.join('spec','fixtures','hoptoad_test_notice.xml').read } | 31 | + let(:xml) { Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice.xml').read } |
32 | it 'not save a new notice and return 422' do | 32 | it 'not save a new notice and return 422' do |
33 | expect { | 33 | expect { |
34 | post '/notifier_api/v2/notices', :data => xml | 34 | post '/notifier_api/v2/notices', :data => xml |
@@ -39,7 +39,7 @@ describe "Notices management", type: 'request' do | @@ -39,7 +39,7 @@ describe "Notices management", type: 'request' do | ||
39 | end | 39 | end |
40 | 40 | ||
41 | context "with GET request" do | 41 | context "with GET request" do |
42 | - let(:xml) { Rails.root.join('spec','fixtures','hoptoad_test_notice.xml').read } | 42 | + let(:xml) { Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice.xml').read } |
43 | it 'save a new notice' do | 43 | it 'save a new notice' do |
44 | expect { | 44 | expect { |
45 | get '/notifier_api/v2/notices', :data => xml | 45 | get '/notifier_api/v2/notices', :data => xml |
spec/views/apps/edit.html.haml_spec.rb
@@ -27,7 +27,7 @@ describe "apps/edit.html.haml", type: 'view' do | @@ -27,7 +27,7 @@ describe "apps/edit.html.haml", type: 'view' do | ||
27 | context "with unvalid app" do | 27 | context "with unvalid app" do |
28 | let(:app) { | 28 | let(:app) { |
29 | app = stub_model(App) | 29 | app = stub_model(App) |
30 | - app.errors.add(:base,'You must specify your') | 30 | + app.errors.add(:base, 'You must specify your') |
31 | app | 31 | app |
32 | } | 32 | } |
33 | 33 |
spec/views/apps/new.html.haml_spec.rb
@@ -23,7 +23,7 @@ describe "apps/new.html.haml", type: 'view' do | @@ -23,7 +23,7 @@ describe "apps/new.html.haml", type: 'view' do | ||
23 | context "with unvalid app" do | 23 | context "with unvalid app" do |
24 | let(:app) { | 24 | let(:app) { |
25 | app = stub_model(App) | 25 | app = stub_model(App) |
26 | - app.errors.add(:base,'You must specify your') | 26 | + app.errors.add(:base, 'You must specify your') |
27 | app | 27 | app |
28 | } | 28 | } |
29 | 29 |