Commit Graph

12775 Commits

Author SHA1 Message Date
Jonathan Plasse b232c43824
Fix an error in scripts/add_rule.py (#2497) 2023-02-02 15:58:11 -05:00
Charlie Marsh ee01e666c5
Allow list() and tuple() calls in __all__ assignments (#2499) 2023-02-02 15:45:14 -05:00
Jonathan Plasse 2b0de8ccd9
Fix clippy error (#2498) 2023-02-02 15:38:18 -05:00
Aarni Koskela 739c57b31b
Move flake8-annotations violations to rules file (#2496) 2023-02-02 15:17:54 -05:00
Aarni Koskela c3e0137f22
Move flake8-return violations to rules module (#2492) 2023-02-02 15:13:49 -05:00
Aarni Koskela 77716108af
Move flake8-simplify violations to rule modules (#2495) 2023-02-02 15:13:16 -05:00
Jonathan Plasse 335395adec
Mirror CI clippy command for pre-commit hook (#2494) 2023-02-02 14:59:19 -05:00
Aarni Koskela 65f8f1a6f7
Move pylint violations to rule modules (#2489) 2023-02-02 14:47:58 -05:00
Aarni Koskela 858af8debb
Move pyupgrade violations to rule modules (#2490) 2023-02-02 14:47:43 -05:00
Aarni Koskela 5f1bbf0b6b
Move pycodestyle violations to rule modules (#2483) 2023-02-02 14:29:23 -05:00
Aarni Koskela 40cb905ae5
Move pyflakes violations to rule modules (#2488) 2023-02-02 14:00:59 -05:00
Jonathan Plasse e89b4a5de5
Fix hardcoded url in transform_readme.py (#2487) 2023-02-02 13:59:22 -05:00
Charlie Marsh 651f6b6bce Bump Ruff version to 0.0.240 2023-02-02 12:45:23 -05:00
Charlie Marsh d3c3198b24 Fix versions in BREAKING_CHANGES.md 2023-02-02 12:45:20 -05:00
Charlie Marsh ec6054edce
Treat `if 0:` and `if False:` as type-checking blocks (#2485) 2023-02-02 12:35:59 -05:00
Charlie Marsh a0df78cb7d
Visit NamedExpr values before targets (#2484) 2023-02-02 12:21:58 -05:00
Aarni Koskela ac41c33d1f
Move flake8-blind-except violation to rule module (#2479) 2023-02-02 12:21:25 -05:00
Aarni Koskela b4b8782243
Move remaining flake8-pytest-style violations to rule modules (#2482) 2023-02-02 12:10:49 -05:00
Florian Best 8e53a4d1d3
fix: assertTrue()/assertFalse() fixer should not test for identity (#2476) 2023-02-02 11:24:35 -05:00
Charlie Marsh 668860cba3 Add more information to Pylint FAQ section 2023-02-02 11:08:17 -05:00
Aarni Koskela 038e8cfba0
Move flake8-quotes violations to rules module (#2475) 2023-02-02 10:08:12 -05:00
Aarni Koskela ebfa55cea3
Move flake8-builtins violations to rules file (#2478) 2023-02-02 10:03:09 -05:00
Aarni Koskela aa0fc0f9c2
Move flake8-bugbear violations to rule modules (#2474) 2023-02-02 09:34:26 -05:00
Aarni Koskela aa85c81280
Move flake8-comprehensions violations to rule files (#2477) 2023-02-02 09:26:50 -05:00
Charlie Marsh f5fd6f59ea Remove extraneous test file 2023-02-02 08:46:03 -05:00
Martin Fischer 540e31f5f4
Carry-over `ignore` to next config layer if `select = []` (#2467)
Resolves #2461.
2023-02-02 08:45:07 -05:00
Chris Chan 8136cc9238
Implement pylint's `too-many-statements` rule (`PLR0915`) (#2445) 2023-02-02 08:18:37 -05:00
Charlie Marsh 2c71535016 Update snapshots 2023-02-02 08:15:33 -05:00
Aarni Koskela cce8fb9882
isort: support forced_separate (#2268) 2023-02-02 08:08:02 -05:00
Maksudul Haque 9e59c99133
[`flake8-self`] Add Plugin and Rule `SLF001` (#2470) 2023-02-02 07:58:14 -05:00
Colin Delahunty b032f50775
[`pyupgrade`]: Remove outdated `sys.version_info` blocks (#2099) 2023-02-02 07:49:24 -05:00
Charlie Marsh 1c2fc38853
Use LibCST to reverse Yoda conditions (#2468)
Our existing solution was having trouble with parenthesized expressions. This actually may affect more than `SIM300`, but let's address them as they come up.

Closes #2466.
2023-02-02 00:07:43 -05:00
Charlie Marsh f16f3a4a03
Avoid removing un-selected codes when applying `--add-noqa` edits (#2465)
The downside here is that we have to leave blank `# noqa` directives intact. Otherwise, we risk removing necessary `# noqa` coverage for rules that aren't selected.

Closes #2254.
2023-02-01 22:22:31 -05:00
Charlie Marsh 30a09ec211
Respect parent noqa in --add-noqa (#2464) 2023-02-01 21:58:01 -05:00
Reid Swan ec7b25290b
feat: Add isort option lines-after-imports (#2440)
Fixes https://github.com/charliermarsh/ruff/issues/2243

Adds support for the isort option [lines_after_imports](https://pycqa.github.io/isort/docs/configuration/options.html#lines-after-imports) to insert blank lines between imports and the follow up code.
2023-02-01 21:39:45 -05:00
Charlie Marsh 68422d4ff2
Allow non-ruff.toml-named files for --config (#2463)
Previously, if you passed in a file on the command-line via `--config`, it had to be named either `pyproject.toml` or `ruff.toml` -- otherwise, we errored. I think this is too strict. `pyproject.toml` is a special name in the ecosystem, so we should require _that_; but otherwise, let's just assume it's in `ruff.toml` format.

As an alternative, we could add a `--pyproject` argument for `pyproject.toml`, and assume anything passed to `--config` is in `ruff.toml` format. But that _would_ be a breaking change and is arguably more confusing. (This isn't a breaking change, since it only loosens the CLI.)

Closes #2462.
2023-02-01 21:35:42 -05:00
Charlie Marsh 2abaffd65b
Improve consistency of backticks for plugin names (#2460) 2023-02-01 19:17:32 -05:00
Charlie Marsh 06cbf5a2ae
Add some top-level links to the README (#2458) 2023-02-01 19:10:41 -05:00
Charlie Marsh f432ce291a Add Fathom to docs 2023-02-01 18:41:24 -05:00
Charlie Marsh 1eb331143d Add Fathom to playground 2023-02-01 18:30:40 -05:00
Henry Schreiner db1b1672b8
fix: minor spacing typo in message for PTH123 (#2453) 2023-02-01 14:39:50 -05:00
Charlie Marsh 6861e59103
Only avoid PEP604 rewrites for pre-Python 3.10 code (#2449)
I moved the `self.in_annotation` guard out of the version check in #1563. But, I think that was a mistake. It was done to resolve #1560, but the fix in that case _should've_ been to set a different Python version.

Closes #2447.
2023-02-01 13:03:51 -05:00
Charlie Marsh 778c644ee3
Trigger, but don't fix, SIM rules if comments are present (#2450) 2023-02-01 12:56:02 -05:00
Martin Fischer e66a6b6d05 refactor: Define ruff_dev::ROOT_DIR 2023-02-01 09:17:53 -05:00
Martin Fischer faea478ca5 fix: failing snapshot test on Windows 2023-02-01 09:17:53 -05:00
Martin Fischer 39b5fa0e24 refactor: Make test_path prefix the fixture path 2023-02-01 09:17:53 -05:00
Martin Fischer df413d1ece refactor: Introduce test_resource_path helper 2023-02-01 09:17:53 -05:00
Martin Fischer cfd0693ae5 refactor: Document internal test_path function 2023-02-01 09:17:53 -05:00
Martin Fischer 56ad160c05 refactor: Move test_path helper to new test module 2023-02-01 09:17:53 -05:00
Florian Best 9d8c6ba671
more builtin name checks when autofixing (#2430) 2023-02-01 08:16:47 -05:00