SublimeText / RSpec

Sublime Text 2 / 3 plugin for RSpec BDD Framework
124 stars 57 forks source link

Use of single quote for static text in Ruby #42

Closed driket closed 9 years ago

driket commented 10 years ago

'it', 'describe' and 'context' blocs are generally static text strings. Since they don't need string interpolations and/or symbols, they shouldn't use double quoted strings.

I tend to use this guide as a reference, because most of Ruby linters / static code analyzers follow it (Rubocop, Puppet Linter, Cane) : https://github.com/bbatsov/ruby-style-guide

Unfortunately there are two different opinions about usage of single/double quoted strings. None of them is "the officially recognized one" as far as I know.

a-b-r-o-w-n commented 10 years ago

+1 Came here just for this. Nice work.

SergXIIIth commented 10 years ago

+1 Nice work

jaredmoody commented 10 years ago

:+1:

olivierlacan commented 10 years ago

I disagree for a very simple reason. Specs should use as straightforward a language as possible. Using single quotes means you'll have to manually escape any apostrophe in words like:

The Ruby Style Guide is a guide, not a law or a religious text. More importantly, there is no demonstrable performance difference between single and double quoted strings.

princemaple commented 9 years ago

Hi @driket and everyone else, I think @olivierlacan made a good point. I'm going to close this one for now, but feel free to continue the discussion, or even making another / reopening the existing PR that changes everything to double quotes.