-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[RUBY] Single quotes preferred style #565
Conversation
The change to double quotes was a controversial discussion when introduced. You may find the discussion, reasoning, and eventual decision interesting, @ssunday #174 Personally, since adopting this change to always use double quotes, I've always appreciated not having to think about which quotes to use. |
Some context on how this PR came to be: @ssunday is collaborating with us on a project in NYC and has had to debug our code. Some history of the thoughtbot styleguide with a focus on quote marks:
As usual I'd like to promote the idea of deleting the |
@iwz It's a really interesting thread! Lots definitely changed since then...and not at all! Some of the points brought up are still true (both sides). With rubocop autofixing where it is, enforcing single/double quotes removes the Human adoption element to a degree. You could 'forget' to use single and it corrects it if it could/should. (This is assuming rubocop is also being used to correct things). So to me, this then comes to what is easier to read and manage. Are single quotes easier for our minds to process? It takes up less visual space...does it add up? To me, it looks cleaner and seems more elegant. Also, which has been said: #174 (comment) /s: Has there been studies if double quote usage increases chances of developing Carpal Tunnel Syndrome?? end/s |
I particularly appreciate this when writing test descriptions. Please excuse the overly specific example - but I hope it provides a useful illustration. Say I'm trying to describe the edge-cases where something shouldn't take place: RSpec.describe Foo do
it 'doesn' # Brain: Uh oh...
end One then has to break their flow and pick an option...
it "doesn't notify via Slack"
it 'does not notify via Slack' # Hmm I didn't want to replace "doesn't" with "does not"
it 'does\'t notify via Slack' # Nope |
Inspired by @odlp's comment, I threw this together 😂😂😂
|
@jferris I don't know how to move this PR forward, in any direction. Do you? |
@odlp if you're assuming people are automatically doing this....to me, you could use double quotes and have the linter enforce the proper option. Converting to double quotes for apostrophes is also, I think, acceptable, as sometimes you'll need to use double quotes anyway for other reasons. The goal isn't to eliminate double quotes, but have single quotes be preferred as it's easier to type and parse. |
I'm going to close this pull request, because I'm not convinced that going back to single quotes will be worth the required changes we'd need to make. People are welcome to continue discussing quoting styles, but I don't plan on merging this. |
@jferris 👍 It's your style guide/linters to run, can't argue with that perspective. |
More information for the next time this comes up: Rails itself prefers double quotes and they plan to clean up any lingering single quotes. |
Why:
Update:
This: #174 (comment)