Feature request:
# fmt: pass would skip formatting for the single statement that immediately follows.
Is your feature request related to a problem? Please describe.
Not a response to a problem but it might be helpful for the following reasons:
Describe the solution you'd like
z = "hello " + "world"
# fmt: pass
custom_formatting = [
0, 1, 2,
3, 4, 5,
6, 7, 8,
]
regular_formatting = [
0, 1, 2, 'this will be formatted'
]
The custom_formatting list would be ignored, everything else would be formatted.
Describe alternatives you've considered
# fmt: off
ugly_code=('but I want it this way')
even_more=('dont\'t judge me')
# fmt: on
#fmt: off at end of line (#790)# fmt: pass addresses the same concern while also being a bit more flexible.# fmt: pass is more readable & predictable as a separate lineAdditional context
Naming:
# fmt: pass reflects Python's existing pass statement. Hopefully this hints that you can use it to temporarily appease the formatter for one quick thing, but it's not something you want everywhere.
Naming could be anything, e.g. "pass", "skip", "ignore"
I like this one..
but would like to extend it a bit more
foo = bar.<100 characters +> # fmt: pass
if i place at the end of the statement - it should work as well (not only before the statement)
I would love to see this feature merged!
I like this one..
but would like to extend it a bit more
foo = bar.<100 characters +> # fmt: passif i place at the end of the statement - it should work as well (not only before the statement)
Expanding on @vitalik's ask. It would be great if this feature would be compatible with other inline comment options.
def example(self): #noqa - squelch some lint check # fmt: pass
The reason why I uninstalled black :(
We definitly need something like this.
I have ansible vars in my python script
which require me to write something like
{{ variable_name }} which black will turn into {{variable_name}}
which afaik isnt valid anymore.
turning the line into
# fmt: off
my_var = {{ variable_name }}
# fmt: on
looks very ugly in my opinion.
this however:
my_var = {{ variable_name }} # fmt: skip
would look quite okay.
Most helpful comment
I like this one..
but would like to extend it a bit more
foo = bar.<100 characters +> # fmt: passif i place at the end of the statement - it should work as well (not only before the statement)