-
-
Notifications
You must be signed in to change notification settings - Fork 285
Add a new cop RSpec/Output
#2129
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
Conversation
|
|
|
I did some grepping around the |
|
This is succeeding for me locally with no file changes. I wonder why. |
b205673 to
9152c2a
Compare
|
Could you please squashed related commits into one? |
f4466c9 to
51ae55e
Compare
|
I agree with adding this cop with Also, I believe the cop name As I commented inline in the code, I believe that contextual autocorrect is preferable, but this is a point where opinions may differ. What does everyone else think? |
|
In general, I like the idea of adding autocorrect and I didn't realize how simple it would be to add. It might be better to make it an unsafe autocorrect though since there are some legitimate but rare use cases for printing in integration specs. |
d2bc1f0 to
7ad5ba6
Compare
|
I've updated the code to address comments and add unsafe autocorrect. The autocorrect specs look a bit weird because they're just blank lines but it does show that things are working correctly. Let me know if there's anything else I should address. |
This is based on the `Rails/Output` cop with three minor changes. 1. Autocorrection is removed as the expectation is that the print statement will be removed by the user. 2. The message is changed. 3. The cop runs only on spec files. Clean up rubocop:disable Co-authored-by: Yudai Takada <[email protected]> Update comment Apply suggestions from code review Make the code more maintainable and add autocorrect. Co-authored-by: Ryo Nakamura <[email protected]> Update specs Add AutoCorrect: contextual Co-authored-by: Ryo Nakamura <[email protected]> Add @safety comment
74b4895 to
10c8ec0
Compare
|
Okay, I added a |
r7kamura
left a comment
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.
👍
bquorning
left a comment
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 for the contribution!
This is based on the
Rails/Outputcop with three minor changes.Before submitting the PR make sure the following are checked:
master(if not - rebase it).CHANGELOG.mdif 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: pendinginconfig/default.yml.Enabled: truein.rubocop.yml.VersionAdded: "<<next>>"indefault/config.yml.If you have modified an existing cop's configuration options:
VersionChanged: "<<next>>"inconfig/default.yml.