Commit c5dd4c3ec20c8e81a50d18e689e1fa38a2f4bb87
1 parent
01a41173
Exists in
master
and in
1 other branch
Rubocop: first parameter indentation fix
This unfolds a bit of nesting, hoping the new version is plenty readable
Showing
4 changed files
with
41 additions
and
40 deletions
Show diff stats
.rubocop_todo.yml
| @@ -88,15 +88,6 @@ Style/FileName: | @@ -88,15 +88,6 @@ Style/FileName: | ||
| 88 | - 'config/initializers/cve-2013-0156.rb' | 88 | - 'config/initializers/cve-2013-0156.rb' |
| 89 | - 'script/rspec-queue-mongoid.rb' | 89 | - 'script/rspec-queue-mongoid.rb' |
| 90 | 90 | ||
| 91 | -# Offense count: 4 | ||
| 92 | -# Cop supports --auto-correct. | ||
| 93 | -# Configuration parameters: EnforcedStyle, SupportedStyles. | ||
| 94 | -Style/FirstParameterIndentation: | ||
| 95 | - Exclude: | ||
| 96 | - - 'app/models/issue_tracker.rb' | ||
| 97 | - - 'spec/decorators/backtrace_decorator_spec.rb' | ||
| 98 | - - 'spec/decorators/issue_tracker_type_decorator_spec.rb' | ||
| 99 | - | ||
| 100 | # Offense count: 8 | 91 | # Offense count: 8 |
| 101 | # Configuration parameters: EnforcedStyle, SupportedStyles. | 92 | # Configuration parameters: EnforcedStyle, SupportedStyles. |
| 102 | Style/FormatString: | 93 | Style/FormatString: |
app/models/issue_tracker.rb
| @@ -14,10 +14,12 @@ class IssueTracker | @@ -14,10 +14,12 @@ class IssueTracker | ||
| 14 | begin | 14 | begin |
| 15 | klass = ErrbitPlugin::Registry.issue_trackers[type_tracker] || ErrbitPlugin::NoneIssueTracker | 15 | klass = ErrbitPlugin::Registry.issue_trackers[type_tracker] || ErrbitPlugin::NoneIssueTracker |
| 16 | # TODO: we need to find out a better way to pass those config to the issue tracker | 16 | # TODO: we need to find out a better way to pass those config to the issue tracker |
| 17 | - klass.new(options.merge( | ||
| 18 | - github_repo: app.try(:github_repo), | ||
| 19 | - bitbucket_repo: app.try(:bitbucket_repo) | ||
| 20 | - )) | 17 | + klass.new( |
| 18 | + options.merge( | ||
| 19 | + github_repo: app.try(:github_repo), | ||
| 20 | + bitbucket_repo: app.try(:bitbucket_repo) | ||
| 21 | + ) | ||
| 22 | + ) | ||
| 21 | end | 23 | end |
| 22 | end | 24 | end |
| 23 | 25 |
spec/decorators/backtrace_decorator_spec.rb
| 1 | describe BacktraceDecorator, type: :decorator do | 1 | describe BacktraceDecorator, type: :decorator do |
| 2 | let(:backtrace) do | 2 | let(:backtrace) do |
| 3 | - described_class.new(Backtrace.new( | ||
| 4 | - lines: [ | ||
| 5 | - { number: 131, | ||
| 6 | - file: '[PROJECT_ROOT]app/controllers/accounts_controller.rb', | ||
| 7 | - method: :update_preferences }, | ||
| 8 | - { number: 61, | ||
| 9 | - file: '[PROJECT_ROOT]app/controllers/application_controller.rb', | ||
| 10 | - method: :call }, | ||
| 11 | - { number: 182, | ||
| 12 | - file: '[GEM_ROOT]activesupport-2.3.18/lib/active_support/callbacks.rb', | ||
| 13 | - method: :call }, | ||
| 14 | - { number: 384, | ||
| 15 | - file: '[PROJECT_ROOT]app/models/account.rb', | ||
| 16 | - method: :update_server_tag_scope }, | ||
| 17 | - { number: 182, | ||
| 18 | - file: '[GEM_ROOT]activesupport-2.3.18/lib/active_support/callbacks.rb', | ||
| 19 | - method: :evaluate_method }, | ||
| 20 | - { number: 23, | ||
| 21 | - file: '/home/rails/library/current/vendor/bundle/ruby/2.1.0/bin/rainbows', | ||
| 22 | - method: '<main>' } | ||
| 23 | - ] | ||
| 24 | - )) | 3 | + described_class.new( |
| 4 | + Backtrace.new( | ||
| 5 | + lines: [ | ||
| 6 | + { number: 131, | ||
| 7 | + file: '[PROJECT_ROOT]app/controllers/accounts_controller.rb', | ||
| 8 | + method: :update_preferences }, | ||
| 9 | + { number: 61, | ||
| 10 | + file: '[PROJECT_ROOT]app/controllers/application_controller.rb', | ||
| 11 | + method: :call }, | ||
| 12 | + { number: 182, | ||
| 13 | + file: '[GEM_ROOT]activesupport-2.3.18/lib/active_support/callbacks.rb', | ||
| 14 | + method: :call }, | ||
| 15 | + { number: 384, | ||
| 16 | + file: '[PROJECT_ROOT]app/models/account.rb', | ||
| 17 | + method: :update_server_tag_scope }, | ||
| 18 | + { number: 182, | ||
| 19 | + file: '[GEM_ROOT]activesupport-2.3.18/lib/active_support/callbacks.rb', | ||
| 20 | + method: :evaluate_method }, | ||
| 21 | + { number: 23, | ||
| 22 | + file: '/home/rails/library/current/vendor/bundle/ruby/2.1.0/bin/rainbows', | ||
| 23 | + method: '<main>' } | ||
| 24 | + ] | ||
| 25 | + ) | ||
| 26 | + ) | ||
| 25 | end | 27 | end |
| 26 | 28 | ||
| 27 | describe '#grouped_lines' do | 29 | describe '#grouped_lines' do |
spec/decorators/issue_tracker_type_decorator_spec.rb
| @@ -50,15 +50,21 @@ describe IssueTrackerDecorator do | @@ -50,15 +50,21 @@ describe IssueTrackerDecorator do | ||
| 50 | 50 | ||
| 51 | describe "#params_class" do | 51 | describe "#params_class" do |
| 52 | it 'adds the label in class' do | 52 | it 'adds the label in class' do |
| 53 | - tracker = IssueTrackerDecorator.new(IssueTracker.new( | ||
| 54 | - type_tracker: 'none')) | 53 | + tracker = IssueTrackerDecorator.new( |
| 54 | + IssueTracker.new(type_tracker: 'none') | ||
| 55 | + ) | ||
| 55 | expect(decorator.params_class(tracker)).to eql 'fake' | 56 | expect(decorator.params_class(tracker)).to eql 'fake' |
| 56 | end | 57 | end |
| 57 | 58 | ||
| 58 | it 'adds chosen class if type is same' do | 59 | it 'adds chosen class if type is same' do |
| 59 | - expect(decorator.params_class( | ||
| 60 | - IssueTracker.new(type_tracker: 'fake').decorate | ||
| 61 | - )).to eql 'chosen fake' | 60 | + expect( |
| 61 | + decorator. | ||
| 62 | + params_class( | ||
| 63 | + IssueTracker.new( | ||
| 64 | + type_tracker: 'fake' | ||
| 65 | + ).decorate | ||
| 66 | + ) | ||
| 67 | + ).to eql 'chosen fake' | ||
| 62 | end | 68 | end |
| 63 | end | 69 | end |
| 64 | end | 70 | end |