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
Should Style/StringLiterals
also apply to quoted symbols?
#9793
Comments
I think we should add a new boolean config option |
@tejasbubane Add this option where? I assume you're referrring to |
…n quoted symbols. Like `Style/StringLiterals`, this cop checks for the quoting style for symbols to be consistent. Checking whether a symbol _should_ be quoted or not is still handled by `Lint/SymbolConversion`. This cop shares as much as possible with `Style/StringLiterals` for ease of maintainabilty. As well, for simple configuration, the default "style" is `same_as_string_literals` which will automatically apply the same configuration set up for `Style/StringLiterals` to this cop as well (it defaults to `single_quotes` if `StringLiterals` is not enabled).
[Fix #9793] Add Style/QuotedSymbols to enforce consistency in quoted symbols
Style/StringLiterals
provides the ability to enforce a consistent quoting style ("..."
vs'...'
), with rich support for edge cases.Lint/SymbolConversion
provides the ability to enforce consistent symbol literal syntax (again with rich support for edge cases), and respects the style specified byStyle/StringLiterals
when autocorrecting by inserting quotes.However, when using quoted symbol literals, there does not appear to be a way to enforce a consistent quote style. It seems logical that
Style/StringLiterals
should extend its enforcement to Symbol literals as well.Expected behavior
Style/StringLiterals
enforced style should apply to Symbol literals, orActual behavior
Style/StringLiterals
enforced style does not apply to Symbol literals, andSteps to reproduce the problem
Setup
Output
RuboCop version
The text was updated successfully, but these errors were encountered: