Commit 6cd06830a0ba45f1583ede6da86c079460e92f10
1 parent
dba2a9eb
Exists in
master
and in
1 other branch
Rubocop: use trailing dots when invocations cross multiple lines
This allows code to be copy/pasted into the console for easy experimentation and spelunking.
Showing
8 changed files
with
36 additions
and
38 deletions
Show diff stats
.rubocop.yml
| @@ -29,6 +29,10 @@ Style/AccessModifierIndentation: | @@ -29,6 +29,10 @@ Style/AccessModifierIndentation: | ||
| 29 | Style/AlignParameters: | 29 | Style/AlignParameters: |
| 30 | EnforcedStyle: with_fixed_indentation | 30 | EnforcedStyle: with_fixed_indentation |
| 31 | 31 | ||
| 32 | +Style/DotPosition: | ||
| 33 | + # Support code copy/paste into console | ||
| 34 | + EnforcedStyle: trailing | ||
| 35 | + | ||
| 32 | Style/IndentHash: | 36 | Style/IndentHash: |
| 33 | EnforcedStyle: consistent | 37 | EnforcedStyle: consistent |
| 34 | 38 |
.rubocop_todo.yml
| @@ -115,12 +115,6 @@ Style/ConstantName: | @@ -115,12 +115,6 @@ Style/ConstantName: | ||
| 115 | Style/Documentation: | 115 | Style/Documentation: |
| 116 | Enabled: false | 116 | Enabled: false |
| 117 | 117 | ||
| 118 | -# Offense count: 9 | ||
| 119 | -# Cop supports --auto-correct. | ||
| 120 | -# Configuration parameters: EnforcedStyle, SupportedStyles. | ||
| 121 | -Style/DotPosition: | ||
| 122 | - Enabled: false | ||
| 123 | - | ||
| 124 | # Offense count: 5 | 118 | # Offense count: 5 |
| 125 | Style/EachWithObject: | 119 | Style/EachWithObject: |
| 126 | Exclude: | 120 | Exclude: |
app/controllers/problems_controller.rb
| @@ -32,11 +32,11 @@ class ProblemsController < ApplicationController | @@ -32,11 +32,11 @@ class ProblemsController < ApplicationController | ||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | expose(:problems) { | 34 | expose(:problems) { |
| 35 | - pro = Problem | ||
| 36 | - .for_apps(app_scope) | ||
| 37 | - .in_env(params_environement) | ||
| 38 | - .all_else_unresolved(all_errs) | ||
| 39 | - .ordered_by(params_sort, params_order) | 35 | + pro = Problem. |
| 36 | + for_apps(app_scope). | ||
| 37 | + in_env(params_environement). | ||
| 38 | + all_else_unresolved(all_errs). | ||
| 39 | + ordered_by(params_sort, params_order) | ||
| 40 | 40 | ||
| 41 | if request.format == :html | 41 | if request.format == :html |
| 42 | pro.page(params[:page]).per(current_user.per_page) | 42 | pro.page(params[:page]).per(current_user.per_page) |
| @@ -48,8 +48,8 @@ class ProblemsController < ApplicationController | @@ -48,8 +48,8 @@ class ProblemsController < ApplicationController | ||
| 48 | def index; end | 48 | def index; end |
| 49 | 49 | ||
| 50 | def show | 50 | def show |
| 51 | - @notices = problem.object.notices.reverse_ordered | ||
| 52 | - .page(params[:notice]).per(1) | 51 | + @notices = problem.object.notices.reverse_ordered. |
| 52 | + page(params[:notice]).per(1) | ||
| 53 | @notice = NoticeDecorator.new @notices.first | 53 | @notice = NoticeDecorator.new @notices.first |
| 54 | @comment = Comment.new | 54 | @comment = Comment.new |
| 55 | end | 55 | end |
app/controllers/site_config_controller.rb
| @@ -13,10 +13,10 @@ class SiteConfigController < ApplicationController | @@ -13,10 +13,10 @@ class SiteConfigController < ApplicationController | ||
| 13 | end | 13 | end |
| 14 | 14 | ||
| 15 | private def filtered_update_params | 15 | private def filtered_update_params |
| 16 | - params | ||
| 17 | - .require(:site_config) | ||
| 18 | - .require(:notice_fingerprinter_attributes) | ||
| 19 | - .permit( | 16 | + params. |
| 17 | + require(:site_config). | ||
| 18 | + require(:notice_fingerprinter_attributes). | ||
| 19 | + permit( | ||
| 20 | :error_class, | 20 | :error_class, |
| 21 | :message, | 21 | :message, |
| 22 | :backtrace_lines, | 22 | :backtrace_lines, |
app/decorators/backtrace_line_decorator.rb
| @@ -44,9 +44,9 @@ class BacktraceLineDecorator < Draper::Decorator | @@ -44,9 +44,9 @@ class BacktraceLineDecorator < Draper::Decorator | ||
| 44 | end | 44 | end |
| 45 | 45 | ||
| 46 | def decorated_path | 46 | def decorated_path |
| 47 | - path | ||
| 48 | - .sub(Backtrace::IN_APP_PATH, '') | ||
| 49 | - .sub(Backtrace::GEMS_PATH, "<strong>\\1</strong>") | 47 | + path. |
| 48 | + sub(Backtrace::IN_APP_PATH, ''). | ||
| 49 | + sub(Backtrace::GEMS_PATH, "<strong>\\1</strong>") | ||
| 50 | end | 50 | end |
| 51 | 51 | ||
| 52 | private | 52 | private |
app/helpers/application_helper.rb
| @@ -56,8 +56,8 @@ module ApplicationHelper | @@ -56,8 +56,8 @@ module ApplicationHelper | ||
| 56 | def create_percentage_table_from_tallies(tallies, options = {}) | 56 | def create_percentage_table_from_tallies(tallies, options = {}) |
| 57 | total = (options[:total] || total_from_tallies(tallies)) | 57 | total = (options[:total] || total_from_tallies(tallies)) |
| 58 | percent = 100.0 / total.to_f | 58 | percent = 100.0 / total.to_f |
| 59 | - rows = tallies.map {|value, count| [(count.to_f * percent), value]} \ | ||
| 60 | - .sort {|a, b| b[0] <=> a[0]} | 59 | + rows = tallies.map {|value, count| [(count.to_f * percent), value]}. \ |
| 60 | + sort {|a, b| b[0] <=> a[0]} | ||
| 61 | render "problems/tally_table", :rows => rows | 61 | render "problems/tally_table", :rows => rows |
| 62 | end | 62 | end |
| 63 | 63 |
spec/controllers/api/v3/notices_controller_spec.rb
| @@ -22,8 +22,8 @@ describe Api::V3::NoticesController, type: :controller do | @@ -22,8 +22,8 @@ describe Api::V3::NoticesController, type: :controller do | ||
| 22 | end | 22 | end |
| 23 | 23 | ||
| 24 | it 'responds with 400 when request attributes are not valid' do | 24 | it 'responds with 400 when request attributes are not valid' do |
| 25 | - allow_any_instance_of(AirbrakeApi::V3::NoticeParser) | ||
| 26 | - .to receive(:report).and_raise(AirbrakeApi::ParamsError) | 25 | + allow_any_instance_of(AirbrakeApi::V3::NoticeParser). |
| 26 | + to receive(:report).and_raise(AirbrakeApi::ParamsError) | ||
| 27 | post :create, project_id: 'ID' | 27 | post :create, project_id: 'ID' |
| 28 | expect(response.status).to eq(400) | 28 | expect(response.status).to eq(400) |
| 29 | expect(response.body).to eq('Invalid request') | 29 | expect(response.body).to eq('Invalid request') |
spec/models/notice_observer_spec.rb
| @@ -94,8 +94,8 @@ describe "Callback on Notice", type: 'model' do | @@ -94,8 +94,8 @@ describe "Callback on Notice", type: 'model' do | ||
| 94 | err.problem.update_attributes notices_count: 99 | 94 | err.problem.update_attributes notices_count: 99 |
| 95 | err.problem.resolve! | 95 | err.problem.resolve! |
| 96 | 96 | ||
| 97 | - expect(Mailer).to receive(:err_notification) | ||
| 98 | - .and_return(double('email', :deliver_now => true)) | 97 | + expect(Mailer).to receive(:err_notification). |
| 98 | + and_return(double('email', :deliver_now => true)) | ||
| 99 | 99 | ||
| 100 | ErrorReport.new(notice_attrs).generate_notice! | 100 | ErrorReport.new(notice_attrs).generate_notice! |
| 101 | end | 101 | end |
| @@ -118,10 +118,10 @@ describe "Callback on Notice", type: 'model' do | @@ -118,10 +118,10 @@ describe "Callback on Notice", type: 'model' do | ||
| 118 | it 'sends email' do | 118 | it 'sends email' do |
| 119 | error_report = ErrorReport.new(notice_attrs) | 119 | error_report = ErrorReport.new(notice_attrs) |
| 120 | 120 | ||
| 121 | - expect(error_report.app.notification_service) | ||
| 122 | - .to receive(:create_notification).and_raise(ArgumentError) | ||
| 123 | - expect(Mailer) | ||
| 124 | - .to receive(:err_notification).and_return(double(:deliver_now => true)) | 121 | + expect(error_report.app.notification_service). |
| 122 | + to receive(:create_notification).and_raise(ArgumentError) | ||
| 123 | + expect(Mailer). | ||
| 124 | + to receive(:err_notification).and_return(double(:deliver_now => true)) | ||
| 125 | 125 | ||
| 126 | error_report.generate_notice! | 126 | error_report.generate_notice! |
| 127 | end | 127 | end |
| @@ -153,8 +153,8 @@ describe "Callback on Notice", type: 'model' do | @@ -153,8 +153,8 @@ describe "Callback on Notice", type: 'model' do | ||
| 153 | 153 | ||
| 154 | it 'creates a hipchat notification' do | 154 | it 'creates a hipchat notification' do |
| 155 | error_report = ErrorReport.new(notice_attrs) | 155 | error_report = ErrorReport.new(notice_attrs) |
| 156 | - expect(error_report.app.notification_service) | ||
| 157 | - .to receive(:create_notification) | 156 | + expect(error_report.app.notification_service). |
| 157 | + to receive(:create_notification) | ||
| 158 | error_report.generate_notice! | 158 | error_report.generate_notice! |
| 159 | end | 159 | end |
| 160 | end | 160 | end |
| @@ -171,16 +171,16 @@ describe "Callback on Notice", type: 'model' do | @@ -171,16 +171,16 @@ describe "Callback on Notice", type: 'model' do | ||
| 171 | 171 | ||
| 172 | it "should create a campfire notification on first notice" do | 172 | it "should create a campfire notification on first notice" do |
| 173 | error_report = ErrorReport.new(notice_attrs) | 173 | error_report = ErrorReport.new(notice_attrs) |
| 174 | - expect(error_report.app.notification_service) | ||
| 175 | - .to receive(:create_notification) | 174 | + expect(error_report.app.notification_service). |
| 175 | + to receive(:create_notification) | ||
| 176 | error_report.generate_notice! # one | 176 | error_report.generate_notice! # one |
| 177 | end | 177 | end |
| 178 | 178 | ||
| 179 | it "should create a campfire notification on second notice" do | 179 | it "should create a campfire notification on second notice" do |
| 180 | ErrorReport.new(notice_attrs).generate_notice! # one | 180 | ErrorReport.new(notice_attrs).generate_notice! # one |
| 181 | error_report = ErrorReport.new(notice_attrs) | 181 | error_report = ErrorReport.new(notice_attrs) |
| 182 | - expect(error_report.app.notification_service) | ||
| 183 | - .to receive(:create_notification) | 182 | + expect(error_report.app.notification_service). |
| 183 | + to receive(:create_notification) | ||
| 184 | error_report.generate_notice! # two | 184 | error_report.generate_notice! # two |
| 185 | end | 185 | end |
| 186 | 186 | ||
| @@ -188,8 +188,8 @@ describe "Callback on Notice", type: 'model' do | @@ -188,8 +188,8 @@ describe "Callback on Notice", type: 'model' do | ||
| 188 | ErrorReport.new(notice_attrs).generate_notice! # one | 188 | ErrorReport.new(notice_attrs).generate_notice! # one |
| 189 | ErrorReport.new(notice_attrs).generate_notice! # two | 189 | ErrorReport.new(notice_attrs).generate_notice! # two |
| 190 | error_report = ErrorReport.new(notice_attrs) | 190 | error_report = ErrorReport.new(notice_attrs) |
| 191 | - expect(error_report.app.notification_service) | ||
| 192 | - .to_not receive(:create_notification) | 191 | + expect(error_report.app.notification_service). |
| 192 | + to_not receive(:create_notification) | ||
| 193 | error_report.generate_notice! # three | 193 | error_report.generate_notice! # three |
| 194 | end | 194 | end |
| 195 | end | 195 | end |