Black: fmt: on/off ignores comments unless code also present

Created on 10 Aug 2020  路  2Comments  路  Source: psf/black

fmt: off/on doesn't disable black formatting for comments unless code is also present.

The following:

# fmt: off
#setup: device 3423
# fmt: on

Yields:

# setup: device 3423

But, add some code:

# fmt: off
#setup: device 3423
black = 'test'
# fmt: on

and the comment is also ignored (as desired).

  • Version: Lastest (19.10b0)
  • OS and Python version: macOS 10.15.5/Python 3.8.2

Also happens on master.

bug duplicate

All 2 comments

Thanks @hugovk, yes, this is a duplicate of #1245. Thanks @djlondon for filing the bug report, good to know that this issue still exists on current master!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

decibyte picture decibyte  路  3Comments

bhearsum picture bhearsum  路  3Comments

quodlibetor picture quodlibetor  路  3Comments

dimaqq picture dimaqq  路  3Comments

brettcannon picture brettcannon  路  3Comments