Commit 9d51326c1930ce03eb7b3f70c916d2fcd0e4a469
Exists in
master
and in
1 other branch
Merge pull request #988 from rud/chore/fix-more-whitespace
Rubocop: indentation consistency fixes
Showing
66 changed files
with
316 additions
and
438 deletions
Show diff stats
.rubocop.yml
... | ... | @@ -21,7 +21,19 @@ Style/IndentationConsistency: |
21 | 21 | # modifier keywords shall be indented the same as public methods and that |
22 | 22 | # protected and private members shall be indented one step more than the |
23 | 23 | # modifiers. |
24 | - EnforcedStyle: rails | |
24 | + EnforcedStyle: rails | |
25 | 25 | |
26 | 26 | Style/AccessModifierIndentation: |
27 | 27 | EnforcedStyle: outdent |
28 | + | |
29 | +Style/AlignParameters: | |
30 | + EnforcedStyle: with_fixed_indentation | |
31 | + | |
32 | +Style/IndentHash: | |
33 | + EnforcedStyle: consistent | |
34 | + | |
35 | +Style/SpaceAroundOperators: | |
36 | + MultiSpaceAllowedForOperators: | |
37 | + - '=' | |
38 | + - '=>' | |
39 | + - '||=' | ... | ... |
.rubocop_todo.yml
... | ... | @@ -64,29 +64,12 @@ Style/AlignHash: |
64 | 64 | - 'spec/controllers/problems_controller_spec.rb' |
65 | 65 | - 'spec/models/problem_spec.rb' |
66 | 66 | |
67 | -# Offense count: 6 | |
68 | -# Cop supports --auto-correct. | |
69 | -# Configuration parameters: EnforcedStyle, SupportedStyles. | |
70 | -Style/AlignParameters: | |
71 | - Exclude: | |
72 | - - 'app/helpers/apps_helper.rb' | |
73 | - - 'app/models/app.rb' | |
74 | - - 'app/models/notification_services/gtalk_service.rb' | |
75 | - - 'config/initializers/devise.rb' | |
76 | - | |
77 | 67 | # Offense count: 105 |
78 | 68 | # Cop supports --auto-correct. |
79 | 69 | # Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods. |
80 | 70 | Style/BlockDelimiters: |
81 | 71 | Enabled: false |
82 | 72 | |
83 | -# Offense count: 2 | |
84 | -# Cop supports --auto-correct. | |
85 | -Style/BlockEndNewline: | |
86 | - Exclude: | |
87 | - - 'spec/models/error_report_spec.rb' | |
88 | - - 'spec/views/apps/show.atom.builder_spec.rb' | |
89 | - | |
90 | 73 | # Offense count: 49 |
91 | 74 | # Cop supports --auto-correct. |
92 | 75 | # Configuration parameters: EnforcedStyle, SupportedStyles. |
... | ... | @@ -195,39 +178,6 @@ Style/IfUnlessModifier: |
195 | 178 | - 'app/models/notice.rb' |
196 | 179 | - 'app/models/user.rb' |
197 | 180 | |
198 | -# Offense count: 5 | |
199 | -# Cop supports --auto-correct. | |
200 | -Style/IndentArray: | |
201 | - Exclude: | |
202 | - - 'app/models/notification_services/gtalk_service.rb' | |
203 | - - 'app/models/notification_services/hoiio_service.rb' | |
204 | - - 'app/models/notification_services/pushover_service.rb' | |
205 | - - 'app/models/notification_services/slack_service.rb' | |
206 | - - 'spec/models/notification_service/slack_service_spec.rb' | |
207 | - | |
208 | -# Offense count: 72 | |
209 | -# Cop supports --auto-correct. | |
210 | -# Configuration parameters: EnforcedStyle, SupportedStyles. | |
211 | -Style/IndentHash: | |
212 | - Enabled: false | |
213 | - | |
214 | -# Offense count: 27 | |
215 | -# Cop supports --auto-correct. | |
216 | -# Configuration parameters: EnforcedStyle, SupportedStyles. | |
217 | -Style/IndentationConsistency: | |
218 | - Exclude: | |
219 | - - 'app/controllers/apps_controller.rb' | |
220 | - - 'app/controllers/comments_controller.rb' | |
221 | - - 'app/controllers/deploys_controller.rb' | |
222 | - - 'app/controllers/users_controller.rb' | |
223 | - - 'app/helpers/application_helper.rb' | |
224 | - - 'app/models/app.rb' | |
225 | - - 'app/models/comment.rb' | |
226 | - - 'app/models/deploy.rb' | |
227 | - - 'app/models/problem.rb' | |
228 | - - 'app/models/watcher.rb' | |
229 | - - 'lib/hoptoad.rb' | |
230 | - | |
231 | 181 | # Offense count: 6 |
232 | 182 | # Cop supports --auto-correct. |
233 | 183 | Style/Lambda: |
... | ... | @@ -354,44 +304,18 @@ Style/SingleSpaceBeforeFirstArg: |
354 | 304 | - 'spec/fabricators/notice_fabricator.rb' |
355 | 305 | - 'spec/fabricators/user_fabricator.rb' |
356 | 306 | |
357 | -# Offense count: 43 | |
358 | -# Cop supports --auto-correct. | |
359 | -Style/SpaceAfterComma: | |
360 | - Enabled: false | |
361 | - | |
362 | 307 | # Offense count: 2 |
363 | 308 | # Cop supports --auto-correct. |
364 | 309 | # Configuration parameters: EnforcedStyle, SupportedStyles. |
365 | 310 | Style/SpaceAroundEqualsInParameterDefault: |
366 | 311 | Enabled: false |
367 | 312 | |
368 | -# Offense count: 28 | |
369 | -# Cop supports --auto-correct. | |
370 | -# Configuration parameters: MultiSpaceAllowedForOperators. | |
371 | -Style/SpaceAroundOperators: | |
372 | - Exclude: | |
373 | - - 'app/controllers/api/v1/problems_controller.rb' | |
374 | - - 'app/helpers/application_helper.rb' | |
375 | - - 'app/helpers/apps_helper.rb' | |
376 | - - 'app/helpers/hash_helper.rb' | |
377 | - - 'app/models/issue_tracker.rb' | |
378 | - - 'app/models/notification_service.rb' | |
379 | - - 'config/load.rb' | |
380 | - - 'spec/controllers/problems_controller_spec.rb' | |
381 | - - 'spec/models/notice_observer_spec.rb' | |
382 | - | |
383 | 313 | # Offense count: 27 |
384 | 314 | # Cop supports --auto-correct. |
385 | 315 | # Configuration parameters: EnforcedStyle, SupportedStyles. |
386 | 316 | Style/SpaceBeforeBlockBraces: |
387 | 317 | Enabled: false |
388 | 318 | |
389 | -# Offense count: 1 | |
390 | -# Cop supports --auto-correct. | |
391 | -Style/SpaceBeforeComma: | |
392 | - Exclude: | |
393 | - - 'app/decorators/backtrace_line_decorator.rb' | |
394 | - | |
395 | 319 | # Offense count: 3 |
396 | 320 | # Cop supports --auto-correct. |
397 | 321 | Style/SpaceBeforeComment: |
... | ... | @@ -423,41 +347,12 @@ Style/SpaceInsideBrackets: |
423 | 347 | Style/SpaceInsideHashLiteralBraces: |
424 | 348 | Enabled: false |
425 | 349 | |
426 | -# Offense count: 23 | |
427 | -# Cop supports --auto-correct. | |
428 | -Style/SpaceInsideParens: | |
429 | - Exclude: | |
430 | - - 'spec/controllers/api/v1/problems_controller_spec.rb' | |
431 | - - 'spec/controllers/comments_controller_spec.rb' | |
432 | - - 'spec/controllers/problems_controller_spec.rb' | |
433 | - - 'spec/interactors/problem_merge_spec.rb' | |
434 | - - 'spec/mailers/mailer_spec.rb' | |
435 | - - 'spec/models/notice_observer_spec.rb' | |
436 | - - 'spec/models/notice_spec.rb' | |
437 | - | |
438 | -# Offense count: 9 | |
439 | -# Cop supports --auto-correct. | |
440 | -# Configuration parameters: EnforcedStyle, SupportedStyles. | |
441 | -Style/SpaceInsideStringInterpolation: | |
442 | - Exclude: | |
443 | - - 'app/models/issue.rb' | |
444 | - - 'app/models/notification_service.rb' | |
445 | - - 'app/models/notification_services/flowdock_service.rb' | |
446 | - - 'app/models/notification_services/hoiio_service.rb' | |
447 | - - 'spec/controllers/problems_controller_spec.rb' | |
448 | - | |
449 | 350 | # Offense count: 873 |
450 | 351 | # Cop supports --auto-correct. |
451 | 352 | # Configuration parameters: EnforcedStyle, SupportedStyles. |
452 | 353 | Style/StringLiterals: |
453 | 354 | Enabled: false |
454 | 355 | |
455 | -# Offense count: 1 | |
456 | -# Cop supports --auto-correct. | |
457 | -# Configuration parameters: EnforcedStyle, SupportedStyles. | |
458 | -Style/StringLiteralsInInterpolation: | |
459 | - Enabled: false | |
460 | - | |
461 | 356 | # Offense count: 3 |
462 | 357 | # Cop supports --auto-correct. |
463 | 358 | # Configuration parameters: IgnoredMethods. |
... | ... | @@ -467,12 +362,6 @@ Style/SymbolProc: |
467 | 362 | - 'app/models/deploy.rb' |
468 | 363 | - 'spec/models/deploy_spec.rb' |
469 | 364 | |
470 | -# Offense count: 21 | |
471 | -# Cop supports --auto-correct. | |
472 | -# Configuration parameters: EnforcedStyle, SupportedStyles. | |
473 | -Style/TrailingBlankLines: | |
474 | - Enabled: false | |
475 | - | |
476 | 365 | # Offense count: 13 |
477 | 366 | # Cop supports --auto-correct. |
478 | 367 | # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles. | ... | ... |
app/controllers/api/v1/problems_controller.rb
... | ... | @@ -24,7 +24,7 @@ class Api::V1::ProblemsController < ApplicationController |
24 | 24 | if params.key?(:start_date) && params.key?(:end_date) |
25 | 25 | start_date = Time.parse(params[:start_date]).utc |
26 | 26 | end_date = Time.parse(params[:end_date]).utc |
27 | - query = {:first_notice_at=>{"$lte"=>end_date}, "$or"=>[{:resolved_at=>nil}, {:resolved_at=>{"$gte"=>start_date}}]} | |
27 | + query = {:first_notice_at => {"$lte" => end_date}, "$or" => [{:resolved_at => nil}, {:resolved_at => {"$gte" => start_date}}]} | |
28 | 28 | end |
29 | 29 | |
30 | 30 | results = benchmark("[api/v1/problems_controller/index] query time") do | ... | ... |
app/controllers/apps_controller.rb
... | ... | @@ -103,43 +103,43 @@ protected |
103 | 103 | end |
104 | 104 | end |
105 | 105 | |
106 | - def plug_params(app) | |
107 | - app.watchers.build if app.watchers.none? | |
108 | - app.issue_tracker ||= IssueTracker.new | |
109 | - app.notification_service = NotificationService.new unless app.notification_service_configured? | |
110 | - app.copy_attributes_from(params[:copy_attributes_from]) if params[:copy_attributes_from] | |
111 | - end | |
106 | + def plug_params(app) | |
107 | + app.watchers.build if app.watchers.none? | |
108 | + app.issue_tracker ||= IssueTracker.new | |
109 | + app.notification_service = NotificationService.new unless app.notification_service_configured? | |
110 | + app.copy_attributes_from(params[:copy_attributes_from]) if params[:copy_attributes_from] | |
111 | + end | |
112 | 112 | |
113 | - # email_at_notices is edited as a string, and stored as an array. | |
114 | - def parse_email_at_notices_or_set_default | |
115 | - if params[:app] && (val = params[:app][:email_at_notices]) | |
116 | - # Sanitize negative values, split on comma, | |
117 | - # strip, parse as integer, remove all '0's. | |
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} | |
120 | - if email_at_notices.any? | |
121 | - params[:app][:email_at_notices] = email_at_notices | |
122 | - else | |
123 | - default_array = params[:app][:email_at_notices] = Errbit::Config.email_at_notices | |
124 | - flash[:error] = "Couldn't parse your notification frequency. Value was reset to default (#{default_array.join(', ')})." | |
125 | - end | |
113 | + # email_at_notices is edited as a string, and stored as an array. | |
114 | + def parse_email_at_notices_or_set_default | |
115 | + if params[:app] && (val = params[:app][:email_at_notices]) | |
116 | + # Sanitize negative values, split on comma, | |
117 | + # strip, parse as integer, remove all '0's. | |
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} | |
120 | + if email_at_notices.any? | |
121 | + params[:app][:email_at_notices] = email_at_notices | |
122 | + else | |
123 | + default_array = params[:app][:email_at_notices] = Errbit::Config.email_at_notices | |
124 | + flash[:error] = "Couldn't parse your notification frequency. Value was reset to default (#{default_array.join(', ')})." | |
126 | 125 | end |
127 | 126 | end |
127 | + end | |
128 | 128 | |
129 | - def parse_notice_at_notices_or_set_default | |
130 | - if params[:app][:notification_service_attributes] && (val = params[:app][:notification_service_attributes][:notify_at_notices]) | |
131 | - # Sanitize negative values, split on comma, | |
132 | - # strip, parse as integer, remove all '0's. | |
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 } | |
135 | - if notify_at_notices.any? | |
136 | - params[:app][:notification_service_attributes][:notify_at_notices] = notify_at_notices | |
137 | - else | |
138 | - default_array = params[:app][:notification_service_attributes][:notify_at_notices] = Errbit::Config.notify_at_notices | |
139 | - flash[:error] = "Couldn't parse your notification frequency. Value was reset to default (#{default_array.join(', ')})." | |
140 | - end | |
129 | + def parse_notice_at_notices_or_set_default | |
130 | + if params[:app][:notification_service_attributes] && (val = params[:app][:notification_service_attributes][:notify_at_notices]) | |
131 | + # Sanitize negative values, split on comma, | |
132 | + # strip, parse as integer, remove all '0's. | |
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 } | |
135 | + if notify_at_notices.any? | |
136 | + params[:app][:notification_service_attributes][:notify_at_notices] = notify_at_notices | |
137 | + else | |
138 | + default_array = params[:app][:notification_service_attributes][:notify_at_notices] = Errbit::Config.notify_at_notices | |
139 | + flash[:error] = "Couldn't parse your notification frequency. Value was reset to default (#{default_array.join(', ')})." | |
141 | 140 | end |
142 | 141 | end |
142 | + end | |
143 | 143 | |
144 | 144 | private def app_params |
145 | 145 | params.require(:app).permit! | ... | ... |
app/controllers/comments_controller.rb
... | ... | @@ -30,11 +30,11 @@ protected |
30 | 30 | @app = App.find(params[:app_id]) |
31 | 31 | end |
32 | 32 | |
33 | - def find_problem | |
34 | - @problem = @app.problems.find(params[:problem_id]) | |
35 | - end | |
33 | + def find_problem | |
34 | + @problem = @app.problems.find(params[:problem_id]) | |
35 | + end | |
36 | 36 | |
37 | - def comment_params | |
38 | - params.require(:comment).permit! | |
39 | - end | |
37 | + def comment_params | |
38 | + params.require(:comment).permit! | |
39 | + end | |
40 | 40 | end | ... | ... |
app/controllers/deploys_controller.rb
... | ... | @@ -30,14 +30,13 @@ private |
30 | 30 | end |
31 | 31 | end |
32 | 32 | |
33 | - # handle Heroku's HTTP post deployhook format | |
34 | - def heroku_deploy | |
35 | - { | |
36 | - :username => params[:user], | |
37 | - :environment => params[:rack_env].try(:downcase) || params[:app], | |
38 | - :repository => "git@heroku.com:#{params[:app]}.git", | |
39 | - :revision => params[:head], | |
40 | - } | |
41 | - end | |
33 | + # handle Heroku's HTTP post deployhook format | |
34 | + def heroku_deploy | |
35 | + { | |
36 | + :username => params[:user], | |
37 | + :environment => params[:rack_env].try(:downcase) || params[:app], | |
38 | + :repository => "git@heroku.com:#{params[:app]}.git", | |
39 | + :revision => params[:head], | |
40 | + } | |
41 | + end | |
42 | 42 | end |
43 | - | ... | ... |
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 |
... | ... | @@ -73,4 +73,3 @@ protected |
73 | 73 | @user_password_params ||= params[:user] ? params.require(:user).permit(:password, :password_confirmation) : {} |
74 | 74 | end |
75 | 75 | end |
76 | - | ... | ... |
app/decorators/backtrace_line_decorator.rb
... | ... | @@ -79,7 +79,7 @@ private |
79 | 79 | |
80 | 80 | def link_to_bitbucket(app, text = nil) |
81 | 81 | return unless app.bitbucket_repo? |
82 | - href = "%s#%s-%s" % [app.bitbucket_url_to_file(decorated_path + file_name), file_name , number] | |
82 | + href = "%s#%s-%s" % [app.bitbucket_url_to_file(decorated_path + file_name), file_name, number] | |
83 | 83 | h.link_to(text || file_name, href, :target => '_blank') |
84 | 84 | end |
85 | 85 | ... | ... |
app/decorators/issue_tracker_field_decorator.rb
... | ... | @@ -13,8 +13,8 @@ class IssueTrackerFieldDecorator < Draper::Decorator |
13 | 13 | |
14 | 14 | def input(form, issue_tracker) |
15 | 15 | form.send(input_field, key.to_s, |
16 | - :placeholder => field_info[:placeholder], | |
17 | - :value => issue_tracker.options[key.to_s]) | |
16 | + :placeholder => field_info[:placeholder], | |
17 | + :value => issue_tracker.options[key.to_s]) | |
18 | 18 | end |
19 | 19 | |
20 | 20 | private def input_field | ... | ... |
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,9 +5,9 @@ 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 | - event.summary = "#{idx+1} #{notice.message}" | |
10 | + event.summary = "#{idx + 1} #{notice.message}" | |
11 | 11 | event.description = notice.url if notice.url |
12 | 12 | event.dtstart = notice.created_at.utc |
13 | 13 | event.dtend = notice.created_at.utc + 60.minutes |
... | ... | @@ -21,9 +21,9 @@ 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 | - event.summary = "#{idx+1} #{deploy.repository}" | |
26 | + event.summary = "#{idx + 1} #{deploy.repository}" | |
27 | 27 | event.description = deploy.revision.to_s |
28 | 28 | event.dtstart = deploy.created_at.utc |
29 | 29 | event.dtend = deploy.created_at.utc + 60.minutes |
... | ... | @@ -81,7 +81,7 @@ private |
81 | 81 | tallies.values.inject(0) {|sum, n| sum + n} |
82 | 82 | end |
83 | 83 | |
84 | - def head_size | |
85 | - 4 | |
86 | - end | |
84 | + def head_size | |
85 | + 4 | |
86 | + end | |
87 | 87 | end | ... | ... |
app/helpers/apps_helper.rb
... | ... | @@ -2,11 +2,11 @@ module AppsHelper |
2 | 2 | def link_to_copy_attributes_from_other_app |
3 | 3 | if App.count > 1 |
4 | 4 | html = link_to('copy settings from another app', '#', |
5 | - :class => 'button copy_config') | |
5 | + :class => 'button copy_config') | |
6 | 6 | html << select("duplicate", "app", |
7 | - App.all.asc(:name).reject{|a| a == @app }. | |
8 | - collect{|p| [ p.name, p.id ] }, {:include_blank => "[choose app]"}, | |
9 | - {:class => "choose_other_app", :style => "display: none;"}) | |
7 | + App.all.asc(:name).reject{|a| a == @app }. | |
8 | + collect{|p| [ p.name, p.id ] }, {:include_blank => "[choose app]"}, | |
9 | + {:class => "choose_other_app", :style => "display: none;"}) | |
10 | 10 | return html |
11 | 11 | end |
12 | 12 | end | ... | ... |
app/helpers/form_helper.rb
app/helpers/hash_helper.rb
... | ... | @@ -9,11 +9,11 @@ module HashHelper |
9 | 9 | sorted_keys = hash.keys.sort |
10 | 10 | sorted_keys.each do |key| |
11 | 11 | val = hash[key].is_a?(Hash) ? pretty_hash(hash[key], nesting) : hash[key].inspect |
12 | - pretty += "\n#{' '*nesting*tab_size}" | |
12 | + pretty += "\n#{' ' * nesting * tab_size}" | |
13 | 13 | pretty += "#{key.inspect} => #{val}" |
14 | 14 | pretty += "," unless key == sorted_keys.last |
15 | 15 | end |
16 | 16 | nesting -= 1 |
17 | - pretty += "\n#{' '*nesting*tab_size}}" | |
17 | + pretty += "\n#{' ' * nesting * tab_size}}" | |
18 | 18 | end |
19 | 19 | end | ... | ... |
app/helpers/problems_helper.rb
app/mailers/mailer.rb
app/models/app.rb
... | ... | @@ -196,26 +196,25 @@ protected |
196 | 196 | ) |
197 | 197 | end |
198 | 198 | |
199 | - def generate_api_key | |
200 | - self.api_key ||= SecureRandom.hex | |
201 | - end | |
199 | + def generate_api_key | |
200 | + self.api_key ||= SecureRandom.hex | |
201 | + end | |
202 | 202 | |
203 | - def check_issue_tracker | |
204 | - if issue_tracker.present? | |
205 | - issue_tracker.valid? | |
206 | - issue_tracker.errors.full_messages.each do |error| | |
207 | - errors[:base] << error | |
208 | - end if issue_tracker.errors | |
209 | - end | |
203 | + def check_issue_tracker | |
204 | + if issue_tracker.present? | |
205 | + issue_tracker.valid? | |
206 | + issue_tracker.errors.full_messages.each do |error| | |
207 | + errors[:base] << error | |
208 | + end if issue_tracker.errors | |
210 | 209 | end |
210 | + end | |
211 | 211 | |
212 | - def normalize_github_repo | |
213 | - return if github_repo.blank? | |
214 | - github_host = URI.parse(Errbit::Config.github_url).host | |
215 | - github_host = Regexp.escape(github_host) | |
216 | - github_repo.strip! | |
217 | - github_repo.sub!(/(git@|https?:\/\/)#{github_host}(\/|:)/, '') | |
218 | - github_repo.sub!(/\.git$/, '') | |
219 | - end | |
212 | + def normalize_github_repo | |
213 | + return if github_repo.blank? | |
214 | + github_host = URI.parse(Errbit::Config.github_url).host | |
215 | + github_host = Regexp.escape(github_host) | |
216 | + github_repo.strip! | |
217 | + github_repo.sub!(/(git@|https?:\/\/)#{github_host}(\/|:)/, '') | |
218 | + github_repo.sub!(/\.git$/, '') | |
219 | + end | |
220 | 220 | end |
221 | - | ... | ... |
app/models/comment.rb
app/models/deploy.rb
... | ... | @@ -23,7 +23,7 @@ class Deploy |
23 | 23 | end |
24 | 24 | |
25 | 25 | def short_revision |
26 | - revision.to_s[0,7] | |
26 | + revision.to_s[0, 7] | |
27 | 27 | end |
28 | 28 | |
29 | 29 | protected |
... | ... | @@ -32,16 +32,15 @@ protected |
32 | 32 | app.resolve_errs_on_deploy? |
33 | 33 | end |
34 | 34 | |
35 | - def store_cached_attributes_on_problems | |
36 | - Problem.where(:app_id => app.id).update_all( | |
37 | - last_deploy_at: created_at | |
38 | - ) | |
39 | - end | |
35 | + def store_cached_attributes_on_problems | |
36 | + Problem.where(:app_id => app.id).update_all( | |
37 | + last_deploy_at: created_at | |
38 | + ) | |
39 | + end | |
40 | 40 | |
41 | - def deliver_email | |
42 | - if app.notify_on_deploys? && app.notification_recipients.any? | |
43 | - Mailer.deploy_notification(self).deliver_now | |
44 | - end | |
41 | + def deliver_email | |
42 | + if app.notify_on_deploys? && app.notification_recipients.any? | |
43 | + Mailer.deploy_notification(self).deliver_now | |
45 | 44 | end |
45 | + end | |
46 | 46 | end |
47 | - | ... | ... |
app/models/issue.rb
... | ... | @@ -22,7 +22,7 @@ class Issue |
22 | 22 | if tracker.respond_to?(:title) |
23 | 23 | tracker.title |
24 | 24 | else |
25 | - "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}" | |
25 | + "[#{problem.environment}][#{problem.where}] #{problem.message.to_s.truncate(100)}" | |
26 | 26 | end |
27 | 27 | end |
28 | 28 | ... | ... |
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/notification_service.rb
... | ... | @@ -35,12 +35,12 @@ class NotificationService |
35 | 35 | def check_params; true; end |
36 | 36 | |
37 | 37 | def notification_description(problem) |
38 | - "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}" | |
38 | + "[#{problem.environment}][#{problem.where}] #{problem.message.to_s.truncate(100)}" | |
39 | 39 | end |
40 | 40 | |
41 | 41 | # Allows us to set the issue tracker class from a single form. |
42 | 42 | def type; _type; end |
43 | - def type=(t); self._type=t; end | |
43 | + def type=(t); self._type = t; end | |
44 | 44 | |
45 | 45 | def url; nil; end |
46 | 46 | ... | ... |
app/models/notification_services/flowdock_service.rb
... | ... | @@ -35,7 +35,7 @@ if defined? Flowdock |
35 | 35 | end |
36 | 36 | |
37 | 37 | def content(problem, url) |
38 | - full_description = "[#{ problem.environment }][#{ problem.where }] #{problem.message}" | |
38 | + full_description = "[#{problem.environment}][#{problem.where}] #{problem.message}" | |
39 | 39 | <<-MSG.strip_heredoc |
40 | 40 | #{ERB::Util.html_escape full_description}<br> |
41 | 41 | <a href="#{url}">#{url}</a> | ... | ... |
app/models/notification_services/gtalk_service.rb
1 | 1 | class NotificationServices::GtalkService < NotificationService |
2 | 2 | Label = "gtalk" |
3 | 3 | Fields += [ |
4 | - [:subdomain, { | |
5 | - :placeholder => "username@example.com", | |
6 | - :label => "Username" | |
7 | - }], | |
8 | - [:api_token, { | |
9 | - :placeholder => "password", | |
10 | - :label => "Password" | |
11 | - }], | |
12 | - [:user_id, { | |
13 | - :placeholder => "touser@example.com, anotheruser@example.com", | |
14 | - :label => "Send To User(s)" | |
15 | - }, :room_id], | |
16 | - [:room_id, { | |
17 | - :placeholder => "toroom@conference.example.com", | |
18 | - :label => "Send To Room (one only)" | |
19 | - }, :user_id], | |
20 | - [ :service, { | |
21 | - :placeholder => "talk.google.com", | |
22 | - :label => "Jabber Service" | |
23 | - }], | |
24 | - [ :service_url, { | |
25 | - :placeholder => "http://www.google.com/talk/", | |
26 | - :label => "Link To Jabber Service" | |
27 | - }] | |
4 | + [:subdomain, { | |
5 | + :placeholder => "username@example.com", | |
6 | + :label => "Username" | |
7 | + }], | |
8 | + [:api_token, { | |
9 | + :placeholder => "password", | |
10 | + :label => "Password" | |
11 | + }], | |
12 | + [:user_id, { | |
13 | + :placeholder => "touser@example.com, anotheruser@example.com", | |
14 | + :label => "Send To User(s)" | |
15 | + }, :room_id], | |
16 | + [:room_id, { | |
17 | + :placeholder => "toroom@conference.example.com", | |
18 | + :label => "Send To Room (one only)" | |
19 | + }, :user_id], | |
20 | + [ :service, { | |
21 | + :placeholder => "talk.google.com", | |
22 | + :label => "Jabber Service" | |
23 | + }], | |
24 | + [ :service_url, { | |
25 | + :placeholder => "http://www.google.com/talk/", | |
26 | + :label => "Link To Jabber Service" | |
27 | + }] | |
28 | 28 | ] |
29 | 29 | |
30 | 30 | def check_params |
31 | 31 | if Fields.detect { |f| self[f[0]].blank? && self[f[2]].blank? } |
32 | 32 | errors.add :base, |
33 | - """You must specify your Username, Password, service, service_url | |
34 | - and either rooms or users to send to or both""" | |
33 | + """You must specify your Username, Password, service, service_url | |
34 | + and either rooms or users to send to or both""" | |
35 | 35 | end |
36 | 36 | end |
37 | 37 | ... | ... |
app/models/notification_services/hoiio_service.rb
1 | 1 | class NotificationServices::HoiioService < NotificationService |
2 | 2 | Label = "hoiio" |
3 | 3 | Fields += [ |
4 | - [:api_token, { | |
5 | - :placeholder => "App ID", | |
6 | - :label => "App ID" | |
7 | - }], | |
8 | - [:subdomain, { | |
9 | - :placeholder => "Access Token", | |
10 | - :label => "Access Token" | |
11 | - }], | |
12 | - [:room_id, { | |
13 | - :placeholder => "+6511111111, +6511111111", | |
14 | - :label => "Recipient's phone numbers seperated by comma. Phone numbers should start with a \"+\" and country code." | |
15 | - }] | |
4 | + [:api_token, { | |
5 | + :placeholder => "App ID", | |
6 | + :label => "App ID" | |
7 | + }], | |
8 | + [:subdomain, { | |
9 | + :placeholder => "Access Token", | |
10 | + :label => "Access Token" | |
11 | + }], | |
12 | + [:room_id, { | |
13 | + :placeholder => "+6511111111, +6511111111", | |
14 | + :label => "Recipient's phone numbers seperated by comma. Phone numbers should start with a \"+\" and country code." | |
15 | + }] | |
16 | 16 | ] |
17 | 17 | |
18 | 18 | def check_params |
... | ... | @@ -26,7 +26,7 @@ class NotificationServices::HoiioService < NotificationService |
26 | 26 | end |
27 | 27 | |
28 | 28 | def notification_description(problem) |
29 | - "[#{ problem.environment }]#{problem.message.to_s.truncate(50)}" | |
29 | + "[#{problem.environment}]#{problem.message.to_s.truncate(50)}" | |
30 | 30 | end |
31 | 31 | |
32 | 32 | def create_notification(problem) | ... | ... |
app/models/notification_services/hubot_service.rb
app/models/notification_services/pushover_service.rb
1 | 1 | class NotificationServices::PushoverService < NotificationService |
2 | 2 | Label = "pushover" |
3 | 3 | Fields += [ |
4 | - [:api_token, { | |
5 | - :placeholder => "User Key", | |
6 | - :label => "User Key" | |
7 | - }], | |
8 | - [:subdomain, { | |
9 | - :placeholder => "Application API Token", | |
10 | - :label => "Application API Token" | |
11 | - }] | |
4 | + [:api_token, { | |
5 | + :placeholder => "User Key", | |
6 | + :label => "User Key" | |
7 | + }], | |
8 | + [:subdomain, { | |
9 | + :placeholder => "Application API Token", | |
10 | + :label => "Application API Token" | |
11 | + }] | |
12 | 12 | ] |
13 | 13 | |
14 | 14 | def check_params | ... | ... |
app/models/notification_services/slack_service.rb
... | ... | @@ -21,41 +21,41 @@ class NotificationServices::SlackService < NotificationService |
21 | 21 | { |
22 | 22 | :attachments => [ |
23 | 23 | { |
24 | - :fallback => message_for_slack(problem), | |
25 | - :pretext => "<#{problem_url(problem)}|Errbit - #{problem.app.name}: #{problem.error_class}>", | |
26 | - :color => "#D00000", | |
27 | - :fields => [ | |
28 | - { | |
29 | - :title => "Environment", | |
30 | - :value => problem.environment, | |
31 | - :short => false | |
32 | - }, | |
33 | - { | |
34 | - :title => "Location", | |
35 | - :value => problem.where, | |
36 | - :short => false | |
37 | - }, | |
38 | - { | |
39 | - :title => "Message", | |
40 | - :value => problem.message.to_s, | |
41 | - :short => false | |
42 | - }, | |
43 | - { | |
44 | - :title => "First Noticed", | |
45 | - :value => problem.first_notice_at, | |
46 | - :short => false | |
47 | - }, | |
48 | - { | |
49 | - :title => "Last Noticed", | |
50 | - :value => problem.last_notice_at, | |
51 | - :short => false | |
52 | - }, | |
53 | - { | |
54 | - :title => "Times Occurred", | |
55 | - :value => problem.notices_count, | |
56 | - :short => false | |
57 | - } | |
58 | - ] | |
24 | + :fallback => message_for_slack(problem), | |
25 | + :pretext => "<#{problem_url(problem)}|Errbit - #{problem.app.name}: #{problem.error_class}>", | |
26 | + :color => "#D00000", | |
27 | + :fields => [ | |
28 | + { | |
29 | + :title => "Environment", | |
30 | + :value => problem.environment, | |
31 | + :short => false | |
32 | + }, | |
33 | + { | |
34 | + :title => "Location", | |
35 | + :value => problem.where, | |
36 | + :short => false | |
37 | + }, | |
38 | + { | |
39 | + :title => "Message", | |
40 | + :value => problem.message.to_s, | |
41 | + :short => false | |
42 | + }, | |
43 | + { | |
44 | + :title => "First Noticed", | |
45 | + :value => problem.first_notice_at, | |
46 | + :short => false | |
47 | + }, | |
48 | + { | |
49 | + :title => "Last Noticed", | |
50 | + :value => problem.last_notice_at, | |
51 | + :short => false | |
52 | + }, | |
53 | + { | |
54 | + :title => "Times Occurred", | |
55 | + :value => problem.notices_count, | |
56 | + :short => false | |
57 | + } | |
58 | + ] | |
59 | 59 | } |
60 | 60 | ] |
61 | 61 | }.to_json | ... | ... |
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 | |
... | ... | @@ -257,7 +257,7 @@ private |
257 | 257 | counter |
258 | 258 | end |
259 | 259 | |
260 | - def attribute_index(value) | |
261 | - Digest::MD5.hexdigest(value.to_s) | |
262 | - end | |
260 | + def attribute_index(value) | |
261 | + Digest::MD5.hexdigest(value.to_s) | |
262 | + end | |
263 | 263 | end | ... | ... |
app/models/watcher.rb
... | ... | @@ -31,13 +31,12 @@ protected |
31 | 31 | errors.add(:base, "You must specify either a user or an email address") unless user.present? || email.present? |
32 | 32 | end |
33 | 33 | |
34 | - def clear_unused_watcher_type | |
35 | - case watcher_type | |
36 | - when 'user' | |
37 | - self.email = nil | |
38 | - when 'email' | |
39 | - self.user = self.user_id = nil | |
40 | - end | |
34 | + def clear_unused_watcher_type | |
35 | + case watcher_type | |
36 | + when 'user' | |
37 | + self.email = nil | |
38 | + when 'email' | |
39 | + self.user = self.user_id = nil | |
41 | 40 | end |
41 | + end | |
42 | 42 | end |
43 | - | ... | ... |
autotest/discover.rb
config/initializers/hoptoad.rb
config/load.rb
... | ... | @@ -52,8 +52,7 @@ Errbit::Config = Configurator.run({ |
52 | 52 | smtp_password: %w(SMTP_PASSWORD SENDGRID_PASSWORD), |
53 | 53 | smtp_domain: ['SMTP_DOMAIN', 'SENDGRID_DOMAIN', ->(values) { |
54 | 54 | values[:smtp_domain] || |
55 | - (values[:email_from] && values[:email_from].split('@').last)|| | |
56 | - nil | |
55 | + (values[:email_from] && values[:email_from].split('@').last) || nil | |
57 | 56 | }], |
58 | 57 | |
59 | 58 | # sendmail settings | ... | ... |
config/routes.rb
config/unicorn.default.rb
db/migrate/201510290041_extract_issue_tracker.rb
1 | 1 | class ExtractIssueTracker < Mongoid::Migration |
2 | - | |
3 | 2 | TRACKER_MAPPING = { |
4 | 3 | 'ErrbitTracPlugin::IssueTracker' => 'trac', |
5 | 4 | 'IssueTrackers::BitbucketIssuesTracker' => 'bitbucket', |
... | ... | @@ -26,18 +25,18 @@ class ExtractIssueTracker < Mongoid::Migration |
26 | 25 | updated_at = options.delete('updated_at') |
27 | 26 | created_at = options.delete('created_at') |
28 | 27 | |
29 | - if TRACKER_MAPPING.include?(type) | |
30 | - tracker = { | |
31 | - 'type_tracker' => TRACKER_MAPPING[type], | |
32 | - 'options' => options, | |
33 | - 'updated_at' => updated_at, | |
34 | - 'created_at' => created_at | |
35 | - } | |
28 | + next unless TRACKER_MAPPING.include?(type) | |
29 | + | |
30 | + tracker = { | |
31 | + 'type_tracker' => TRACKER_MAPPING[type], | |
32 | + 'options' => options, | |
33 | + 'updated_at' => updated_at, | |
34 | + 'created_at' => created_at | |
35 | + } | |
36 | 36 | |
37 | - App.where({ _id: app.id }).update({ | |
38 | - "$set" => { :issue_tracker => tracker } | |
39 | - }) | |
40 | - end | |
37 | + App.where({ _id: app.id }).update({ | |
38 | + "$set" => { :issue_tracker => tracker } | |
39 | + }) | |
41 | 40 | end |
42 | 41 | end |
43 | 42 | ... | ... |
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 | ... | ... |
lib/airbrake_api/params_error.rb
lib/airbrake_api/v3/notice_parser.rb
lib/hoptoad.rb
lib/overrides/hoptoad_notifier/hoptoad_notifier.rb
lib/recurse.rb
lib/tasks/errbit/demo.rake
... | ... | @@ -3,7 +3,7 @@ namespace :errbit do |
3 | 3 | task :demo => :environment do |
4 | 4 | require 'fabrication' |
5 | 5 | |
6 | - app = Fabricate(:app, :name => "Demo App #{Time.zone.now.strftime("%N")}") | |
6 | + app = Fabricate(:app, :name => "Demo App #{Time.zone.now.strftime('%N')}") | |
7 | 7 | |
8 | 8 | # Report a number of errors for the application |
9 | 9 | app.problems.delete_all | ... | ... |
lib/tasks/heroku/cron.rake
spec/controllers/api/v1/problems_controller_spec.rb
... | ... | @@ -37,7 +37,7 @@ describe Api::V1::ProblemsController, type: 'controller' do |
37 | 37 | get :show, :auth_token => @user.authentication_token, :format => "json", :id => @problem.id |
38 | 38 | returned_problem = JSON.parse(response.body) |
39 | 39 | |
40 | - expect( returned_problem.keys ).to match_array(%w( | |
40 | + expect(returned_problem.keys).to match_array(%w( | |
41 | 41 | app_name |
42 | 42 | first_notice_at |
43 | 43 | message |
... | ... | @@ -53,7 +53,7 @@ describe Api::V1::ProblemsController, type: 'controller' do |
53 | 53 | |
54 | 54 | it "returns a 404 if the problem cannot be found" do |
55 | 55 | get :show, :auth_token => @user.authentication_token, :format => "json", :id => 'IdontExist' |
56 | - expect( response.status ).to eq(404) | |
56 | + expect(response.status).to eq(404) | |
57 | 57 | end |
58 | 58 | end |
59 | 59 | ... | ... |
spec/controllers/comments_controller_spec.rb
... | ... | @@ -24,7 +24,7 @@ describe CommentsController, type: 'controller' do |
24 | 24 | end |
25 | 25 | |
26 | 26 | it "should redirect to problem page" do |
27 | - expect(response).to redirect_to( app_problem_path(problem.app, problem) ) | |
27 | + expect(response).to redirect_to(app_problem_path(problem.app, problem)) | |
28 | 28 | end |
29 | 29 | end |
30 | 30 | end |
... | ... | @@ -50,7 +50,7 @@ describe CommentsController, type: 'controller' do |
50 | 50 | end |
51 | 51 | |
52 | 52 | it "should redirect to problem page" do |
53 | - expect(response).to redirect_to( app_problem_path(problem.app, problem) ) | |
53 | + expect(response).to redirect_to(app_problem_path(problem.app, problem)) | |
54 | 54 | end |
55 | 55 | end |
56 | 56 | end | ... | ... |
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/controllers/problems_controller_spec.rb
... | ... | @@ -95,8 +95,8 @@ describe ProblemsController, type: 'controller' do |
95 | 95 | before do |
96 | 96 | sign_in user |
97 | 97 | @app = Fabricate(:app) |
98 | - @problem1 = Fabricate(:problem, :app=>@app, message: "Most important") | |
99 | - @problem2 = Fabricate(:problem, :app=>@app, message: "Very very important") | |
98 | + @problem1 = Fabricate(:problem, :app => @app, message: "Most important") | |
99 | + @problem2 = Fabricate(:problem, :app => @app, message: "Very very important") | |
100 | 100 | end |
101 | 101 | |
102 | 102 | it "renders successfully" do |
... | ... | @@ -218,7 +218,7 @@ describe ProblemsController, type: 'controller' do |
218 | 218 | |
219 | 219 | it "should save the right title" do |
220 | 220 | post :create_issue, app_id: problem.app.id, id: problem.id |
221 | - title = "[#{ problem.environment }][#{ problem.where }] #{problem.message.to_s.truncate(100)}" | |
221 | + title = "[#{problem.environment}][#{problem.where}] #{problem.message.to_s.truncate(100)}" | |
222 | 222 | line = issue_tracker.tracker.output.shift |
223 | 223 | expect(line[0]).to eq(title) |
224 | 224 | end |
... | ... | @@ -256,7 +256,7 @@ describe ProblemsController, type: 'controller' do |
256 | 256 | context "when app has no issue tracker" do |
257 | 257 | it "should redirect to problem page" do |
258 | 258 | post :create_issue, app_id: problem.app.id, id: problem.id |
259 | - expect(response).to redirect_to( app_problem_path(problem.app, problem) ) | |
259 | + expect(response).to redirect_to(app_problem_path(problem.app, problem)) | |
260 | 260 | expect(flash[:error]).to eql "This app has no issue tracker" |
261 | 261 | end |
262 | 262 | end |
... | ... | @@ -276,7 +276,7 @@ describe ProblemsController, type: 'controller' do |
276 | 276 | end |
277 | 277 | |
278 | 278 | it "should redirect to problem page" do |
279 | - expect(response).to redirect_to( app_problem_path(err.app, err.problem) ) | |
279 | + expect(response).to redirect_to(app_problem_path(err.app, err.problem)) | |
280 | 280 | end |
281 | 281 | |
282 | 282 | it "should clear issue link" do |
... | ... | @@ -293,7 +293,7 @@ describe ProblemsController, type: 'controller' do |
293 | 293 | end |
294 | 294 | |
295 | 295 | it "should redirect to problem page" do |
296 | - expect(response).to redirect_to( app_problem_path(err.app, err.problem) ) | |
296 | + expect(response).to redirect_to(app_problem_path(err.app, err.problem)) | |
297 | 297 | end |
298 | 298 | end |
299 | 299 | end |
... | ... | @@ -380,8 +380,8 @@ describe ProblemsController, type: 'controller' do |
380 | 380 | before do |
381 | 381 | sign_in user |
382 | 382 | @app = Fabricate(:app) |
383 | - @problem1 = Fabricate(:problem, :app=>@app) | |
384 | - @problem2 = Fabricate(:problem, :app=>@app) | |
383 | + @problem1 = Fabricate(:problem, :app => @app) | |
384 | + @problem2 = Fabricate(:problem, :app => @app) | |
385 | 385 | end |
386 | 386 | |
387 | 387 | it "destroys all problems" do | ... | ... |
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/fabricators/app_fabricator.rb
spec/fabricators/comment_fabricator.rb
spec/fabricators/sequences_fabricator.rb
spec/interactors/problem_merge_spec.rb
... | ... | @@ -52,8 +52,8 @@ describe ProblemMerge do |
52 | 52 | end |
53 | 53 | |
54 | 54 | context "with problem with comment" do |
55 | - let!(:comment) { Fabricate(:comment, :err => problem ) } | |
56 | - let!(:comment_2) { Fabricate(:comment, :err => problem_1, :user => comment.user ) } | |
55 | + let!(:comment) { Fabricate(:comment, :err => problem) } | |
56 | + let!(:comment_2) { Fabricate(:comment, :err => problem_1, :user => comment.user) } | |
57 | 57 | it 'merge comment' do |
58 | 58 | expect { |
59 | 59 | problem_merge.merge | ... | ... |
spec/mailers/mailer_spec.rb
... | ... | @@ -81,13 +81,13 @@ describe Mailer do |
81 | 81 | end |
82 | 82 | |
83 | 83 | it "should have the error count in the subject" do |
84 | - expect(email.subject).to match( /^\(3\) / ) | |
84 | + expect(email.subject).to match(/^\(3\) /) | |
85 | 85 | end |
86 | 86 | |
87 | 87 | context 'with a very long message' do |
88 | 88 | let(:notice) { Fabricate(:notice, :message => 6.times.collect{|_a| "0123456789" }.join('')) } |
89 | 89 | it "should truncate the long message" do |
90 | - expect(email.subject).to match( / \d{47}\.{3}$/ ) | |
90 | + expect(email.subject).to match(/ \d{47}\.{3}$/) | |
91 | 91 | end |
92 | 92 | end |
93 | 93 | end | ... | ... |
spec/models/app_spec.rb
... | ... | @@ -165,10 +165,10 @@ describe App, type: 'model' do |
165 | 165 | context '#find_or_create_err!' do |
166 | 166 | let(:app) { Fabricate(:app) } |
167 | 167 | let(:conditions) { { |
168 | - :error_class => 'Whoops', | |
169 | - :environment => 'production', | |
170 | - :fingerprint => 'some-finger-print' | |
171 | - } | |
168 | + :error_class => 'Whoops', | |
169 | + :environment => 'production', | |
170 | + :fingerprint => 'some-finger-print' | |
171 | + } | |
172 | 172 | } |
173 | 173 | |
174 | 174 | it 'returns the correct err if one already exists' do |
... | ... | @@ -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/deploy_spec.rb
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 |
... | ... | @@ -66,11 +66,13 @@ describe ErrorReport do |
66 | 66 | end |
67 | 67 | |
68 | 68 | context "with notice generate by Airbrake gem" do |
69 | - let(:xml) { Airbrake::Notice.new( | |
70 | - :exception => Exception.new, | |
71 | - :api_key => 'APIKEY', | |
72 | - :project_root => Rails.root | |
73 | - ).to_xml } | |
69 | + let(:xml) { | |
70 | + Airbrake::Notice.new( | |
71 | + :exception => Exception.new, | |
72 | + :api_key => 'APIKEY', | |
73 | + :project_root => Rails.root | |
74 | + ).to_xml | |
75 | + } | |
74 | 76 | it 'save a notice' do |
75 | 77 | expect { |
76 | 78 | error_report.generate_notice! |
... | ... | @@ -236,7 +238,7 @@ describe ErrorReport do |
236 | 238 | |
237 | 239 | context "with xml without request section" do |
238 | 240 | let(:xml){ |
239 | - Rails.root.join('spec','fixtures','hoptoad_test_notice_without_request_section.xml').read | |
241 | + Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice_without_request_section.xml').read | |
240 | 242 | } |
241 | 243 | it "save a notice" do |
242 | 244 | expect { |
... | ... | @@ -249,7 +251,7 @@ describe ErrorReport do |
249 | 251 | |
250 | 252 | context "with xml with only a single line of backtrace" do |
251 | 253 | let(:xml){ |
252 | - Rails.root.join('spec','fixtures','hoptoad_test_notice_with_one_line_of_backtrace.xml').read | |
254 | + Rails.root.join('spec', 'fixtures', 'hoptoad_test_notice_with_one_line_of_backtrace.xml').read | |
253 | 255 | } |
254 | 256 | it "save a notice" do |
255 | 257 | expect { | ... | ... |
spec/models/notice_observer_spec.rb
... | ... | @@ -6,9 +6,9 @@ describe "Callback on Notice", type: 'model' do |
6 | 6 | message: "some message", |
7 | 7 | backtrace: [ |
8 | 8 | { |
9 | - "number"=>"425", | |
10 | - "file"=>"[GEM_ROOT]/callbacks.rb", | |
11 | - "method"=>"__callbacks" | |
9 | + "number" => "425", | |
10 | + "file" => "[GEM_ROOT]/callbacks.rb", | |
11 | + "method" => "__callbacks" | |
12 | 12 | } |
13 | 13 | ], |
14 | 14 | request: { "component" => "application" }, |
... | ... | @@ -18,9 +18,9 @@ describe "Callback on Notice", type: 'model' do |
18 | 18 | }, |
19 | 19 | api_key: api_key, |
20 | 20 | notifier: { |
21 | - "name"=>"Hoptoad Notifier", | |
22 | - "version"=>"2.3.2", | |
23 | - "url"=>"http://hoptoadapp.com" | |
21 | + "name" => "Hoptoad Notifier", | |
22 | + "version" => "2.3.2", | |
23 | + "url" => "http://hoptoadapp.com" | |
24 | 24 | }, |
25 | 25 | framework: "Rails: 3.2.11" |
26 | 26 | } |
... | ... | @@ -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) } |
... | ... | @@ -130,7 +130,7 @@ describe "Callback on Notice", type: 'model' do |
130 | 130 | describe 'should not send a notification if a notification service is not' \ |
131 | 131 | 'configured' do |
132 | 132 | let(:notification_service) { Fabricate(:notification_service) } |
133 | - let(:app) { Fabricate(:app, notification_service: notification_service )} | |
133 | + let(:app) { Fabricate(:app, notification_service: notification_service)} | |
134 | 134 | let(:notice_attrs) { notice_attrs_for.call(app.api_key) } |
135 | 135 | |
136 | 136 | before { Errbit::Config.per_app_notify_at_notices = true } |
... | ... | @@ -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/models/notice_spec.rb
... | ... | @@ -61,7 +61,7 @@ describe Notice, type: 'model' do |
61 | 61 | 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16' |
62 | 62 | }}) |
63 | 63 | expect(notice.user_agent.browser).to eq 'Chrome' |
64 | - expect(notice.user_agent.version.to_s).to match( /^10\.0/ ) | |
64 | + expect(notice.user_agent.version.to_s).to match(/^10\.0/) | |
65 | 65 | end |
66 | 66 | |
67 | 67 | it "should be nil if HTTP_USER_AGENT is blank" do | ... | ... |
spec/models/notification_service/slack_service_spec.rb
... | ... | @@ -9,41 +9,41 @@ describe NotificationServices::SlackService, type: 'model' do |
9 | 9 | payload = { |
10 | 10 | :attachments => [ |
11 | 11 | { |
12 | - :fallback => notification_service.message_for_slack(problem), | |
13 | - :pretext => "<#{notification_service.problem_url(problem)}|Errbit - #{problem.app.name}: #{problem.error_class}>", | |
14 | - :color => "#D00000", | |
15 | - :fields => [ | |
16 | - { | |
17 | - :title => "Environment", | |
18 | - :value => problem.environment, | |
19 | - :short => false | |
20 | - }, | |
21 | - { | |
22 | - :title => "Location", | |
23 | - :value => problem.where, | |
24 | - :short => false | |
25 | - }, | |
26 | - { | |
27 | - :title => "Message", | |
28 | - :value => problem.message.to_s, | |
29 | - :short => false | |
30 | - }, | |
31 | - { | |
32 | - :title => "First Noticed", | |
33 | - :value => problem.first_notice_at, | |
34 | - :short => false | |
35 | - }, | |
36 | - { | |
37 | - :title => "Last Noticed", | |
38 | - :value => problem.last_notice_at, | |
39 | - :short => false | |
40 | - }, | |
41 | - { | |
42 | - :title => "Times Occurred", | |
43 | - :value => problem.notices_count, | |
44 | - :short => false | |
45 | - } | |
46 | - ] | |
12 | + :fallback => notification_service.message_for_slack(problem), | |
13 | + :pretext => "<#{notification_service.problem_url(problem)}|Errbit - #{problem.app.name}: #{problem.error_class}>", | |
14 | + :color => "#D00000", | |
15 | + :fields => [ | |
16 | + { | |
17 | + :title => "Environment", | |
18 | + :value => problem.environment, | |
19 | + :short => false | |
20 | + }, | |
21 | + { | |
22 | + :title => "Location", | |
23 | + :value => problem.where, | |
24 | + :short => false | |
25 | + }, | |
26 | + { | |
27 | + :title => "Message", | |
28 | + :value => problem.message.to_s, | |
29 | + :short => false | |
30 | + }, | |
31 | + { | |
32 | + :title => "First Noticed", | |
33 | + :value => problem.first_notice_at, | |
34 | + :short => false | |
35 | + }, | |
36 | + { | |
37 | + :title => "Last Noticed", | |
38 | + :value => problem.last_notice_at, | |
39 | + :short => false | |
40 | + }, | |
41 | + { | |
42 | + :title => "Times Occurred", | |
43 | + :value => problem.notices_count, | |
44 | + :short => false | |
45 | + } | |
46 | + ] | |
47 | 47 | } |
48 | 48 | ] |
49 | 49 | }.to_json | ... | ... |
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 | ... | ... |
spec/views/apps/show.atom.builder_spec.rb
1 | 1 | describe "apps/show.atom.builder", type: 'view' do |
2 | 2 | let(:app) { stub_model(App) } |
3 | - let(:problems) { [ | |
4 | - stub_model(Problem, :message => 'foo', :app => app) | |
5 | - ]} | |
3 | + let(:problems) { [stub_model(Problem, :message => 'foo', :app => app)] } | |
6 | 4 | |
7 | 5 | before do |
8 | 6 | allow(view).to receive(:app).and_return(app) | ... | ... |
spec/views/problems/index.html.haml_spec.rb
... | ... | @@ -22,7 +22,6 @@ describe "problems/index.html.haml", type: 'view' do |
22 | 22 | end |
23 | 23 | |
24 | 24 | describe "show/hide resolved button behavior" do |
25 | - | |
26 | 25 | it "displays unresolved errors title and button" do |
27 | 26 | allow(view).to receive(:all_errs).and_return(false) |
28 | 27 | render |
... | ... | @@ -36,6 +35,5 @@ describe "problems/index.html.haml", type: 'view' do |
36 | 35 | expect(view.content_for :title).to match 'All Errors' |
37 | 36 | expect(view.content_for :action_bar).to have_link 'hide resolved' |
38 | 37 | end |
39 | - | |
40 | 38 | end |
41 | 39 | end | ... | ... |