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

Support style-guide only usage #1454

Merged
merged 1 commit into from
Dec 4, 2014

Conversation

marxarelli
Copy link
Contributor

Many cops that have been implemented and enabled by default have no
correlation to a style-guide rule: Metrics/ClassLength,
Metrics/AbcSize, Metrics/PerceivedComplexity just to name a few. In
cases where these cops find violations, there's little recourse as the
rules cannot be traced back to a meaningful discussion or consensus.

The --only-guide-cops and AllCops/StyleGuideCopsOnly options give
users an easy method of invoking RuboCop in a way that's more congruent
with the rules of the style guide.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.23%) when pulling 321a2efc6bd33584c909fb1809935af706d11a39 on marxarelli:feature/only-guide-cops into f1f70ef on bbatsov:master.

end

option(opts, '--only-guide-cops') do
@options[:only_guide_cops] = true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's a boolean option, it will work without the block, just like --show-cops or --fail-fast.

@jonas054
Copy link
Collaborator

👍 I like the idea. Had some minor comments.

@marxarelli
Copy link
Contributor Author

@jonas054 Thanks for the feedback! I'll take a look at ironing out the outstanding issues.

@hashar
Copy link

hashar commented Nov 20, 2014

I like the idea, would let one easily adhere to a given guide/recommendation. Thanks!

@jonas054
Copy link
Collaborator

@marxarelli About GuardClause, you're not alone. See #1138.
The code updates look good! @bbatsov @yujinakayama

@marxarelli
Copy link
Contributor Author

@bbatsov @yujinakayama ping

@bbatsov
Copy link
Collaborator

bbatsov commented Nov 26, 2014

Looks good to me. Update the changelog and squash the commits into one.

@deivid-rodriguez
Copy link
Contributor

I like this idea a lot as well! 👍 Thanks a lot to everybody contributing to RuboCop!

@marxarelli marxarelli force-pushed the feature/only-guide-cops branch 3 times, most recently from 236d56a to bb139a0 Compare December 2, 2014 01:50
@marxarelli
Copy link
Contributor Author

@bbatsov Done. Thanks for accepting this! (That's assuming everything goes well with Travis which I can't verify due to the ongoing DDoS against DNSimple.)

@@ -10,6 +10,7 @@

* [#801](https://github.com/bbatsov/rubocop/issues/801): New style `context_dependent` for `Style/BracesAroundHashParameters` looks at preceding parameter to determine if braces should be used for final parameter. ([@jonas054][])
* [#1427](https://github.com/bbatsov/rubocop/issues/1427): Excluding directories on the top level is now done earlier, so that these file trees are not searched, thus saving time when inspecting projects with many excluded files. ([@jonas054][])
* [#1454](https://github.com/bbatsov/rubocop/issues/1454): New `--only-guide-cops` and `AllCops/StyleGuideCopsOnly` options that will only enforce cops that link to a style guide. ([@marxarelli][])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in "new features".

@bbatsov
Copy link
Collaborator

bbatsov commented Dec 4, 2014

You should also rebase this on top of the current master.

@bbatsov
Copy link
Collaborator

bbatsov commented Dec 4, 2014

Another merge conflict. :( You'll have to rebase again.

Many cops that have been implemented and enabled by default have no
correlation to a style-guide rule: `Metrics/ClassLength`,
`Metrics/AbcSize`, `Metrics/PerceivedComplexity` just to name a few. In
cases where these cops find violations, there's little recourse as the
rules cannot be traced back to a meaningful discussion or consensus.

The `--only-guide-cops` and `AllCops/StyleGuideCopsOnly` options give
users an easy method of invoking RuboCop in a way that's more congruent
with the rules of the style guide.

Working around `GuardClause` violation in `Runner#filter_cop_classes`.
bbatsov added a commit that referenced this pull request Dec 4, 2014
@bbatsov bbatsov merged commit 6219aff into rubocop:master Dec 4, 2014
@bbatsov
Copy link
Collaborator

bbatsov commented Dec 4, 2014

👍

@marxarelli marxarelli deleted the feature/only-guide-cops branch December 4, 2014 22:16
@marxarelli
Copy link
Contributor Author

Thanks!

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.

6 participants