New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unification of IgnoredMethods
#9098
Unification of IgnoredMethods
#9098
Conversation
def method_receiver_excluded?(node) | ||
node_receiver = node.receiver&.source&.gsub(/\s+/, '') | ||
node_method = String(node.method_name) | ||
|
||
excluded_methods.any? do |config| | ||
ignored_methods.any? do |config| | ||
next unless config.is_a?(String) | ||
|
||
receiver, method = config.split('.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/BlockLength
has a special case for IgnoredMethods
, where it allows for values to be fully qualified methods, and it uses this to test receivers. I kept this logic of course, but this is now an exception from how all the other IgnoredMethods
cops work.
Can't think of anything other than something in the "Configuration" part of the docs.
Yes - look for |
Looks like
|
|
I'm assuming some dep got updated on the CI.
Damn, I had forgotten that in the past we already raised error. I guess we should make the code there a bit more flexible and make it show errors or warnings. |
I'll take a look at it! |
0a1f39d
to
a1ac233
Compare
a1ac233
to
5c4d31e
Compare
@bbatsov I think everything has been taken care of now. I've added to the documentation and the deprecation message is now set up. |
One other thing -- I needed to keep |
5c4d31e
to
f411327
Compare
…edMethods` instead of `ExcludedMethods` in configuration. The previous key is retained for backwards compatibility.
…th strings and regexes in the configuration.
f411327
to
6d4b9e3
Compare
Fantastic work! 🙇♂️ |
Rename ExcludedMethods to IgnoredMethods cop parameter, as it has been changed in Rubocop 1.5.0. Note: The old parameter name is still supported, though deprecated. See: rubocop/rubocop#9098
Rename ExcludedMethods cop parameter to IgnoredMethods, as it has been changed in Rubocop 1.5.0. Note: The old parameter name is still supported, though deprecated. See: rubocop/rubocop#9098
Rename ExcludedMethods cop parameter to IgnoredMethods, as it has been changed in Rubocop 1.5.0. Note: The old parameter name is still supported, though deprecated. See: rubocop/rubocop#9098
`ExcludedMethods` becomes obsolete in later version of rubocop, showing warnings. See rubocop/rubocop#9098 and https://github.com/rubocop/rubocop/blob/1e55b1aa5e4c5eaeccad5d61f08b7930ed6bc341/relnotes/v1.5.0.md
`ExcludedMethods` becomes obsolete in later version of rubocop, showing warnings. See rubocop/rubocop#9098 and https://github.com/rubocop/rubocop/blob/1e55b1aa5e4c5eaeccad5d61f08b7930ed6bc341/relnotes/v1.5.0.md
As mentioned by @bbatsov at #9058 (comment)
ExcludedMethods
instead ofIgnoredMethods
(Metrics/BlockLength
andMetrics/MethodLength
) have been changed to useIgnoredMethods
going forward. I changed theIgnoredMethods
mixin so that it can be configured to allow for those two cops to continue acceptingExcludedMethods
without adding that config key to the reset of the cops.IgnoredMethods
mixin now can accept an array of both strings and regexes, and both are applied.Questions:
Is there a good way to document this so that users will know they can use regexes forI added a new section to configuration.adoc.IgnoredMethods
everywhere now?ExcludedMethods
in the configuration so that users can update their config?Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.