-
-
Notifications
You must be signed in to change notification settings - Fork 276
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 support for enforcing symbolized shared examples #1746
Conversation
a91e169
to
60ce214
Compare
Oh interesting, I ran |
It is documented, so, my apologies, you don’t get those hipster creds 😄 The arguments that deficiencies of an IDE causing cognitive resistance and thus degraded code quality don’t appeal to me as sufficient justification to change the code notation from more human-readable to more machine-readable. Especially when it comes to RSpec that is biased towards human-readable. But here, in rubocop, as opposed to a more black-and-white style guides, we accept cops and styles to accomodate major styles, and GitLab source can certainly be considered to be one of the major styles. Unless given my arguments above you’d love to reconsider your decision internally, I’ll be happy to review and accept this. Thanks for your contribution, and we’ll be happy if you decide to upstream your other RSpec-targeted cops from the GitLab source to us. |
It makes sense to ‘rm Gemfile.lock && bundle’ to ensure your local is on par with CI. |
Thanks for your thoughts @pirj ! Even if GitLab chooses to continue enforcing string descriptions for shared examples, I think it makes sense to provide this configuration as an option. Like you said, rubocop can and should accommodate different styles. :) |
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.
Thank you!
Looks mostly good.
The main thing to fix isvthe indentation inside heredoc in specs.
I apologize for the state of the spec, and that it has examples of shared_example
usage with unacceptable arguments. I hope you feel like to fix this along the way.
c949fa1
to
842e690
Compare
Thank you for the feedback @pirj and sorry for the delay in addressing it. I believe that I have incorporated all of your feedback. Let me know what you think! |
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.
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.
Thank you!
* Existing check only allows to enforce one style, which is called "titelized" in the error message but really just looks for a string type. * Enforcing the existing style raises an error when a shared example uses a symbol definition rather than a string. * But there are some benefits to using symbol types instead, as is discussed here: https://gitlab.com/gitlab-org/gitlab/-/issues/427697 * As a result, some codebases might want to enforce a symbol type instead.
Sorry, I did it myself. I hope you don’t mind 😄 |
There’s a bug here, #1765 |
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: "<<next>>"
indefault/config.yml
.If you have modified an existing cop's configuration options:
VersionChanged: "<<next>>"
inconfig/default.yml
.