Skip to content

Commit

Permalink
Disable PLR2004 and S101 by default
Browse files Browse the repository at this point in the history
PLR2004 and S101 both flag very common constructs (string comparisons
and `assert` statements), neither of which is generally considered to be
an anti-pattern, so this commit disables both by default.
  • Loading branch information
not-my-profile committed Jan 28, 2023
1 parent 57d1e13 commit 1f69610
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,6 @@ For more, see [flake8-bandit](https://pypi.org/project/flake8-bandit/) on PyPI.

| Code | Name | Message | Fix |
| ---- | ---- | ------- | --- |
| S101 | assert-used | Use of `assert` detected | |
| S102 | exec-used | Use of `exec` detected | |
| S103 | bad-file-permissions | `os.chmod` setting a permissive mask `{mask:#o}` on file or directory | |
| S104 | hardcoded-bind-all-interfaces | Possible binding to all interfaces | |
Expand All @@ -791,6 +790,11 @@ For more, see [flake8-bandit](https://pypi.org/project/flake8-bandit/) on PyPI.
| S612 | logging-config-insecure-listen | Use of insecure `logging.config.listen` detected | |
| S701 | jinja2-autoescape-false | Using jinja2 templates with `autoescape=False` is dangerous and can lead to XSS. Ensure `autoescape=True` or use the `select_autoescape` function. | |


The following rules have been disabled by default:

* S101 (assert-used): `assert` is generally not considered to be an anti-pattern.

### flake8-blind-except (BLE)

For more, see [flake8-blind-except](https://pypi.org/project/flake8-blind-except/) on PyPI.
Expand Down Expand Up @@ -1216,7 +1220,11 @@ For more, see [Pylint](https://pypi.org/project/pylint/) on PyPI.
| PLR0402 | consider-using-from-import | Use `from {module} import {name}` in lieu of alias | |
| PLR1701 | consider-merging-isinstance | Merge these isinstance calls: `isinstance({obj}, ({types}))` | |
| PLR1722 | use-sys-exit | Use `sys.exit()` instead of `{name}` | 🛠 |
| PLR2004 | magic-value-comparison | Magic value used in comparison, consider replacing {value} with a constant variable | |


The following rules have been disabled by default:

* PLR2004 (magic-value-comparison): Comparisons to strings are generally not considered to be an anti-pattern.

#### Warning (PLW)
| Code | Name | Message | Fix |
Expand Down
2 changes: 0 additions & 2 deletions scripts/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ select = ["ALL"]
ignore = [
"E501", # line-too-long
"INP001", # implicit-namespace-package
"PLR2004", # magic-value-comparison
"S101", # assert-used
"EM"
]

Expand Down
4 changes: 4 additions & 0 deletions src/settings/nursery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ pub fn nursery_reason(rule: &Rule) -> Option<&'static str> {
Rule::OneBlankLineBeforeClass => Some("Conflicts with PEP 257."),
Rule::MultiLineSummaryFirstLine => Some("Not part of PEP 257 and conflicts with D213."),
Rule::MultiLineSummarySecondLine => Some("Not part of PEP 257 and conflicts with D212."),
Rule::MagicValueComparison => {
Some("Comparisons to strings are generally not considered to be an anti-pattern.")
}
Rule::AssertUsed => Some("`assert` is generally not considered to be an anti-pattern."),
_ => None,
}
}

0 comments on commit 1f69610

Please sign in to comment.