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
Pull example group node matchers up #934
Conversation
This refactors to add `shared_group?` and `spec_group?` node matchers in `NodePattern` for use across cops. I wanted to check shared contexts in the [rule that I'm working on][1] and noticed that there were similar implementations in a handful of other places. I thought it was probably worth abstracting upwards. [1]: rubocop#863
ba6f8ff
to
b327884
Compare
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.
Looks better, why not.
Thank you!
Part of me wonders if there should be |
Depends on how often they would be used. Can't tell that off the top of my head.
Yes, but not significantly a lot more, there are references to copy-paste, e.g. https://github.com/rubocop-hq/rubocop-rspec/blob/master/lib/rubocop/rspec/top_level_group.rb |
This moves several files to a new `mixins/` folder. I was going to add some new macros, per [this comment][1], but thought it might clutter things up a bit to put them in the root folder. I thought of adding a `macros/` folder, but decided to emulate the [rubocop source][2] instead. [1]: rubocop#934 (comment) [2]: https://github.com/rubocop-hq/rubocop/tree/master/lib/rubocop/cop/mixin
This moves several files to a new `mixins/` folder. I was going to add some new macros, per [this comment][1], but thought it might clutter things up a bit to put them in the root folder. I thought of adding a `macros/` folder, but decided to emulate the [rubocop source][2] instead. [1]: rubocop#934 (comment) [2]: https://github.com/rubocop-hq/rubocop/tree/master/lib/rubocop/cop/mixin
This moves several files to a new `mixins/` folder. I was going to add some new macros, per [this comment][1], but thought it might clutter things up a bit to put them in the root folder. I thought of adding a `macros/` folder, but decided to emulate the [rubocop source][2] instead. [1]: rubocop#934 (comment) [2]: https://github.com/rubocop-hq/rubocop/tree/master/lib/rubocop/cop/mixin
This moves several files to a new `mixins/` folder. I was going to add some new macros, per [this comment][1], but thought it might clutter things up a bit to put them in the root folder. I thought of adding a `macros/` folder, but decided to emulate the [rubocop source][2] instead. [1]: rubocop#934 (comment) [2]: https://github.com/rubocop-hq/rubocop/tree/master/lib/rubocop/cop/mixin
This moves several files to a new `mixins/` folder. I was going to add some new macros, per [this comment][1], but thought it might clutter things up a bit to put them in the root folder. I thought of adding a `macros/` folder, but decided to emulate the [rubocop source][2] instead. [1]: rubocop#934 (comment) [2]: https://github.com/rubocop-hq/rubocop/tree/master/lib/rubocop/cop/mixin
This moves several files to a new `mixins/` folder. I was going to add some new macros, per [this comment][1], but thought it might clutter things up a bit to put them in the root folder. I thought of adding a `macros/` folder, but decided to emulate the [rubocop source][2] instead. [1]: rubocop#934 (comment) [2]: https://github.com/rubocop-hq/rubocop/tree/master/lib/rubocop/cop/mixin
This moves several files to a new `mixins/` folder. I was going to add some new macros, per [this comment][1], but thought it might clutter things up a bit to put them in the root folder. I thought of adding a `macros/` folder, but decided to emulate the [rubocop source][2] instead. [1]: #934 (comment) [2]: https://github.com/rubocop-hq/rubocop/tree/master/lib/rubocop/cop/mixin
This moves several files to a new `mixins/` folder. I was going to add some new macros, per [this comment][1], but thought it might clutter things up a bit to put them in the root folder. I thought of adding a `macros/` folder, but decided to emulate the [rubocop source][2] instead. [1]: #934 (comment) [2]: https://github.com/rubocop-hq/rubocop/tree/master/lib/rubocop/cop/mixin
This moves several files to a new `mixins/` folder. I was going to add some new macros, per [this comment][1], but thought it might clutter things up a bit to put them in the root folder. I thought of adding a `macros/` folder, but decided to emulate the [rubocop source][2] instead. [1]: #934 (comment) [2]: https://github.com/rubocop-hq/rubocop/tree/master/lib/rubocop/cop/mixin
This moves several files to a new `mixins/` folder. I was going to add some new macros, per [this comment][1], but thought it might clutter things up a bit to put them in the root folder. I thought of adding a `macros/` folder, but decided to emulate the [rubocop source][2] instead. [1]: rubocop/rubocop-rspec#934 (comment) [2]: https://github.com/rubocop-hq/rubocop/tree/master/lib/rubocop/cop/mixin
This moves several files to a new `mixins/` folder. I was going to add some new macros, per [this comment][1], but thought it might clutter things up a bit to put them in the root folder. I thought of adding a `macros/` folder, but decided to emulate the [rubocop source][2] instead. [1]: rubocop/rubocop-rspec#934 (comment) [2]: https://github.com/rubocop-hq/rubocop/tree/master/lib/rubocop/cop/mixin
This moves several files to a new `mixins/` folder. I was going to add some new macros, per [this comment][1], but thought it might clutter things up a bit to put them in the root folder. I thought of adding a `macros/` folder, but decided to emulate the [rubocop source][2] instead. [1]: rubocop/rubocop-rspec#934 (comment) [2]: https://github.com/rubocop-hq/rubocop/tree/master/lib/rubocop/cop/mixin
This refactors to add
shared_group?
andspec_group?
node matchers inNodePattern
for use across cops. I wanted to check shared contexts inthe rule that I'm working on and noticed that there were similar
implementations in a handful of other places. I thought it was probably
worth abstracting upwards.
master
(if not - rebase it).CHANGELOG.md
if the new code introduces user-observable changes.bundle exec rake
) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).