You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a method is called and the only parameter to that method is an inline closure then the parentheses of the method call can be omitted.
There's a case to be made for requiring ALL methods to have explicit parentheses, for consistency and unambiguity. Is that something you might be willing to support?
There's a case to be made for requiring ALL methods to have explicit parentheses, for consistency and unambiguity. Is that something you might be willing to support?
Probably not. There are certain idiomatic cases where parentheses would be unexpected and unpleasant, including where the last argument is a Closure, as that rule checks for.
There is also issue #433 , now a few years old, discussing a rule for checking for unnecessary parentheses, which I believe is the opposite of what you are asking about.
Groovy allows optional parentheses.
However, there seems only a single Rule for when they are NOT required:
https://codenarc.org/codenarc-rules-unnecessary.html#unnecessaryparenthesesformethodcallwithclosure-rule
There's a case to be made for requiring ALL methods to have explicit parentheses, for consistency and unambiguity. Is that something you might be willing to support?
From: nvuillam/npm-groovy-lint#267
The text was updated successfully, but these errors were encountered: