]> git.madduck.net Git - etc/vim.git/blobdiff - docs/guides/using_black_with_other_tools.md

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Bump pypa/cibuildwheel from 2.16.1 to 2.16.2 (#3934)
[etc/vim.git] / docs / guides / using_black_with_other_tools.md
index 09421819ec3b50ef6e9dfe1e983c828deb7e8066..22c641a74203defdc0d9aef93d36a5c3793b49f5 100644 (file)
@@ -51,9 +51,9 @@ line_length = 88
 
 #### Why those options above?
 
-_Black_ wraps imports that surpass `line-length` by moving identifiers into their own
-indented line. If that still doesn't fit the bill, it will put all of them in separate
-lines and put a trailing comma. A more detailed explanation of this behaviour can be
+_Black_ wraps imports that surpass `line-length` by moving identifiers onto separate
+lines and by adding a trailing comma after each. A more detailed explanation of this
+behaviour can be
 [found here](../the_black_code_style/current_style.md#how-black-wraps-lines).
 
 isort's default mode of wrapping imports that extend past the `line_length` limit is
@@ -97,7 +97,7 @@ does not break older versions so you can keep it if you are running previous ver
 <details>
 <summary>.isort.cfg</summary>
 
-```cfg
+```ini
 [settings]
 profile = black
 ```
@@ -107,7 +107,7 @@ profile = black
 <details>
 <summary>setup.cfg</summary>
 
-```cfg
+```ini
 [isort]
 profile = black
 ```
@@ -173,7 +173,7 @@ limit of `88`, _Black_'s default. This explains `max-line-length = 88`.
 ```ini
 [flake8]
 max-line-length = 88
-extend-ignore = E203
+extend-ignore = E203, E704
 ```
 
 </details>
@@ -181,7 +181,7 @@ extend-ignore = E203
 <details>
 <summary>setup.cfg</summary>
 
-```cfg
+```ini
 [flake8]
 max-line-length = 88
 extend-ignore = E203
@@ -210,31 +210,16 @@ mixed feelings about _Black_'s formatting style.
 #### Configuration
 
 ```
-disable = C0330, C0326
 max-line-length = 88
 ```
 
 #### Why those options above?
 
-When _Black_ is folding very long expressions, the closing brackets will
-[be dedented](../the_black_code_style/current_style.md#how-black-wraps-lines).
+Pylint should be configured to only complain about lines that surpass `88` characters
+via `max-line-length = 88`.
 
-```py3
-ImportantClass.important_method(
-    exc, limit, lookup_lines, capture_locals, callback
-)
-```
-
-Although this style is PEP 8 compliant, Pylint will raise
-`C0330: Wrong hanging indentation before block (add 4 spaces)` warnings. Since _Black_
-isn't configurable on this style, Pylint should be told to ignore these warnings via
-`disable = C0330`.
-
-Also, since _Black_ deals with whitespace around operators and brackets, Pylint's
-warning `C0326: Bad whitespace` should be disabled using `disable = C0326`.
-
-And as usual, Pylint should be configured to only complain about lines that surpass `88`
-characters via `max-line-length = 88`.
+If using `pylint<2.6.0`, also disable `C0326` and `C0330` as these are incompatible with
+_Black_ formatting and have since been removed.
 
 #### Formats
 
@@ -242,9 +227,6 @@ characters via `max-line-length = 88`.
 <summary>pylintrc</summary>
 
 ```ini
-[MESSAGES CONTROL]
-disable = C0330, C0326
-
 [format]
 max-line-length = 88
 ```
@@ -257,9 +239,6 @@ max-line-length = 88
 ```cfg
 [pylint]
 max-line-length = 88
-
-[pylint.messages_control]
-disable = C0330, C0326
 ```
 
 </details>
@@ -268,11 +247,40 @@ disable = C0330, C0326
 <summary>pyproject.toml</summary>
 
 ```toml
-[tool.pylint.messages_control]
-disable = "C0330, C0326"
-
 [tool.pylint.format]
 max-line-length = "88"
 ```
 
 </details>
+
+### pycodestyle
+
+[pycodestyle](https://pycodestyle.pycqa.org/) is also a code linter like Flake8.
+
+#### Configuration
+
+```
+max-line-length = 88
+ignore = E203
+```
+
+#### Why those options above?
+
+pycodestyle should be configured to only complain about lines that surpass `88`
+characters via `max_line_length = 88`.
+
+See
+[Why are Flake8’s E203 and W503 violated?](https://black.readthedocs.io/en/stable/faq.html#why-are-flake8-s-e203-and-w503-violated)
+
+#### Formats
+
+<details>
+<summary>setup.cfg</summary>
+
+```cfg
+[pycodestyle]
+ignore = E203
+max_line_length = 88
+```
+
+</details>