Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a false positive for
Style/MethodCallWithoutArgsParentheses
This PR fixes the following false positive for `Style/MethodCallWithoutArgsParentheses` when assigning to a default argument with the same name. ```console % cat example.rb def foo(test = test()) end % ruby -c example.rb Syntax OK % rubocop --only Style/MethodCallWithoutArgsParentheses -a example.rb Inspecting 1 file C Offenses: example.rb:1:20: C: [Corrected] Style/MethodCallWithoutArgsParentheses: Do not use parentheses for method calls with no arguments. def foo(test = test()) ^^ 1 file inspected, 1 offense detected, 1 offense corrected % cat example.rb def foo(test = test) end % ruby -c example.rb example.rb:1: circular argument reference - test ``` It prevents `example.rb:1: circular argument reference - test`.
- Loading branch information
Showing
3 changed files
with
19 additions
and
2 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
changelog/fix_false_positive_for_method_call_without_args_parentheses.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* [#9113](https://github.com/rubocop-hq/rubocop/pull/9113): Fix a false positive for `Style/MethodCallWithoutArgsParentheses` when assigning to a default argument with the same name. ([@koic][]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters