-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 Lint/PercentStringArray
and Lint/PercentSymbolArray
cops
#3165
Conversation
9e40a38
to
a091b34
Compare
@@ -15,6 +15,7 @@ class GlobalVars < Cop | |||
|
|||
# predefined global variables their English aliases | |||
# http://www.zenspider.com/Languages/Ruby/QuickRef.html | |||
# rubocop:disable Lint/PercentString |
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.
Because of $,
on line 26
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.
I wonder if we can account account for cases like these.
c57d2fa
to
133fa77
Compare
Looks good @owst - only minor comments would be to a) potentially call it |
@joehorsnell Great remarks. Probably I'd go with different cops. |
@@ -6,7 +6,9 @@ | |||
describe RuboCop::Cop::Lint::LiteralInCondition do | |||
subject(:cop) { described_class.new } | |||
|
|||
# rubocop:disable Lint/PercentString |
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.
Guess the cop could account for cases like this one.
About naming - the literals ruby doc refers to them as Percent Strings |
133fa77
to
13d0d22
Compare
@bbatsov separate cops - done! |
Lint/PercentString
copLint/PercentStringArray
and Lint/PercentSymbolArray
cops
9f433b2
to
11c39bb
Compare
89ccfcb
to
71b502f
Compare
71b502f
to
32c52e4
Compare
Has to be rebased. |
32c52e4
to
c4c014d
Compare
@bbatsov - done! |
Adds a new cop
Lint/PercentString
cop:I recently made this mistake in my work code, and it was only due to a keen-eyed reviewer (@Qlexander - thanks 👍) that I avoided introducing a bug, so I think Rubocop can help us out here.
Before submitting the PR make sure the following are checked:
master
(if not - rebase it)and description in grammatically correct, complete sentences.