ruff
98209be8 - Detect quote style ignoring docstrings (#3306)

Commit
2 years ago
Detect quote style ignoring docstrings (#3306) Currently the quote style of the first string in a file is used for autodetecting what to use when rewriting code for fixes. This is an okay heuristic, but often the first line in a file is a docstring, rather than a string constant, and it's not uncommon for pre-Black code to have different quoting styles for those. For example, in the Google style guide: https://google.github.io/styleguide/pyguide.html > Be consistent with your choice of string quote character within a file. Pick ' or " and stick with it. ... Docstrings must use """ regardless. This branch adjusts the logic to instead skip over any `"""` triple doublequote string tokens. The default, if there are no single quoted strings, is still to use double quote as the style.
Author
bz2 bz2
Parents
Loading