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

Pull example group node matchers up #934

Merged
merged 1 commit into from Jul 1, 2020

Conversation

mockdeep
Copy link
Contributor

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 and noticed that there were similar
implementations in a handful of other places. I thought it was probably
worth abstracting upwards.


  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • [n/a] Added tests.
  • [n/a] Updated documentation.
  • [n/a] Added an entry to the CHANGELOG.md if the new code introduces user-observable changes.
  • The build (bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).

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
Copy link
Member

@pirj pirj left a 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!

@pirj pirj requested review from Darhazer and bquorning June 14, 2020 19:22
@mockdeep
Copy link
Contributor Author

Part of me wonders if there should be on_example_group, on_spec_group, on_shared_group macros, but that looks like it would be more work.

@pirj
Copy link
Member

pirj commented Jun 14, 2020

if there should be

Depends on how often they would be used. Can't tell that off the top of my head.

it would be more work

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

mockdeep added a commit to mockdeep/rubocop-rspec that referenced this pull request Jun 19, 2020
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
@mockdeep mockdeep mentioned this pull request Jun 19, 2020
6 tasks
mockdeep added a commit to mockdeep/rubocop-rspec that referenced this pull request Jun 19, 2020
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
mockdeep added a commit to mockdeep/rubocop-rspec that referenced this pull request Jun 27, 2020
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
@bquorning bquorning merged commit 172dfe8 into rubocop:master Jul 1, 2020
mockdeep added a commit to mockdeep/rubocop-rspec that referenced this pull request Jul 7, 2020
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
mockdeep added a commit to mockdeep/rubocop-rspec that referenced this pull request Jul 7, 2020
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
pirj pushed a commit to mockdeep/rubocop-rspec that referenced this pull request Jul 15, 2020
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
bquorning pushed a commit that referenced this pull request Oct 22, 2020
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
@bquorning bquorning mentioned this pull request Oct 22, 2020
3 tasks
bquorning pushed a commit that referenced this pull request Oct 22, 2020
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
pirj pushed a commit that referenced this pull request Nov 2, 2020
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
pirj pushed a commit to rubocop/rubocop-capybara that referenced this pull request Dec 29, 2022
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
ydah pushed a commit to rubocop/rubocop-factory_bot that referenced this pull request Apr 13, 2023
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
ydah pushed a commit to rubocop/rubocop-rspec_rails that referenced this pull request Mar 27, 2024
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
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.

None yet

3 participants