-
Notifications
You must be signed in to change notification settings - Fork 213
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
Use consistent style for Lint/SymbolConversion
#600
base: main
Are you sure you want to change the base?
Use consistent style for Lint/SymbolConversion
#600
Conversation
This is a tricky one, because there are two competing interests here. On one hand, I agree that consistency in hash format is important. For example, if a single On the other hand, enforcing that the presence of a single illegal identifier should force all such identifiers to be quoted seems overkill. For example, if you carried the logic that the presence of one illegal symbol literal ( I'd definitely disagree with a rule that did this, for example: # bad
class Foo
def legal_name
end
define_method :'illegal-name' do
end
end
# good
class Foo
define_method :legal_name do
end
define_method :'illegal-name' do
end
end One additional argument against, is that I'm always cautious of rules where a later line could force changes in prior lines. So if the 5th line of a hash literal contains an illegal symbol literal name, it shouldn't cause git churn for lines 1-4 without good reason. I think the As a result, I'd be 👎 to making this change. |
hey 👋🏻 I'm not sure I get the example. I might be wrong, but it looks like this rule, when using |
@luizkowalski no it doesn't. I was using it to illustrate the broader point of why I don't think consistency is an unqualified principle in cases where you're working around illegal identifiers. |
Fair points. To be honest, I don't have a good argument other than preferring consistency when reading a hash definition. Due to configured {
a: 1,
"b-c": 2
} to {
:"a" => 1,
:"b-c" => 2
} 🤷 |
I'd like to suggest to use consistent style for
Lint/SymbolConversion
. Examples from rubocop docs: