Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pylint config docs #2931

Merged
merged 5 commits into from Mar 16, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Expand Up @@ -32,6 +32,8 @@
<!-- Major changes to documentation and policies. Small docs changes
jpy-git marked this conversation as resolved.
Show resolved Hide resolved
don't need a changelog entry. -->

- Update pylint config documentation (#2931)

### Integrations

<!-- For example, Docker, GitHub Actions, pre-commit, editors -->
Expand Down
3 changes: 0 additions & 3 deletions docs/compatible_configs/pylint/pylintrc
@@ -1,5 +1,2 @@
[MESSAGES CONTROL]
disable = C0330, C0326

[format]
max-line-length = 88
3 changes: 0 additions & 3 deletions docs/compatible_configs/pylint/pyproject.toml
@@ -1,5 +1,2 @@
[tool.pylint.messages_control]
disable = "C0330, C0326"

[tool.pylint.format]
max-line-length = "88"
3 changes: 0 additions & 3 deletions docs/compatible_configs/pylint/setup.cfg
@@ -1,5 +1,2 @@
[pylint]
max-line-length = 88

[pylint.messages_control]
disable = C0330, C0326
32 changes: 4 additions & 28 deletions docs/guides/using_black_with_other_tools.md
Expand Up @@ -210,41 +210,23 @@ mixed feelings about _Black_'s formatting style.
#### Configuration

```
disable = C0326, C0330
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding a small line/note that this configuration is only applicable latest versions, or to be more precise >= 2.6.0.

Copy link
Contributor Author

@jpy-git jpy-git Mar 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, can see it in the 2.6.0 release notes.

Given there have been a good number of releases since 2.6.0, do you think this can just be something like

N.B. if using `pylint < 2.6.0`, also disable `C0326` and `C0330` as these clash with _Black_ formatting and have since been removed.

or would you rather keep the longer descriptions?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a short note like that is good. We can skip the details.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the old error code callout in now 😄

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 deprecated.
jpy-git marked this conversation as resolved.
Show resolved Hide resolved

#### Formats

<details>
<summary>pylintrc</summary>

```ini
[MESSAGES CONTROL]
disable = C0326, C0330

[format]
max-line-length = 88
```
Expand All @@ -257,9 +239,6 @@ max-line-length = 88
```cfg
[pylint]
max-line-length = 88

[pylint.messages_control]
disable = C0326, C0330
```

</details>
Expand All @@ -268,9 +247,6 @@ disable = C0326, C0330
<summary>pyproject.toml</summary>

```toml
[tool.pylint.messages_control]
disable = "C0326, C0330"

[tool.pylint.format]
max-line-length = "88"
```
Expand Down