diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1300aa3..cb3756a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -88,16 +88,6 @@ Style/FileName: - 'config/initializers/cve-2013-0156.rb' - 'script/rspec-queue-mongoid.rb' -# Offense count: 8 -# Configuration parameters: EnforcedStyle, SupportedStyles. -Style/FormatString: - Exclude: - - 'app/decorators/backtrace_line_decorator.rb' - - 'app/helpers/problems_helper.rb' - - 'spec/views/apps/edit.html.haml_spec.rb' - - 'spec/views/problems/show.html.haml_spec.rb' - - 'spec/views/users/show.html.haml_spec.rb' - # Offense count: 27 # Configuration parameters: MinBodyLength. Style/GuardClause: diff --git a/app/decorators/backtrace_line_decorator.rb b/app/decorators/backtrace_line_decorator.rb index 3fad36a..c7d87b3 100644 --- a/app/decorators/backtrace_line_decorator.rb +++ b/app/decorators/backtrace_line_decorator.rb @@ -73,13 +73,13 @@ private def link_to_github(app, text = nil) return unless app.github_repo? - href = "%s#L%s" % [app.github_url_to_file(decorated_path + file_name), number] + href = format("%s#L%s", app.github_url_to_file(decorated_path + file_name), number) h.link_to(text || file_name, href, target: '_blank') end def link_to_bitbucket(app, text = nil) return unless app.bitbucket_repo? - href = "%s#%s-%s" % [app.bitbucket_url_to_file(decorated_path + file_name), file_name, number] + href = format("%s#%s-%s", app.bitbucket_url_to_file(decorated_path + file_name), file_name, number) h.link_to(text || file_name, href, target: '_blank') end diff --git a/app/helpers/problems_helper.rb b/app/helpers/problems_helper.rb index f14fb03..8bc14b3 100644 --- a/app/helpers/problems_helper.rb +++ b/app/helpers/problems_helper.rb @@ -1,6 +1,6 @@ module ProblemsHelper def problem_confirm(action) - t('problems.confirm.%s' % action) unless Errbit::Config.confirm_err_actions.eql? false + t(format('problems.confirm.%s', action)) unless Errbit::Config.confirm_err_actions.eql? false end def truncated_problem_message(problem) diff --git a/spec/views/apps/edit.html.haml_spec.rb b/spec/views/apps/edit.html.haml_spec.rb index 9c03211..9914368 100644 --- a/spec/views/apps/edit.html.haml_spec.rb +++ b/spec/views/apps/edit.html.haml_spec.rb @@ -15,12 +15,22 @@ describe "apps/edit.html.haml", type: 'view' do it "should confirm the 'reset' link" do render - expect(action_bar).to have_selector('a.button[data-confirm="%s"]' % I18n.t('apps.confirm_destroy_all_problems')) + expect(action_bar).to have_selector( + format( + 'a.button[data-confirm="%s"]', + I18n.t('apps.confirm_destroy_all_problems') + ) + ) end it "should confirm the 'destroy' link" do render - expect(action_bar).to have_selector('a.button[data-confirm="%s"]' % I18n.t('apps.confirm_delete')) + expect(action_bar).to have_selector( + format( + 'a.button[data-confirm="%s"]', + I18n.t('apps.confirm_delete') + ) + ) end end diff --git a/spec/views/problems/show.html.haml_spec.rb b/spec/views/problems/show.html.haml_spec.rb index ef1fc12..bae7cf8 100644 --- a/spec/views/problems/show.html.haml_spec.rb +++ b/spec/views/problems/show.html.haml_spec.rb @@ -66,13 +66,23 @@ describe "problems/show.html.haml", type: 'view' do it "should confirm the 'resolve' link by default" do render - expect(action_bar).to have_selector('a.resolve[data-confirm="%s"]' % I18n.t('problems.confirm.resolve_one')) + expect(action_bar).to have_selector( + format( + 'a.resolve[data-confirm="%s"]', + I18n.t('problems.confirm.resolve_one') + ) + ) end it "should confirm the 'resolve' link if configuration is unset" do allow(Errbit::Config).to receive(:confirm_err_actions).and_return(nil) render - expect(action_bar).to have_selector('a.resolve[data-confirm="%s"]' % I18n.t('problems.confirm.resolve_one')) + expect(action_bar).to have_selector( + format( + 'a.resolve[data-confirm="%s"]', + I18n.t('problems.confirm.resolve_one') + ) + ) end it "should not confirm the 'resolve' link if configured not to" do diff --git a/spec/views/users/show.html.haml_spec.rb b/spec/views/users/show.html.haml_spec.rb index 7812ee3..82fbf3f 100644 --- a/spec/views/users/show.html.haml_spec.rb +++ b/spec/views/users/show.html.haml_spec.rb @@ -53,7 +53,12 @@ describe 'users/show.html.haml', type: 'view' do it "should confirm the 'resolve' link by default" do render - expect(view.content_for(:action_bar)).to have_selector('a.delete[data-confirm="%s"]' % I18n.t('.users.confirm_delete')) + expect(view.content_for(:action_bar)).to have_selector( + format( + 'a.delete[data-confirm="%s"]', + I18n.t('.users.confirm_delete') + ) + ) end end end -- libgit2 0.21.2