Open opk12 opened 7 months ago
Personally I like using code without dedent()
since there is less whitespace, and it saves me an extra import.
With that being said, reliably detecting when to emit an error for this will be hard. Since Refurb is built on Mypy, and Mypy stores string nodes in a normalized form, "\n"
and """<newline>"""
are identical, making it hard to detect when multi-line strings are being used.
I'm not against adding this, but doing so will be difficult for the reason above, and because it may be hard to gauge when using dedent()
will improve readability (for example, very long/wide multi-line strings).
Overview
Is it in-scope to suggest wrapping a multiline string literal inside textwrap.dedent() to keep it readable and consistently indented?
Proposal
A big thanks to alonzodemo at OpenStreetMap for teaching me the trick.