black.rst (709B)
1 Black 2 ===== 3 4 `Black <https://black.readthedocs.io/en/stable/>`__ is a opinionated python code formatter. 5 6 7 Run Locally 8 ----------- 9 10 The mozlint integration of black can be run using mach: 11 12 .. parsed-literal:: 13 14 $ mach lint --linter black <file paths> 15 16 Alternatively, omit the ``--linter black`` and run all configured linters, which will include 17 black. 18 19 20 Configuration 21 ------------- 22 23 To enable black on new directory, add the path to the include 24 section in the :searchfox:`black.yml <tools/lint/black.yml>` file. 25 26 Autofix 27 ------- 28 29 The black linter provides a ``--fix`` option. 30 31 32 Sources 33 ------- 34 35 * :searchfox:`Configuration (YAML) <tools/lint/black.yml>` 36 * :searchfox:`Source <tools/lint/python/black.py>`