Page MenuHomePhabricator

Prefer double-quoted strings in Ruby code
Closed, ResolvedPublic

Description

We should follow GitHub Ruby Styleguide.

Strings section says:

Prefer double-quoted strings. Interpolation and escaped characters will always work without a delimiter change, and ' is a lot more common than " in string literals.

  1. bad name = 'Bozhidar'
  2. good name = "Bozhidar"

Version: unspecified
Severity: normal
Whiteboard: gci2013 https://www.mediawiki.org/wiki/Google_Code-In#Candidate_tasks
URL: https://www.google-melange.com/gci/task/view/google/gci2013/5896231096156160

Details

Reference
bz57597

Event Timeline

bzimport raised the priority of this task from to Needs Triage.
bzimport set Reference to bz57597.

List of repositories that contain Ruby code is here: https://github.com/wikimedia/mediawiki-selenium

The first step is to clone all repositories (Gerrit link) and replace all double quotes with single quotes in all .rb and .feature files.

Change 97756 had a related patch set uploaded by Mayankmadan:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97756

Change 97761 had a related patch set uploaded by Mayankmadan:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97761

Check syntax of all Ruby files in a repository:

find . -name "*.rb" -exec ruby -wc {} \;

Change 97762 had a related patch set uploaded by Mayankmadan:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97762

Change 97765 had a related patch set uploaded by Mayankmadan:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97765

Change 97769 had a related patch set uploaded by Mayankmadan:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97769

Change 97773 had a related patch set uploaded by Mayankmadan:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97773

Change 97781 had a related patch set uploaded by Mayankmadan:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97781

Change 97788 had a related patch set uploaded by Mayankmadan:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97788

Change 97842 had a related patch set uploaded by Mayankmadan:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97842

hoo added a comment.Nov 26 2013, 9:54 PM

You really prefer "{\"labels\":{\"en\":..." over '{"labels":{"en":...' ?

Change 97849 had a related patch set uploaded by Mayankmadan:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97849

Change 97773 merged by jenkins-bot:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97773

Change 97769 merged by jenkins-bot:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97769

Change 97761 merged by Manybubbles:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97761

Change 97781 merged by jenkins-bot:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97781

Change 97842 merged by Tobias Gritschacher:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97842

I'm still not sure what to prefer - single or double quotes. Now, with double quotes everywhere, I get tons of warnings in RubyMine (so their default setting prefers single quotes it seems) telling "Double quoted string with no interpolation and special symbols".

You can always revert the commit if you prefer single quotes. :) I thought following github ruby convention is a step forward.

Change 97762 merged by jenkins-bot:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97762

Change 97765 merged by jenkins-bot:
QA: prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97765

Change 97788 merged by jenkins-bot:
[Browser tests] Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97788

Change 97756 merged by jenkins-bot:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97756

Change 97849 merged by jenkins-bot:
Prefer double-quoted strings in Ruby code

https://gerrit.wikimedia.org/r/97849

Change 102198 had a related patch set uploaded by Zfilipin:
Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102198

Change 102204 had a related patch set uploaded by Zfilipin:
Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102204

Change 102207 had a related patch set uploaded by Zfilipin:
Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102207

Change 102209 had a related patch set uploaded by Zfilipin:
Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102209

Change 102211 had a related patch set uploaded by Zfilipin:
WIP Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102211

Change 102213 had a related patch set uploaded by Zfilipin:
Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102213

Change 102215 had a related patch set uploaded by Zfilipin:
[browser test] Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102215

Change 102207 merged by jenkins-bot:
QA: Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102207

Change 102213 merged by jenkins-bot:
Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102213

Change 102211 merged by jenkins-bot:
Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102211

Change 102204 merged by jenkins-bot:
Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102204

Change 102198 merged by jenkins-bot:
Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102198

Change 102215 abandoned by Cmcmahon:
[browser test] Replacing single quotes with double quotes

Reason:
abandoned in favor of https://gerrit.wikimedia.org/r/#/c/102710/

https://gerrit.wikimedia.org/r/102215

Change 102209 merged by Cmcmahon:
Replacing single quotes with double quotes

https://gerrit.wikimedia.org/r/102209

Change 105400 had a related patch set uploaded by Zfilipin:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105400

Change 105400 merged by Cmcmahon:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105400

Change 105401 had a related patch set uploaded by Zfilipin:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105401

Change 105402 had a related patch set uploaded by Zfilipin:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105402

Change 105403 had a related patch set uploaded by Zfilipin:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105403

Change 105404 had a related patch set uploaded by Zfilipin:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105404

Change 105407 had a related patch set uploaded by Zfilipin:
[browser test] Updated Ruby and RubyGems

https://gerrit.wikimedia.org/r/105407

Change 105409 had a related patch set uploaded by Zfilipin:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105409

Change 105410 had a related patch set uploaded by Zfilipin:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105410

Change 105401 merged by Cmcmahon:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105401

Change 105403 merged by Cmcmahon:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105403

Change 105404 merged by Cmcmahon:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105404

Change 105410 merged by Cmcmahon:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105410

Change 105402 merged by jenkins-bot:
QA: Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105402

Change 105409 merged by jenkins-bot:
Updated Ruby, RubyGems and Firefox

https://gerrit.wikimedia.org/r/105409

Change 105407 merged by jenkins-bot:
[browser test] Updated Ruby and RubyGems

https://gerrit.wikimedia.org/r/105407