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 | 311 | - 'spec/fabricators/notice_fabricator.rb' |
| 312 | 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 | 314 | # Offense count: 2 |
| 320 | 315 | # Cop supports --auto-correct. |
| 321 | 316 | # Configuration parameters: EnforcedStyle, SupportedStyles. | ... | ... |
app/controllers/apps_controller.rb
| ... | ... | @@ -116,7 +116,7 @@ protected |
| 116 | 116 | # Sanitize negative values, split on comma, |
| 117 | 117 | # strip, parse as integer, remove all '0's. |
| 118 | 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 | 120 | if email_at_notices.any? |
| 121 | 121 | params[:app][:email_at_notices] = email_at_notices |
| 122 | 122 | else |
| ... | ... | @@ -131,7 +131,7 @@ protected |
| 131 | 131 | # Sanitize negative values, split on comma, |
| 132 | 132 | # strip, parse as integer, remove all '0's. |
| 133 | 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 | 135 | if notify_at_notices.any? |
| 136 | 136 | params[:app][:notification_service_attributes][:notify_at_notices] = notify_at_notices |
| 137 | 137 | else | ... | ... |
app/controllers/users_controller.rb
| ... | ... | @@ -63,7 +63,7 @@ protected |
| 63 | 63 | end |
| 64 | 64 | |
| 65 | 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 | 67 | @user_permit_params << :admin if current_user.admin? && current_user.id != params[:id] |
| 68 | 68 | @user_permit_params |= [:password, :password_confirmation] if user_password_params.values.all?{|pa| !pa.blank? } |
| 69 | 69 | @user_permit_params | ... | ... |
app/decorators/issue_tracker_type_decorator.rb
| ... | ... | @@ -6,7 +6,7 @@ class IssueTrackerTypeDecorator < Draper::Decorator |
| 6 | 6 | def icons |
| 7 | 7 | return unless object.icons |
| 8 | 8 | |
| 9 | - object.icons.reduce({}) do |c, (k,v)| | |
| 9 | + object.icons.reduce({}) do |c, (k, v)| | |
| 10 | 10 | c[k] = "data:#{v[0]};base64,#{Base64.encode64(v[1])}"; c |
| 11 | 11 | end |
| 12 | 12 | end | ... | ... |
app/helpers/application_helper.rb
| ... | ... | @@ -5,7 +5,7 @@ module ApplicationHelper |
| 5 | 5 | |
| 6 | 6 | def generate_problem_ical(notices) |
| 7 | 7 | RiCal.Calendar do |cal| |
| 8 | - notices.each_with_index do |notice,idx| | |
| 8 | + notices.each_with_index do |notice, idx| | |
| 9 | 9 | cal.event do |event| |
| 10 | 10 | event.summary = "#{idx+1} #{notice.message}" |
| 11 | 11 | event.description = notice.url if notice.url |
| ... | ... | @@ -21,7 +21,7 @@ module ApplicationHelper |
| 21 | 21 | |
| 22 | 22 | def generate_ical(deploys) |
| 23 | 23 | RiCal.Calendar { |cal| |
| 24 | - deploys.each_with_index do |deploy,idx| | |
| 24 | + deploys.each_with_index do |deploy, idx| | |
| 25 | 25 | cal.event do |event| |
| 26 | 26 | event.summary = "#{idx+1} #{deploy.repository}" |
| 27 | 27 | event.description = deploy.revision.to_s | ... | ... |
app/helpers/form_helper.rb
app/mailers/mailer.rb
app/models/deploy.rb
app/models/issue_tracker.rb
app/models/notice.rb
| ... | ... | @@ -132,15 +132,15 @@ protected |
| 132 | 132 | |
| 133 | 133 | def sanitize |
| 134 | 134 | [:server_environment, :request, :notifier].each do |h| |
| 135 | - send("#{h}=",sanitize_hash(send(h))) | |
| 135 | + send("#{h}=", sanitize_hash(send(h))) | |
| 136 | 136 | end |
| 137 | 137 | end |
| 138 | 138 | |
| 139 | 139 | def sanitize_hash(hash) |
| 140 | 140 | hash.recurse do |recurse_hash| |
| 141 | - recurse_hash.inject({}) do |h,(k,v)| | |
| 141 | + recurse_hash.inject({}) do |h, (k, v)| | |
| 142 | 142 | if k.is_a?(String) |
| 143 | - h[k.gsub(/\./,'.').gsub(/^\$/,'$')] = v | |
| 143 | + h[k.gsub(/\./, '.').gsub(/^\$/, '$')] = v | |
| 144 | 144 | else |
| 145 | 145 | h[k] = v |
| 146 | 146 | end | ... | ... |
app/models/problem.rb
| ... | ... | @@ -118,7 +118,7 @@ class Problem |
| 118 | 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 | 122 | digest = Digest::MD5.hexdigest(notice.send(v)) |
| 123 | 123 | field = "#{k}.#{digest}" |
| 124 | 124 | |
| ... | ... | @@ -132,7 +132,7 @@ class Problem |
| 132 | 132 | end |
| 133 | 133 | |
| 134 | 134 | def recache |
| 135 | - CACHED_NOTICE_ATTRIBUTES.each do |k,v| | |
| 135 | + CACHED_NOTICE_ATTRIBUTES.each do |k, v| | |
| 136 | 136 | # clear all cached attributes |
| 137 | 137 | send("#{k}=", {}) |
| 138 | 138 | ... | ... |
db/seeds.rb
| ... | ... | @@ -6,7 +6,7 @@ puts "-------------------------------" |
| 6 | 6 | # Create an initial Admin User |
| 7 | 7 | admin_username = "errbit" |
| 8 | 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 | 11 | puts "Creating an initial admin user:" |
| 12 | 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 | 2 | it_requires_authentication :for => { :locate => :get } |
| 3 | 3 | |
| 4 | 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 | 6 | let(:app) { Fabricate(:app) } |
| 7 | 7 | let(:error_report) { double(:valid? => true, :generate_notice! => true, :notice => notice, :should_keep? => true) } |
| 8 | 8 | ... | ... |
spec/decorators/app_decorator_spec.rb
| 1 | 1 | describe AppDecorator do |
| 2 | 2 | describe "#email_at_notices" do |
| 3 | 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 | 5 | end |
| 6 | 6 | end |
| 7 | 7 | ... | ... |
spec/models/app_spec.rb
| ... | ... | @@ -188,7 +188,7 @@ describe App, type: 'model' do |
| 188 | 188 | expect(Err.where(conditions).first).to be_nil |
| 189 | 189 | expect { |
| 190 | 190 | app.find_or_create_err!(conditions) |
| 191 | - }.to change(Problem,:count).by(1) | |
| 191 | + }.to change(Problem, :count).by(1) | |
| 192 | 192 | end |
| 193 | 193 | |
| 194 | 194 | context "without error_class" do |
| ... | ... | @@ -201,7 +201,7 @@ describe App, type: 'model' do |
| 201 | 201 | expect(Err.where(conditions).first).to be_nil |
| 202 | 202 | expect { |
| 203 | 203 | app.find_or_create_err!(conditions) |
| 204 | - }.to change(Problem,:count).by(1) | |
| 204 | + }.to change(Problem, :count).by(1) | |
| 205 | 205 | end |
| 206 | 206 | end |
| 207 | 207 | end | ... | ... |
spec/models/error_report_spec.rb
| ... | ... | @@ -18,7 +18,7 @@ end |
| 18 | 18 | |
| 19 | 19 | describe ErrorReport do |
| 20 | 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 | 24 | let(:error_report) { ErrorReport.new(xml) } |
| ... | ... | @@ -53,7 +53,7 @@ describe ErrorReport do |
| 53 | 53 | |
| 54 | 54 | context "with a minimal notice" do |
| 55 | 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 | 59 | it 'save a notice' do |
| ... | ... | @@ -236,7 +236,7 @@ describe ErrorReport do |
| 236 | 236 | |
| 237 | 237 | context "with xml without request section" do |
| 238 | 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 | 241 | it "save a notice" do |
| 242 | 242 | expect { |
| ... | ... | @@ -249,7 +249,7 @@ describe ErrorReport do |
| 249 | 249 | |
| 250 | 250 | context "with xml with only a single line of backtrace" do |
| 251 | 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 | 254 | it "save a notice" do |
| 255 | 255 | expect { | ... | ... |
spec/models/notice_observer_spec.rb
| ... | ... | @@ -78,7 +78,7 @@ describe "Callback on Notice", type: 'model' do |
| 78 | 78 | Fabricate( |
| 79 | 79 | :app_with_watcher, |
| 80 | 80 | notify_on_errs: true, |
| 81 | - email_at_notices: [1,100] | |
| 81 | + email_at_notices: [1, 100] | |
| 82 | 82 | ) |
| 83 | 83 | end |
| 84 | 84 | let(:notice_attrs) { notice_attrs_for.call(app.api_key) } |
| ... | ... | @@ -161,7 +161,7 @@ describe "Callback on Notice", type: 'model' do |
| 161 | 161 | |
| 162 | 162 | describe "should send a notification at desired intervals" do |
| 163 | 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 | 165 | end |
| 166 | 166 | let(:app) { Fabricate(:app, notification_service: notification_service) } |
| 167 | 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 | 3 | |
| 4 | 4 | describe "create a new notice" do |
| 5 | 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 | 7 | it 'save a new notice' do |
| 8 | 8 | expect { |
| 9 | 9 | post '/notifier_api/v2/notices', :data => xml |
| ... | ... | @@ -15,7 +15,7 @@ describe "Notices management", type: 'request' do |
| 15 | 15 | end |
| 16 | 16 | |
| 17 | 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 | 19 | it 'save a new notice' do |
| 20 | 20 | expect { |
| 21 | 21 | post '/notifier_api/v2/notices', :data => xml |
| ... | ... | @@ -28,7 +28,7 @@ describe "Notices management", type: 'request' do |
| 28 | 28 | |
| 29 | 29 | context "with notice with bad api_key" do |
| 30 | 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 | 32 | it 'not save a new notice and return 422' do |
| 33 | 33 | expect { |
| 34 | 34 | post '/notifier_api/v2/notices', :data => xml |
| ... | ... | @@ -39,7 +39,7 @@ describe "Notices management", type: 'request' do |
| 39 | 39 | end |
| 40 | 40 | |
| 41 | 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 | 43 | it 'save a new notice' do |
| 44 | 44 | expect { |
| 45 | 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 | 27 | context "with unvalid app" do |
| 28 | 28 | let(:app) { |
| 29 | 29 | app = stub_model(App) |
| 30 | - app.errors.add(:base,'You must specify your') | |
| 30 | + app.errors.add(:base, 'You must specify your') | |
| 31 | 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 | 23 | context "with unvalid app" do |
| 24 | 24 | let(:app) { |
| 25 | 25 | app = stub_model(App) |
| 26 | - app.errors.add(:base,'You must specify your') | |
| 26 | + app.errors.add(:base, 'You must specify your') | |
| 27 | 27 | app |
| 28 | 28 | } |
| 29 | 29 | ... | ... |