Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes rubocop#67. This PR fixes an error for `Performance/RedundantMerge` when `MaxKeyValuePairs` option is set to `null`. ```yaml require: rubocop-performance Performance/RedundantMerge: Enabled: true MaxKeyValuePairs: null ``` ```console % bundle exec rubocop --only Performance/RedundantMerge -d For /private/tmp/67: configuration from /private/tmp/67/.rubocop.yml configuration from /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-performance-1.4.0/config/default.yml configuration from /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-performance-1.4.0/config/default.yml Default configuration from /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-0.72.0/config/default.yml Inspecting 2 files Scanning /private/tmp/67/Gemfile .Scanning /private/tmp/67/example.rb An error occurred while Performance/RedundantMerge cop was inspecting /private/tmp/67/example.rb:23:2. can't convert nil into Integer /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-performance-1.4.0/lib/rubocop/cop/performance/redundant_merge.rb:135:in `Integer' /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-performance-1.4.0/lib/rubocop/cop/performance/redundant_merge.rb:135:in `max_key_value_pairs' /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-performance-1.4.0/lib/rubocop/cop/performance/redundant_merge.rb:74:in `non_redundant_pairs?' /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-performance-1.4.0/lib/rubocop/cop/performance/redundant_merge.rb:68:in `non_redundant_merge? ``` As with `Width` option of `IndentationWidth` cop, value of default.yml is specified as the default value. - https://github.com/rubocop-hq/rubocop-performance/blob/v1.4.0/lib/rubocop/cop/performance/redundant_merge.rb#L131 - https://github.com/rubocop-hq/rubocop/blob/v0.72.0/config/default.yml#L794-L801
- Loading branch information