-
-
Notifications
You must be signed in to change notification settings - Fork 277
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 RSpec/DuplicatedMetadata
cop
#1486
Conversation
c3490fc
to
f6032f5
Compare
f6032f5
to
7804a84
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 good, thank you!
Did a run on real-world-rspec
, no errors.
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.
Not a requirement but just wondering - can it also flag :config, config: true duplication?
I’ll do a full review tomorrow
module Cop | ||
module RSpec | ||
# Helper methods to find RSpec metadata. | ||
module Metadata |
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.
❤️
It would be nice to support that case as well 👍 |
I agree that :config vs config: true should be separate cop, and that it partially will resolve the question. ( |
@r7kamura can you please rebase to fix the changelog entry 🙇 |
7804a84
to
66f3391
Compare
Looking at RSpec code in some libraries and applications, I see several duplicate metadata. So I think it would be nice to have a Cop that detects such code. What do you think?
For example, the following is the result from rubocop gem:
And the following is from rubocop-rails gem:
Before submitting the PR make sure the following are checked:
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).If you have created a new cop:
config/default.yml
.Enabled: pending
inconfig/default.yml
.Enabled: true
in.rubocop.yml
.VersionAdded
indefault/config.yml
to the next minor version.If you have modified an existing cop's configuration options:
VersionChanged
inconfig/default.yml
to the next major version.