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
[WIP] [Fix #5979] Introduce cops with special status #7184
Conversation
Perhaps a better approach would be to have a This requires that the user have a VersionLocked - unless he or she does, all new cops would be effectively enabled as if the VersionLocked is set to the current version. WDYT? |
I've always assumed we'd just enable those cops in RuboCop's own config file. That's not really an issue I think, as the default config and RuboCop's config are orthogonal concerns.
This was discussed early on, but I decided it's not a good option mostly because of what you said - you need to keep updating this version. This PR is one of the few essential bits before releasing RuboCop 1.0 and after we cut we won't be enabling any new cops by default until 2.0, which means that the VersionLocked will come for free. ESLint made this approach pretty popular and I think it's reasonable, that's why I'm looking for us to emulate it. We'll still have to refine the current behaviour and maybe add some options to suppress those messages, always enable new cops or always disable them. That's pretty simple, though. |
If that is the case, I'll remove the code that suppresses warnings during tests |
@@ -125,10 +125,14 @@ def enabled(config, only, only_safe = false) | |||
|
|||
def enabled?(cop, config, only_safe) | |||
cfg = config.for_cop(cop) | |||
|
|||
# cfg['Enabled'] might be a string `none`, which is considered disabled |
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.
I think pending
or new
might be a better name for this. Nil might be an option as well, although it's not very descriptive.
Fine by me. We'll also need to add a few lines in the manual about this. @rubocop-hq/rubocop-core That's a very important change, so I'd appreciate your input as well. |
Well, I'll assume that everyone's fine with my idea then. :D |
Do you mean when working on |
Does this mean that all the cops will be added to |
I'm sorry, I'm out of context with this. What does that mean exactly? |
Yes. But the .rubocop.yml file solves the issue
Yes.
It doesn't matter if RuboCop uses its own config file that enabled those cops as @bbatsov suggested |
I've moved this a bit forward:
TODO:
|
@pirj Thanks for the update! |
Closing in favor of #7567 |
Consider this a proof of concept.
The approach I took creates a couple of problems I did not foresee.
First, the need to disable the warning in 'cli spec behavior' context, as otherwise, we are polluting the output with each new cop added.
The other issue is that the newly introduced cops would not be applied to the rubocop codebase as well unless we introduce an option to override the new status (e.g. enable all non-configured cops)
Let me know what you think and I can proceed with adding rake tasks for enabling new cops and any other supporting options.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.