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

Add Exclude items to the DisabledConfigFormatter output #1980

Merged
merged 1 commit into from
Jun 27, 2015

Conversation

bmorrall
Copy link
Contributor

I was testing some legacy code by using --auto-gen-config, and found it frustrating that trivial Cops had been disabled due to trival issues in one or two files.

I didn't want to disable Whitespace Formatting, or other Style rules in any new code; so I thought I'd play around with the generator to Exclude relative file paths.

An example of what I managed to make it output, is as follows:

# Offense count: 1
# Cop supports --auto-correct.
Style/Tab:
  Exclude:
    - 'example2.rb'

This way, its easier to globally disable Cops in my .rubocop.yml, and have a checklist of files to fix in my .rubocop_todos.yml, instead of globally disabling rules the rest of my code abides by.

What do you think?

@philoserf
Copy link

👍 👌 👏

@bbatsov
Copy link
Collaborator

bbatsov commented Jun 19, 2015

I think this. I think something similar was proposed in the past. I'm just worried about cases where there may be hundreds of files in the exclude list, but there's no denying you get a better overview of what remains to be fixed in your code.

@jonas054 What do you think?

@bmorrall
Copy link
Contributor Author

I could always add a threshold for the maximum amount of items to display, with a fallback to Enabled: false if the limit is exceeded

@philoserf
Copy link

More 👍 👏

@bbatsov
Copy link
Collaborator

bbatsov commented Jun 20, 2015

I could always add a threshold for the maximum amount of items to display, with a fallback to Enabled: false if the limit is exceeded

Sounds reasonable.

@bmorrall
Copy link
Contributor Author

I chose a limit of 15, for no reason; other than I think 10 is too low, and 20 is too high. Any thoughts?

@jonas054
Copy link
Collaborator

👍 Looks fine to me. Only Enabled: false can be replaced by Exclude:, and any other configuration generated by --auto-gen-config remains as today. That's good. For reference, this subject has been discussed in #988, #1531, and #1709.

@bbatsov
Copy link
Collaborator

bbatsov commented Jun 26, 2015

Add a changelog entry and we're good to merge.

@bmorrall bmorrall force-pushed the output_exclude_list branch 2 times, most recently from 99a7da2 to 4a32140 Compare June 27, 2015 03:54
@bmorrall
Copy link
Contributor Author

Done, Glad I could help :)

@bbatsov
Copy link
Collaborator

bbatsov commented Jun 27, 2015

Can you just squash all 3 commits into one?

@bmorrall bmorrall force-pushed the output_exclude_list branch from 4a32140 to 8cf529b Compare June 27, 2015 09:29
@bmorrall
Copy link
Contributor Author

@bbatsov Done and done!

bbatsov added a commit that referenced this pull request Jun 27, 2015
Add Exclude items to the DisabledConfigFormatter output
@bbatsov bbatsov merged commit e16c90a into rubocop:master Jun 27, 2015
@bbatsov
Copy link
Collaborator

bbatsov commented Jun 27, 2015

Thanks!

@TimMoore
Copy link

This is the best... thanks all!

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 this pull request may close these issues.

5 participants