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

improve rubocop-todo #702

Closed
tamird opened this issue Dec 30, 2013 · 11 comments
Closed

improve rubocop-todo #702

tamird opened this issue Dec 30, 2013 · 11 comments
Assignees

Comments

@tamird
Copy link
Contributor

tamird commented Dec 30, 2013

Couple of simple ideas for rubocop-todo.

  • When generating, it'd be nice to have a comment next to each cop listing the number of offences (exactly like --format offences gives).
  • When generating, it'd be cool to list which cops support autocorrect, again, possibly in a comment.

cc @jonas054

@jonas054
Copy link
Collaborator

I think both are good ideas. I'll try to implement them.

@ghost ghost assigned jonas054 Dec 30, 2013
@yujinakayama
Copy link
Collaborator

I think the comments are prone to be out of sync with actual project status and latest RuboCop autocorrect support.

@tamird
Copy link
Contributor Author

tamird commented Dec 30, 2013

@yujinakayama true, but every new release of rubocop requires me to run rubocop --auto-gen-config again anyway :p

@yujinakayama
Copy link
Collaborator

Then, I think it would be better if the following are also in the comments:

  • When the rubocop-todo.yml was generated
  • What version of RuboCop

@tamird
Copy link
Contributor Author

tamird commented Dec 31, 2013

sounds good to me.

@jonas054
Copy link
Collaborator

I've made changes to produce the comments we've discussed, and also comments about configuration parameters, which I think could be helpful. Sometimes a parameter can be changed and there's no need to disable the cop entirely. I want to make that clear to the user.

Something like this:

# This configuration was generated by `rubocop --auto-gen-config`
# on 2013-12-31 15:20:00 +0100 using RuboCop version 0.16.0.
# The point is for the user to remove these configuration records
# one by one as the offences are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offence count: 1.
# Configuration parameters: EnforcedStyle, SupportedStyles.
AccessModifierIndentation:
  Enabled: false

# Offence count: 6.
CyclomaticComplexity:
  Max: 15

# Offence count: 11.
Documentation:
  Enabled: false

# Offence count: 29.
# Configuration parameters: AllowedVariables.
GlobalVars:
  Enabled: false

# Offence count: 20.
# Configuration parameters: CountComments.
MethodLength:
  Max: 30

# Offence count: 1.
# Cop supports --auto-correct.
TrailingWhitespace:
  Enabled: false

@tamird @yujinakayama What do yo think?

@tamird
Copy link
Contributor Author

tamird commented Dec 31, 2013

Oh that's awesome. Could we make it print acceptable values for the configuration parameters, too? Maybe not necessary if it's an integer, but great for EnforcedStyle for instance.

@jonas054
Copy link
Collaborator

Um, I think we have to draw the line somewhere. 😄 The parameters and their descriptions are available in config/default.yml. By the way, EnforcedStyle is generated into rubocop-todo.yml when changing its value removes the offences.

@tamird
Copy link
Contributor Author

tamird commented Dec 31, 2013

Okay, sounds good. I had dealt with EnforcedStyle in HashSyntax before that setting was generated 😑

@bbatsov
Copy link
Collaborator

bbatsov commented Jan 1, 2014

@jonas054 I don't think that a line like # Offence count: 20. should end with a full stop. Other than that - the new comments look great.

@jonas054
Copy link
Collaborator

jonas054 commented Jan 1, 2014

Ah, I just sent a pull request exactly the same time as your comment. I'll remove the . and send again.

bbatsov added a commit that referenced this issue Jan 1, 2014
[Fix #702] Add comments for cops in rubocop-todo.yml.
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

No branches or pull requests

4 participants