I feel Black is doing something not compliant (with my Organisation), so I am trying to ignore certain rules.
Example below and a related link
PEP 8: whitespace before ':'
My Organisation (Coding Standards) does not give priority to what Black feels is right, but wants a way to customise black configurations.
I dont see any mentioned of Ignoring a Rule in Black documentation https://github.com/psf/black#command-line-options.
They have given examples to ignore Flake8 rules, but dont seem to have any documentation for their own product.
You can't customize black. From the readme:
Black reformats entire files in place. It is not configurable.
While you can't cherry-pick certain rules to disable, you can skip formatting for individual lines (using # fmt: skip
at the end of the line), or for blocks of code (wrapping the code with # fmt: on
and # fmt: off
)
https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#code-style
And if using PyCharm, here's a guide for skipping certain lines without using the fmt
comments: https://godatadriven.com/blog/partial-python-code-formatting-with-black-pycharm/
Edit: implement @kgadek correction
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With