Skip to content

Commit

Permalink
Follow "Separate Keyword Arguments from Positional Arguments"
Browse files Browse the repository at this point in the history
Follow ruby/ruby#2395.

RuboCop's CI of Ruby 2.7 matrix is failing. This is due to
a deprecation warning in Ruby 2.7.

```console
  1) RuboCop::CLI when BlockDelimiters has braces_for_chaining style
  corrects SpaceBeforeBlockBraces, SpaceInsideBlockBraces offenses
     Failure/Error: expect($stderr.string).to eq('')

       expected: ""
            got:
            "/usr/local/bundle/gems/parser-2.6.4.0/lib/parser/source/tree_rewriter.rb:284:
            warning: The last
            argu...parser-2.6.4.0/lib/parser/source/tree_rewriter.rb:288:
            warning: for `trigger_policy' defined here\n"
```

https://circleci.com/gh/rubocop-hq/rubocop/67195

This PR suppress the following Ruby 2.7's warning.

```console
% cd path/to/parser
% bundle exec rake

(snip)

/Users/koic/src/github.com/whitequark/parser/lib/parser/source/tree_rewriter.rb:284:
warning: The last argument for `trigger_policy' (defined at
/Users/koic/src/github.com/whitequark/parser/lib/parser/source/tree_rewriter.rb:288)
is used as the keyword parameter
```
  • Loading branch information
koic authored and whitequark committed Sep 4, 2019
1 parent 0b96cf7 commit 6aed650
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/parser/source/tree_rewriter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def check_range_validity(range)
def enforce_policy(event)
return if @policy[event] == :accept
return unless (values = yield)
trigger_policy(event, values)
trigger_policy(event, **values)
end

POLICY_TO_LEVEL = {warn: :warning, raise: :error}.freeze
Expand Down

0 comments on commit 6aed650

Please sign in to comment.