flake8-simplify icon indicating copy to clipboard operation
flake8-simplify copied to clipboard

Use repr when printing strings

Open ItsDrike opened this issue 2 years ago • 0 comments

Desired change

  • Rule(s): SIM300 (However it likely affects more rules)
  • Adjustment: Use repr when printing the strings

Explanation

With an if statement like this:

if "}\n" == line:
    ...

the current version of flake8-simplify prints the }\n string with an actual new line, instead of escaping the special newline character, like doing repr("}\n") would. This looks very weird, and many editors don't support it and only print the first line, which is misleading: image

ItsDrike avatar Jun 19 '22 18:06 ItsDrike