question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Settings for forcing/prefering single/double quotes for strings

See original GitHub issue

Just a setting so quoting style can be unified across a codebase.

e.g.

for the three strings abc, a'c, a"c

prefer_single_quotes -> 'abc', "a'c", 'a"c' prefer_double_quotes -> "abc", "a'c", 'a"c'

force_single_quotes -> 'abc', 'a\'c', 'a"c' force_double_quotes -> "abc", "a'c", "a\"c"

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:195
  • Comments:26 (8 by maintainers)

github_iconTop GitHub Comments

25reactions
kamahencommented, Jun 18, 2020

Yapf has a philosophy of not changing the source at all, except for whitespace.

You could always format your code with black, then re-format it with yapf. 😉 This would also change some backslashes to parenthesized expressions, I think.

PS: pylint looks for the most common type of quotes and then complains when the other is used (except for cases like "'" and '"' which would otherwise be '\'' or "\"").

20reactions
loganknechtcommented, Aug 9, 2019

Hello!

I would like to communicate that this is also relevant to my interests!

Please implement this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to tell eslint that you prefer single quotes around your ...
Another useful option is to allow single or double quotes as long as the string contains an escapable quote like "lorem ipsum 'donor'...
Read more >
“Double Quotes” vs 'Single Quotes' vs `Backticks` in JavaScript
The same theory applies to double quotes, and you have to use a backslash to escape any double quotes inside double quotes.
Read more >
prefer_single_quotes - Dart
DO use single quotes where they wouldn't require additional escapes. That means strings with an apostrophe may use double quotes so that the...
Read more >
Prefer single quotes over double quotes for strings, in a ...
Be consistent with your choice of string quote character within a file. Pick ' or ” and stick with it. However, in a...
Read more >
Super important question… do you prefer “ or ' to enclose ...
They match the docstring standard described in PEP 257. An empty string in double quotes ("") is impossible to confuse with a one...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found