Skip to content
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

Pending cops #369

Closed
agrimm opened this issue Jul 17, 2013 · 5 comments · Fixed by #380
Closed

Pending cops #369

agrimm opened this issue Jul 17, 2013 · 5 comments · Fixed by #380

Comments

@agrimm
Copy link
Contributor

agrimm commented Jul 17, 2013

For many of the style guide suggestions, I find that I agree with them, but past-self failed to abide by them. Is it possible for cops to act as if they're disabled, except that they report if the code is now clean?

@bbatsov
Copy link
Collaborator

bbatsov commented Jul 17, 2013

I don't see how this can happen without RuboCop keeping track of its past invocations. I think that the autocorrect feature we're currently working on should solve your problems, since you'll be able to update big chunks of code fairly quickly that way.

Right now @edzhelyov is cooking a lot of improvements in the autocorrect department.

@agrimm
Copy link
Contributor Author

agrimm commented Jul 19, 2013

I was envisaging it being like "pending" in RSpec: https://github.com/dchelimsky/rspec/wiki/Pending-Examples

"if it runs without a problem, it will be reported as a failure with a message indicating that you have a pending
example that no longer needs to be pending"

So for example if I have

RedundantReturn:
  Pending: true

then if I run Rubocop, and it finds a redundant return, then it won't report anything.

But if I run Rubocop, and it doesn't find a redundant return, it'd say something like

"RedundantReturn is marked as pending, but there are no redundant returns in the application. Set this cop to Enabled: true".

Is what I'm trying to say more clear now?

@jonas054
Copy link
Collaborator

What if RuboCop could generate configuration that disables all cops that have anything to report? That configuration file would server as a list of things to work through, and I think that solves your use case of having an overwhelming amount of reports in an old code base. I would prefer it for two reasons:

  • We avoid having both Pending and Enabled parameters. I mean, Pending would probably have to override Enabled, or what would pending+enabled or pending+disabled mean?
  • The configuration generation can be implemented as a formatter, fitting nicely into existing architecture.

It would lack the functionality you describe of reporting that some offence has now been removed, but I imagine that people would use the generated configuration as a todo list, removing the disabling one by one, or sometimes regenerating the list. It would tackle the overwhelming heap of reports effectively, I think.

@agrimm
Copy link
Contributor Author

agrimm commented Jul 20, 2013

"Sometimes regenerating the list" would work for me.

@agrimm
Copy link
Contributor Author

agrimm commented Jul 22, 2013

I tried out DisabledConfigFormatter, and it works well.

@agrimm agrimm closed this as completed Jul 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants