Charlie Marsh
0ead9a16ac
Bump version to 0.0.278 ( #5714 )
2023-07-12 12:39:56 -04:00
Simon Brugman
87ca6171cf
docs: add user ( #5563 )
...
## Summary
Adding two repositories at ING Bank using ruff. Demonstrates
corporate/industry adoption, e.g. similar to AstraZeneca.
## Test Plan
Note that the tests failing seems unrelated.
2023-07-06 15:55:27 +00:00
Kar Petrosyan
25981420c4
Add httpx into the `Who's Using Ruff?` section ( #5560 )
2023-07-06 13:52:28 +00:00
Charlie Marsh
ea270da289
Move some MkDocs responsibilities around ( #5542 )
...
## Summary
Note that I've also changed from `mkdocs serve` to `mkdocs serve -f
mkdocs.generated.yml` to be clearer that this is a generated file.
2023-07-05 22:06:01 +00:00
Charlie Marsh
0726dc25c2
Add some additional users to the README ( #5522 )
2023-07-05 02:09:50 +00:00
Charlie Marsh
324455f580
Bump version to 0.0.277 ( #5515 )
2023-07-04 17:31:32 -04:00
Charlie Marsh
3992c47c00
Bump version to 0.0.276 ( #5488 )
2023-07-03 18:02:49 +00:00
Charlie Marsh
1ed227a1e0
Port Pyright's import resolver to Rust ( #5381 )
...
## Summary
This PR contains the first step towards enabling robust first-party,
third-party, and standard library import resolution in Ruff (including
support for `typeshed`, stub files, native modules, etc.) by porting
Pyright's import resolver to Rust.
The strategy taken here was to start with a more-or-less direct port of
the Pyright's TypeScript resolver. The code is intentionally similar,
and the test suite is effectively a superset of Pyright's test suite for
its own resolver. Due to the nature of the port, the code is very, very
non-idiomatic for Rust. The code is also entirely unused outside of the
test suite, and no effort has been made to integrate it with the rest of
the codebase.
Future work will include:
- Refactoring the code (now that it works) to match Rust and Ruff
idioms.
- Further testing, in practice, to ensure that the resolver can resolve
imports in a complex project, when provided with a virtual environment
path.
- Caching, to minimize filesystem lookups and redundant resolutions.
- Integration into Ruff itself (use Ruff's existing settings, find rules
that can make use of robust resolution, etc.)
2023-06-27 16:15:07 +00:00
trag1c
e8ebe0a425
Update docs to match updated logo and color palette ( #5283 )
...

## Summary
Supersedes #5277 , includes redesigned dark mode.
## Test Plan
* `python scripts/generate_mkdocs.py`
* `mkdocs serve`
2023-06-22 11:19:34 -04:00
Charlie Marsh
1c0a3a467f
Bump version to 0.0.275 ( #5276 )
2023-06-21 21:53:37 -04:00
Charlie Marsh
e0339b538b
Bump version to 0.0.274 ( #5230 )
2023-06-20 22:12:32 -04:00
Charlie Marsh
fde5dbc9aa
Bump version to 0.0.273 ( #5218 )
2023-06-20 14:37:28 -04:00
Ryan Yang
ab3c02342b
Implement copyright notice detection ( #4701 )
...
## Summary
Add copyright notice detection to enforce the presence of copyright
headers in Python files.
Configurable settings include: the relevant regular expression, the
author name, and the minimum file size, similar to
[flake8-copyright](https://github.com/savoirfairelinux/flake8-copyright ).
Closes https://github.com/charliermarsh/ruff/issues/3579
---------
Signed-off-by: ryan <ryang@waabi.ai>
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2023-06-11 02:17:58 +00:00
qdegraaf
2bb32ee943
[`flake8-slots`] Add plugin, add `SLOT000`, `SLOT001` and `SLOT002` ( #4909 )
2023-06-09 04:14:16 +00:00
Dhruv Manilawala
07cc4bcb0f
Update links to point to Astral org ( #4949 )
2023-06-08 11:43:40 -04:00
Charlie Marsh
5235977abc
Bump version to 0.0.272 ( #4948 )
2023-06-08 02:17:29 +00:00
Charlie Marsh
2b5fb70482
Bump version to 0.0.271 ( #4890 )
2023-06-06 15:11:48 -04:00
Jonathan Plasse
f7c2d25205
Remove enumerated plugins in rules page ( #4715 )
2023-05-29 22:20:41 +00:00
Julian LaNeve
68db74b3c5
Add AIR001: task variable name should be same as task_id arg ( #4687 )
2023-05-29 03:25:06 +00:00
Julian LaNeve
5756829344
markdownlint: enforce 100 char max length ( #4698 )
2023-05-28 22:45:56 -04:00
Charlie Marsh
f4572fe40b
Bump version to 0.0.270 ( #4637 )
2023-05-24 16:34:29 +00:00
Charlie Marsh
f22c269ccf
Point LSP, VS Code, and pre-commut URLs to Astral org ( #4562 )
2023-05-21 15:27:35 -04:00
Jacob Coffee
6db05d8cc6
Starlite -> Litestar ( #4554 )
2023-05-21 09:55:26 -04:00
Charlie Marsh
d4c0a41b00
Bump version to 0.0.269 ( #4506 )
2023-05-18 19:45:20 +00:00
Charlie Marsh
8702b5a40a
Bump version to 0.0.268 ( #4501 )
2023-05-18 15:35:46 -04:00
James Lamb
140e0acf54
Add LightGBM to user list ( #4446 )
2023-05-16 04:04:37 +00:00
qdegraaf
8ba9eb83af
Implement `flake8-async` plugin ( #4432 )
2023-05-15 09:15:28 -04:00
Tyler Yep
01b372a75c
Implement `flake8-future-annotations` FA100 ( #3979 )
2023-05-14 03:00:06 +00:00
Evan Rittenhouse
2f53781a77
Implement `flake8_todos` ( #3921 )
2023-05-13 14:19:06 +00:00
Charlie Marsh
e6bb5cddcf
Add Astral badge to the repo ( #4401 )
2023-05-12 19:27:38 +00:00
Charlie Marsh
dcedd5cd9d
Bump version to 0.0.267 ( #4400 )
2023-05-12 19:04:56 +00:00
Charlie Marsh
a6176d2c70
Add PyTorch to user list ( #4393 )
2023-05-12 18:02:13 +00:00
OMEGA_RAZER
1d165f7e9d
Add linting badge that can be used to display usage ( #3938 )
2023-05-12 17:58:29 +00:00
Charlie Marsh
e96092291d
Update Ruff badge ( #4392 )
2023-05-12 13:42:33 -04:00
Charlie Marsh
67076b2dcb
Bump version to 0.0.266 ( #4391 )
2023-05-12 13:11:03 -04:00
Charlie Marsh
865205d992
Implement pygrep-hook's Mock-mistake diagnostic ( #4366 )
2023-05-11 03:26:29 +00:00
Charlie Marsh
f23851130a
Add `flynt` to documentation ( #4295 )
2023-05-09 00:52:41 +00:00
Jerome Leclanche
5ac2c7d293
Add .git-rewrite folder to default ignored folder paths ( #4261 )
2023-05-06 22:40:38 -04:00
Charlie Marsh
11e1380df4
Bump version to 0.0.265 ( #4248 )
2023-05-05 13:16:05 -04:00
Charlie Marsh
8cb76f85eb
Bump version to 0.0.264 ( #4179 )
2023-05-01 23:33:38 -07:00
Charlie Marsh
fd7ccb4c9e
Bump version to 0.0.263 ( #4086 )
2023-04-24 23:32:29 -06:00
Zanie Adkins
4d3a1e0581
Add `PrefectHQ/prefect` to list of ruff users ( #4084 )
2023-04-24 17:49:12 -06:00
Bartosz Sokorski
9e5f348a17
Add Poetry to the list of projects using Ruff ( #4085 )
2023-04-24 17:48:35 -06:00
Jacob Coffee
cb762f4cad
Add Astral announcement to README ( #4010 )
2023-04-19 20:28:45 +00:00
Charlie Marsh
25a6bfa9ee
Bump version to 0.0.262 ( #4032 )
2023-04-19 15:49:28 -04:00
Andrei Grazhdankov
6c3e4ef441
Add Robyn to user list ( #4008 )
2023-04-18 09:51:20 -04:00
Justin Chu
484b572e6b
Add ONNX Runtime to user list ( #3982 )
2023-04-16 18:21:46 -04:00
Charlie Marsh
81805a45f0
Add some additional users ( #3975 )
2023-04-14 12:41:22 -04:00
Charlie Marsh
71e807b3be
Add Prefect to user list ( #3949 )
2023-04-12 12:09:36 -04:00
Edgar R. M
ffdd0de522
Add Meltano to users ( #3883 )
2023-04-04 23:05:53 -04:00
Charlie Marsh
5370968839
Add some additional users and alphabetize ( #3882 )
2023-04-05 02:40:02 +00:00
Charlie Marsh
255b094b33
Bump version to 0.0.261 ( #3881 )
2023-04-04 22:31:01 -04:00
Charlie Marsh
251340a246
Add LangChain and LlamaIndex ( #3879 )
2023-04-04 19:36:31 +00:00
brucearctor
e006b922a6
Add documentation for `ruff-action` (GitHub Action!) ( #3857 )
2023-04-03 23:47:26 +00:00
Nicolas Vuillamy
b52cb93e58
Add thank you in README.md + usage in MegaLinter ( #3848 )
2023-04-03 15:45:25 +00:00
Madison Swain-Bowden
a142d71e0b
Add Openverse to users of ruff in README ( #3806 )
2023-03-30 09:14:47 -04:00
Charlie Marsh
9d3b8eb67b
Bump version to v0.0.260 ( #3799 )
2023-03-29 14:51:50 -04:00
Charlie Marsh
5977862a60
Enumerate all codes in default configuration example ( #3790 )
2023-03-28 23:36:22 +00:00
Leiser Fernández Gallo
224e85c6d7
Implement `flake8-gettext` ( #3785 )
2023-03-28 23:32:02 +00:00
Charlie Marsh
c3917eab38
Revert "Implement `flake8-i18n` ( #3741 )" ( #3765 )
2023-03-27 21:14:38 +00:00
Leiser Fernández Gallo
5cb120327c
Implement `flake8-i18n` ( #3741 )
2023-03-27 18:03:39 +00:00
Charlie Marsh
f58345dee3
Bump version to v0.0.259 ( #3691 )
2023-03-23 14:52:42 -04:00
Charlie Marsh
615887a7fe
Bump version to v0.0.258 ( #3671 )
2023-03-22 15:02:57 -04:00
Charlie Marsh
1e45b13958
Remove linked issue from `flake8-django` ( #3664 )
2023-03-22 03:26:22 +00:00
James Greenhill
b06ca25421
Add PostHog to users of Ruff in README ( #3641 )
2023-03-21 10:05:35 -04:00
Charlie Marsh
621e4353e3
Re-add the list of supported plugins to the README ( #3592 )
2023-03-17 23:33:37 -04:00
Charlie Marsh
0c4926ff7b
Bump version to v0.0.257 ( #3591 )
2023-03-17 22:34:10 -04:00
Charlie Marsh
667130a4c3
Add some additional users to the users list ( #3565 )
2023-03-16 23:32:17 +00:00
Nyakku Shigure
72febf98b7
add PaddlePaddle to `Who's Using Ruff?` ( #3562 )
2023-03-16 14:20:11 -04:00
Charlie Marsh
12dfd57211
Bump version to v0.0.256 ( #3531 )
2023-03-14 22:52:21 -04:00
Charlie Marsh
aa97a092bd
Bump version to v0.0.255 ( #3485 )
2023-03-13 14:06:51 -04:00
Charlie Marsh
cd192eddf9
Add some new users to the README ( #3471 )
2023-03-13 00:08:58 +00:00
Charlie Marsh
bbbc44336e
Bump version to 0.0.254 ( #3331 )
2023-03-03 19:11:07 -05:00
Charlie Marsh
8066607ea3
Add a preliminary tutorial ( #3281 )
2023-02-28 20:31:27 +00:00
Jonathan Plasse
d285f5c90a
Run automatically format code blocks with Black ( #3191 )
2023-02-27 10:14:05 -05:00
Charlie Marsh
386ca7c9a1
Bump version to 0.0.253 ( #3245 )
2023-02-26 23:10:04 -05:00
Charlie Marsh
36d134fd41
Bump lint rule count to 500+ ( #3240 )
2023-02-26 18:10:09 -05:00
Charlie Marsh
bbc55cdb04
Allow ruff.toml file to be dot-prefixed (as .ruff.toml) ( #3221 )
2023-02-24 23:14:26 +00:00
Jonathan Plasse
6e54cd8233
Normalize relative markdown links ( #3190 )
2023-02-23 16:24:31 -05:00
Charlie Marsh
74e18b6cff
Split up some docs sections ( #3154 )
2023-02-22 20:18:10 -05:00
Charlie Marsh
b9bfb81e36
Move configuration out of README and into permanent docs ( #3150 )
2023-02-22 19:25:53 -05:00
Charlie Marsh
dbdfdeb0e1
Add pre-commit note to docs ( #3145 )
2023-02-22 17:22:47 -05:00
Charlie Marsh
1c41789c2a
Bump version to 0.0.252 ( #3142 )
2023-02-22 14:50:14 -05:00
Marijn Valk
7d55b417f7
add delta-rs to list of users ( #3133 )
2023-02-22 13:07:58 -05:00
Charlie Marsh
fd638a2e54
Bump version to 0.0.251 ( #3105 )
2023-02-21 18:13:59 -05:00
Charlie Marsh
06e426f509
Bump version to 0.0.250 ( #3095 )
2023-02-21 15:20:46 -05:00
Charlie Marsh
37df07d2e0
Re-add compatibility to README ( #3091 )
2023-02-21 18:57:47 +00:00
Charlie Marsh
4cfa350112
Bump version to 0.0.249 ( #3063 )
2023-02-20 13:11:29 -05:00
Matthew Lloyd
3ad257cfea
Add PDM to "Who's Using Ruff?" ( #3048 )
2023-02-20 03:58:22 +00:00
Charlie Marsh
41e77bb01d
Add some additional users to "Who's Using Ruff?" ( #3035 )
2023-02-19 16:30:01 +00:00
Charlie Marsh
2ff3dd5fbe
Bump version to 0.0.248 ( #3034 )
2023-02-19 16:21:30 +00:00
Simon Brugman
cfa6883431
docs(readme): add Diffusers ( #3029 )
2023-02-19 07:10:02 -05:00
Charlie Marsh
b9fef7cef7
Unlink flake8-bugbear in summary ( #2997 )
2023-02-17 15:58:33 -05:00
Charlie Marsh
34294ccc00
Deduplicate user list ( #2996 )
2023-02-17 20:07:42 +00:00
Charlie Marsh
6a369e4a30
Remove via from sentence in README ( #2987 )
2023-02-17 13:49:09 +00:00
Charlie Marsh
6f97e2c457
Split list of users into top-level and dedicated section ( #2986 )
2023-02-17 13:36:32 +00:00
Charlie Marsh
cd1f57b713
Move FAQ into MkDocs ( #2984 )
2023-02-17 13:15:53 +00:00
Charlie Marsh
a0912deb2b
Move editor integrations into MkDocs ( #2983 )
2023-02-17 13:12:20 +00:00
Charlie Marsh
50ee14a418
Fix references to specific settings in README.md ( #2982 )
2023-02-17 13:07:37 +00:00
Martin Fischer
f5adbbebc5
Fix table of contents enumeration
2023-02-17 07:55:50 -05:00
Martin Fischer
c88e05dc1b
Merge Reference README section into Configuration section
2023-02-17 07:55:50 -05:00
Martin Fischer
d658bfc024
Remove options from README
2023-02-17 07:55:50 -05:00
Martin Fischer
b0d72c47b4
refactor: Move Top-level heading into ruff_dev
2023-02-17 07:55:50 -05:00
Martin Fischer
8195873cdf
Remove rule tables from README
2023-02-17 07:55:50 -05:00
Martin Fischer
bf8108469f
Remove auto-generated table of contents
2023-02-17 07:55:50 -05:00
Martin Fischer
a2277cfeba
refactor: Move fix symbol legend into ruff_dev
2023-02-17 07:55:50 -05:00
Simon Brugman
34664a0ca0
[`numpy`] numpy-legacy-random ( #2960 )
...
The new `Generator` in NumPy uses bits provided by [PCG64](https://numpy.org/doc/stable/reference/random/bit_generators/pcg64.html#numpy.random.PCG64 ) which has better statistical properties than the legacy [MT19937](https://numpy.org/doc/stable/reference/random/bit_generators/mt19937.html#numpy.random.MT19937 ) used in [RandomState](https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState ). Global random functions can also be problematic with parallel processing.
This rule is probably quite useful for data scientists (perhaps in combination with `nbqa`)
References:
- [Legacy Random Generation](https://numpy.org/doc/stable/reference/random/legacy.html#legacy )
- [Random Sampling](https://numpy.org/doc/stable/reference/random/index.html#random-quick-start )
- [Using PyTorch + NumPy? You're making a mistake.](https://tanelp.github.io/posts/a-bug-that-plagues-thousands-of-open-source-ml-projects/ )
2023-02-17 02:06:30 +00:00
Charlie Marsh
e081455b06
Add support for file-scoped `noqa` directives ( #2978 )
...
# Summary
This allows users to do things like:
```py
# ruff: noqa: F401
```
...to ignore all `F401` directives in a file. It's equivalent to `per-file-ignores`, but allows users to specify the behavior inline.
Note that Flake8 does _not_ support this, so we _don't_ respect `# flake8: noqa: F401`. (Flake8 treats that as equivalent to `# flake8: noqa`, so ignores _all_ errors in the file. I think all of [these usages](https://cs.github.com/?scopeName=All+repos&scope=&q=%22%23+flake8%3A+noqa%3A+%22 ) are probably mistakes!)
A couple notes on the details:
- If a user has `# ruff: noqa: F401` in the file, but also `# noqa: F401` on a line that would legitimately trigger an `F401` violation, we _do_ mark that as "unused" for `RUF100` purposes. This may be the wrong choice. The `noqa` is legitimately unused, but it's also not "wrong". It's just redundant.
- If a user has `# ruff: noqa: F401`, and runs `--add-noqa`, we _won't_ add `# noqa: F401` to any lines (which seems like the obvious right choice to me).
Closes #1054 (which has some extra pieces that I'll carve out into a separate issue).
Closes #2446 .
2023-02-17 01:59:01 +00:00
Manuel Jacob
879512742f
Skip .pytype directory by default. ( #2966 )
...
Pytype stores .pyi files in .pytype that ruff shouldn’t check or touch.
2023-02-16 14:38:08 -05:00
Florian Best
a919041dda
feat(isort): Implement isort.force_to_top ( #2877 )
2023-02-16 19:01:59 +00:00
Simon Brugman
cc30738148
Implement `flake8-module-naming` ( #2855 )
...
- Implement N999 (following flake8-module-naming) in pep8_naming
- Refactor pep8_naming: split rules.rs into file per rule
- Documentation for majority of the violations
Closes https://github.com/charliermarsh/ruff/issues/2734
2023-02-16 04:20:33 +00:00
Simon Brugman
1bc37110d4
[`flake8-pytest-style`] autofix for composite-assertion (PT018) ( #2732 )
2023-02-16 00:36:07 +00:00
Lunarmagpie
28acdb76cf
Add support for `ensure_future` for RUF006 ( #2943 )
2023-02-15 23:18:11 +00:00
Martin Fischer
7b09972c97
Merge convert-loop-to-any & convert-loop-to-all to reimplemented-builtin
2023-02-15 16:24:31 -05:00
Charlie Marsh
f8d46d09ef
Implement `asyncio-dangling-task` to track `asyncio.create_task` calls ( #2935 )
...
This rule guards against `asyncio.create_task` usages of the form:
```py
asyncio.create_task(coordinator.ws_connect()) # Error
```
...which can lead to unexpected bugs due to the lack of a strong reference to the created task. See Will McGugan's blog post for reference: https://textual.textualize.io/blog/2023/02/11/the-heisenbug-lurking-in-your-async-code/ .
Note that we can't detect issues like:
```py
def f():
# Stored as `task`, but never used...
task = asyncio.create_task(coordinator.ws_connect())
```
So that would be a false negative. But this catches the common case of failing to assign the task in any way.
Closes #2809 .
2023-02-15 15:19:03 -05:00
Martin Fischer
294cd95c54
Update clap to fix `ruff check --help` description
...
My two clap bug fixes[1][2] have been merged and released
(see the change in README.md).
[1]: https://github.com/clap-rs/clap/pull/4710
[2]: https://github.com/clap-rs/clap/pull/4712
2023-02-15 13:30:06 -05:00
Charlie Marsh
d8e709648d
Add Transformers to README ( #2933 )
2023-02-15 17:09:50 +00:00
Charlie Marsh
39fdc71b49
Bump version to 0.0.247 ( #2932 )
2023-02-15 12:06:58 -05:00
Sawbez
9168a12679
[docs] `flake8-self` Private member access docs ( #2912 )
2023-02-15 15:42:38 +00:00
Martin Fischer
70e378b736
Implement shell autocompletion for rule codes
...
For example:
$ ruff check --select=EM<Tab>
EM -- flake8-errmsg
EM10 EM1 --
EM101 -- raw-string-in-exception
EM102 -- f-string-in-exception
EM103 -- dot-format-in-exception
(You will need to enable autocompletion as described
in the Autocompletion section in the README.)
Fixes #2808 .
(The --help help change in the README is due to a clap bug,
for which I already submitted a fix:
https://github.com/clap-rs/clap/pull/4710 .)
2023-02-15 08:09:34 -05:00
Charlie Marsh
23d9309111
Remove JetBrains webinar badge ( #2910 )
2023-02-15 03:28:12 +00:00
Charlie Marsh
746e1d3436
Add contributors to acknowledgements ( #2909 )
2023-02-15 03:15:38 +00:00
Charlie Marsh
016ff01a04
Add an FAQ question around Python version support ( #2908 )
2023-02-15 03:11:44 +00:00
Charlie Marsh
298498e934
Add an Acknowledgements section to the README ( #2907 )
2023-02-15 00:25:07 +00:00
Simon Brugman
ac028cd9f8
[`numpy`] deprecated type aliases ( #2810 )
...
Closes https://github.com/charliermarsh/ruff/issues/2455
Used `NPY` as prefix code as agreed in the issue.
2023-02-14 23:45:12 +00:00
Edgar R. M
c0eb5c28d1
[docs] Add docs for `flake8-errmsg` ( #2888 )
2023-02-14 23:21:34 +00:00
Simon Legner
2d95912699
docs: fix `ruff generate-shell-completion` ( #2904 )
2023-02-14 22:38:29 +00:00
Anders Kaseorg
2e41301520
Switch some quotes to backticks in errors ( #2889 )
...
Improves consistency with the style decision in #723 , I think.
2023-02-14 22:24:41 +00:00
Chris May
08e0b76587
Add headers to configutation options ( #2896 )
...
This completes the word from the discussion in #2643 , adding headers to clarify the `pyproject.toml` and `ruff.toml` sections.
2023-02-14 13:45:59 -05:00
Sawbez
53e810ed3e
[docs] Add docs for the entirety of `flake8-builtins` ( #2840 )
2023-02-14 04:30:30 +00:00
Charlie Marsh
6d1adc85fc
Remove autofix for prefer-type-error ( #2880 )
2023-02-14 02:26:22 +00:00
Martin Fischer
8120d7c974
Change rule page links in README from GitHub to beta.ruff.rs
2023-02-13 19:34:06 -05:00
Anders Kaseorg
b9d075c252
Alphabetize flake8-raise and flake8-self in documentation ( #2871 )
2023-02-13 18:03:09 -05:00
Charlie Marsh
3c03e2cb2e
Rename flake8-django rules to match convention ( #2861 )
2023-02-13 15:30:04 +00:00
Charlie Marsh
6128346b08
Re-show --target-version on CLI interface ( #2859 )
2023-02-13 15:04:11 +00:00
Ville Skyttä
d1cf0ee52b
Remove "blanket" from RUF100 README message ( #2844 )
2023-02-13 14:43:35 +00:00
Charlie Marsh
63f3d5e610
Update pre-commit instructions ( #2838 )
2023-02-13 00:06:40 +00:00
Charlie Marsh
83f6e52c92
Bump version to 0.0.246 ( #2834 )
2023-02-12 23:39:51 +00:00
Charlie Marsh
8b35b052b8
Avoid duplicates in if-with-same-arms ( #2827 )
2023-02-12 22:22:19 +00:00
Colin Delahunty
1f07ad6e61
[`flake8-simplify`]: combine-if-conditions ( #2823 )
2023-02-12 21:00:32 +00:00
Charlie Marsh
1666e8ba1e
Add a `--show-fixes` flag to include applied fixes in output ( #2707 )
2023-02-12 20:48:01 +00:00
Zeddicus414
26f39cac2f
Add PD002 use-of-inplace-argument documentation ( #2799 )
2023-02-12 18:10:34 +00:00
Simon Brugman
02897a141b
[`flake8-tidy-imports`] add documentation for `banned-api` ( #2819 )
2023-02-12 18:09:39 +00:00
Nyakku Shigure
fc465cc2af
[`flake8-pyi`]: add rules for unrecognized platform check (PYI007, PYI008) ( #2805 )
...
Add two [flake8-pyi](https://github.com/PyCQA/flake8-pyi ) rules (Y007, Y008). ref: #848
The specifications are described in [PEP 484 - Version and platform checking](https://peps.python.org/pep-0484/#version-and-platform-checking )
The original implementation in flake8-pyi is shown below.
- Implemention: 66f28a4407/pyi.py (L1429-L1443)
- Tests: 66f28a4407/tests/sysplatform.pyi
2023-02-12 18:02:38 +00:00
Karol Onyśko
6769a5bce7
Implement flake8-django plugin rules ( #2586 )
2023-02-12 17:47:59 +00:00
Zeddicus414
fda93c6245
Add E722 bare-except documentation ( #2796 )
2023-02-12 16:51:32 +00:00
Simon Brugman
1d4422f004
[`flake8-comprehensions`] improve autofix for C401, C402 and C417 ( #2806 )
2023-02-12 16:03:37 +00:00
Simon Brugman
2dccb7611a
[`flake8-comprehensions`] bugfix for C413 autofix ( #2804 )
2023-02-12 15:56:07 +00:00
Simon Brugman
0123425be1
[`flake8-comprehensions`] autofix C414 and C417 + bugfix ( #2693 )
...
Closes https://github.com/charliermarsh/ruff/issues/2262 and closes https://github.com/charliermarsh/ruff/issues/2423
Fixes bug where some cases generated duplicated violations (see https://github.com/charliermarsh/ruff/pull/2732#issuecomment-1426397842 )
2023-02-12 05:20:42 +00:00
Martin Fischer
0e4d5eeea7
Implement config subcommand
...
The synopsis is as follows.
List all top-level config keys:
$ ruff config
allowed-confusables
builtins
cache-dir
... etc.
List all config keys in a specific section:
$ ruff config mccabe
max-complexity
Describe a specific config option:
$ ruff config mccabe.max-complexity
The maximum McCabe complexity to allow before triggering `C901` errors.
Default value: 10
Type: int
Example usage:
```toml
# Flag errors (`C901`) whenever the complexity level exceeds 5.
max-complexity = 5
```
2023-02-11 23:43:09 -05:00
Charlie Marsh
d827a9156e
Add documentation on enabling autocompletion ( #2791 )
2023-02-12 02:51:50 +00:00
Charlie Marsh
418808895e
Add docs for f-string-missing-placeholders and unused-variable ( #2790 )
2023-02-12 02:48:36 +00:00
Charlie Marsh
19fc410683
Remove raw string from hardcoded-sql-expression ( #2780 )
2023-02-11 20:05:57 +00:00
Charlie Marsh
97dcb738fa
Run cargo dev generate-all
2023-02-11 12:43:48 -05:00
Michał Mrówka
77099dcd4d
implemented option lines-between-types for isort ( #2762 )
...
Fixes #2585
Add support for the isort option [lines_between_types](https://pycqa.github.io/isort/docs/configuration/options.html#lines-between-types )
2023-02-11 12:17:37 -05:00
Martin Fischer
70ff65154d
Rename function-is-too-complex to complex-structure
2023-02-11 12:05:17 -05:00
Martin Fischer
7db6a2d6d4
Rename rules containing PEP reference in name
2023-02-11 12:05:17 -05:00
Martin Fischer
42924c0d9a
Rename a bunch of pydocstyle rules
2023-02-11 12:05:17 -05:00
Martin Fischer
31d00936ee
Drop no- from no-unnecessary-* rule names
2023-02-11 12:05:17 -05:00
Martin Fischer
c3c5d9a852
Rename nested-if-statements to collapsible-if
2023-02-11 12:05:17 -05:00
Martin Fischer
7e5c19385c
Rename return-bool-condition-directly to needless-bool
2023-02-11 12:05:17 -05:00
Charlie Marsh
24faabf1f4
Bump version to 0.0.245
2023-02-10 22:15:27 -05:00
Simon Brugman
e83ed0ecba
Implement autofix for relative imports (TID252) ( #2739 )
2023-02-10 22:05:47 -05:00
Nick Pope
9f84c497f9
Adjust heading level in rule documentation ( #2749 )
2023-02-10 19:10:42 -05:00
Martin Fischer
0ec25d1514
Rename dynamically-typed-expression to any-type ( #2751 )
2023-02-10 19:02:31 -05:00
Charlie Marsh
acb70520f8
Add colored environment variables to README ( #2746 )
2023-02-10 17:06:02 -05:00
Charlie Marsh
6eb9268675
Allow named unicodes in bidirectional escape check ( #2710 )
2023-02-10 16:59:28 -05:00
Charlie Marsh
3f20f73413
Use `function_type::classify` for `yield-in-init` ( #2742 )
2023-02-10 16:19:45 -05:00
tomecki
a5e42d2f7c
pylint: E0100 yield-in-init ( #2716 )
2023-02-10 16:15:15 -05:00
Florian Best
8aab96fb9e
feat(isort): Implement known-local-folder ( #2657 )
2023-02-10 13:15:34 -05:00
Martin Fischer
ec63658250
Disallow rule names starting with avoid-*
2023-02-10 09:25:29 -05:00
Martin Fischer
1a97de0b01
Disallow rule names starting with uses-*
2023-02-10 09:25:29 -05:00
Martin Fischer
1cbe48522e
Disallow rule names ending in *-used
2023-02-10 09:25:29 -05:00
Martin Fischer
bfbde537af
Disallow rule names starting with do-not-*
2023-02-10 09:25:29 -05:00
Colin Delahunty
48daa0f0ca
[`pylint`]: bad-string-format-type ( #2572 )
2023-02-09 20:08:56 -05:00
Matt Oberle
fc628de667
Implement bandit's 'hardcoded-sql-expressions' S608 ( #2698 )
...
This is an attempt to implement `bandit` rule `B608` (renamed here `S608`).
- https://bandit.readthedocs.io/en/latest/plugins/b608_hardcoded_sql_expressions.html
The rule inspects strings constructed via `+`, `%`, `.format`, and `f""`.
- `+` and `%` via `BinOp`
- `.format` via `Call`
- `f""` via `JoinedString`
Any SQL-ish strings that use Python string formatting are flagged.
The expressions and targeted expression types for the rule come from here:
- 7104b336d3/bandit/plugins/injection_sql.py
> Related Issue: https://github.com/charliermarsh/ruff/issues/1646
2023-02-09 19:28:17 -05:00
Charlie Marsh
9e2418097c
Run cargo dev generate-all
2023-02-09 19:14:02 -05:00
Steve Dignam
67e58a024a
Add flake8-pyi with one rule ( #2682 )
...
Add basic scaffold for [flake8-pyi](https://github.com/PyCQA/flake8-pyi ) and the first rule, Y001
rel: https://github.com/charliermarsh/ruff/issues/848
2023-02-09 19:03:11 -05:00
Charlie Marsh
7d5fb0de8a
Add documentation for mccabe, isort, and flake8-annotations ( #2691 )
2023-02-09 11:56:18 -05:00
Charlie Marsh
54d1719424
Hide rule configuration settings on CLI ( #2687 )
2023-02-09 11:13:04 -05:00
Charlie Marsh
739a92e99d
Implement compound-statements (E701, E702, E703, E704) ( #2680 )
2023-02-08 22:57:39 -05:00
Charlie Marsh
5a07c9f57c
Only include rule links once in README ( #2678 )
2023-02-08 21:48:05 -05:00
Colin Delahunty
31027497c6
[`flake8-bandit`]: try-except-continue ( #2674 )
2023-02-08 21:44:01 -05:00
Charlie Marsh
dabfdf718e
Mark flake8-simplify rules as unfixable in non-fixable cases ( #2676 )
2023-02-08 21:28:28 -05:00
Charlie Marsh
ff3665a24b
Mark RUF005 as fixable
2023-02-08 18:02:33 -05:00
Charlie Marsh
125615af12
Bump version to 0.0.244
2023-02-08 17:28:59 -05:00
Charlie Marsh
6339f8e009
Use separate exit codes for fatal errors vs. lint errors ( #2670 )
2023-02-08 15:21:15 -05:00
Charlie Marsh
75fad989f4
Add `--exit-non-zero-on-fix` ( #2668 )
2023-02-08 14:27:54 -05:00
Nuno Mendes
9cd1bf9c03
doc: add documentation for TRY002 ( #2655 )
2023-02-08 11:04:31 -05:00
Florian Best
3862dc2626
docs: use new command line arguments ( #2658 )
2023-02-08 10:36:53 -05:00
Charlie Marsh
2a0927a5ef
Update Discord link
2023-02-08 04:36:59 -05:00
Charlie Marsh
4c35feaa18
Add documentation for eradicate, flake8-import-conventions, and flake8-no-pep420 ( #2652 )
2023-02-07 22:19:21 -05:00
Charlie Marsh
8261d0656e
Disable autofix for flake8-print rules ( #2651 )
2023-02-07 21:38:57 -05:00
Charlie Marsh
a9aa96b24f
Add documentation for flake8-quotes rules ( #2650 )
2023-02-07 21:20:24 -05:00
Charlie Marsh
271e4fda8c
Create per-rule pages and link from README ( #2644 )
2023-02-07 18:15:05 -05:00
Charlie Marsh
be08384fb0
Run cargo dev generate-all
2023-02-07 16:48:06 -05:00
Aarni Koskela
2bc16eb4e3
flake8-annotations: add ignore-fully-untyped ( #2128 )
...
This PR adds a configuration option to inhibit ANN* violations for functions that have no other annotations either, for easier gradual typing of a large codebase.
2023-02-07 11:35:57 -05:00
Colin Delahunty
7647cafe12
[`pylint`]: bidirectional-unicode ( #2589 )
2023-02-06 22:49:18 -05:00
Charlie Marsh
bf718fdf26
Bump Ruff version to 0.0.243
2023-02-06 21:22:54 -05:00
Steve Dignam
3b3466f6da
Add flake8-pie single_starts_ends_with ( #2616 )
2023-02-06 21:22:32 -05:00
Charlie Marsh
e59b75d31b
Bump version to 0.0.242
2023-02-06 16:25:29 -05:00
Charlie Marsh
610f150dd1
Remove autofix from bad-str-strip-call; add suggestions instead ( #2610 )
2023-02-06 16:25:20 -05:00
Colin Delahunty
6272293180
[`pylint`]: bad-str-strip-call (With Autofix) ( #2570 )
2023-02-06 15:34:37 -05:00
Charlie Marsh
7fa5ce8b63
Automatically remove empty type-checking blocks ( #2598 )
2023-02-05 18:46:07 -05:00
Charlie Marsh
f6864a96f6
Enable autofix for unnecessary-paren-on-raise-exception ( #2596 )
2023-02-05 18:19:27 -05:00
Colin Delahunty
1e1dc3a7ed
[`pyupgrade`]: Removes quotes from annotations ( #2431 )
2023-02-05 09:43:09 -05:00
Chris Chan
ced55084db
Implement pylint's `too-many-return-statements` rule (`PLR0911`) ( #2564 )
2023-02-04 16:56:36 -05:00
Chris Chan
f8f36a7ee0
Implement pylint's `too-many-branches` rule (`PLR0912`) ( #2550 )
2023-02-04 16:38:03 -05:00
Charlie Marsh
7d4f0a8320
Bump Ruff version to 0.0.241
2023-02-03 19:25:12 -05:00
Pierre Sassoulas
e6316b185e
[pylint] Rename 'too-many-args' to 'too-many-arguments'
...
The actual name
2023-02-03 18:58:32 -05:00
Pierre Sassoulas
a2183be96e
[pylint] Rename constant-comparison to comparison-of-constant
...
The actual name
2023-02-03 18:58:32 -05:00
Pierre Sassoulas
df39a95925
[pylint] Rename use-sys-exit to consider-using-sys-exit
...
The actual name
2023-02-03 18:58:32 -05:00
Charlie Marsh
b9c1a3c5c1
Move benchmarking instructions to CONTRIBUTING.md ( #2554 )
2023-02-03 14:53:53 -05:00
Aarni Koskela
38addbe50d
Soft-deprecate update_check ( #2530 )
2023-02-03 11:33:38 -05:00
Jacob Coffee
04ef674195
Add Jetbrains Webinar Event (Temporary) ( #2516 )
2023-02-03 08:08:27 -05:00
Florian Best
7e9b9cc7b3
feat: add autofix for PLR0402 ( #2504 )
2023-02-02 23:25:16 -05:00
Jonathan Plasse
bdcab87d2f
Add `markdownlint` and dev Ruff to `pre-commit` ( #2303 )
2023-02-02 16:29:07 -05:00
Charlie Marsh
651f6b6bce
Bump Ruff version to 0.0.240
2023-02-02 12:45:23 -05:00
Charlie Marsh
668860cba3
Add more information to Pylint FAQ section
2023-02-02 11:08:17 -05:00
Chris Chan
8136cc9238
Implement pylint's `too-many-statements` rule (`PLR0915`) ( #2445 )
2023-02-02 08:18:37 -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
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
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
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
c15595325c
Bump version to 0.0.239
2023-01-31 19:06:22 -05:00
Maksudul Haque
7c1a6bce7b
[`flake8-raise`] Add Plugin and `RSE102` Rule ( #2354 )
2023-01-31 18:09:40 -05:00
Thomas M Kehrenberg
c3a3195922
Fix option name "max-args" in the documentation ( #2401 )
2023-01-31 12:30:05 -05:00
Hassan Kibirige
da4618d77b
For neovim:null_ls use ruff builtin for formatting ( #2386 )
...
null_ls picked up the recommended snippet in README.md and ruff formatting now a builtin.
Ref:
1. 482990e391
2. 7b2b28e207/doc/BUILTINS.md (ruff-1)
2023-01-31 07:22:14 -05:00
Erik Welch
adc134ced0
Fix typos: s/scripy/scipy/g ( #2380 )
2023-01-31 07:17:18 -05:00
Charlie Marsh
00495e8620
Use human-readable types for documentation values ( #2375 )
2023-01-30 23:05:28 -05:00
Colin Delahunty
ad8693e3de
[`pyupgrade`] Implement import-replacement rule (`UP035`) ( #2049 )
2023-01-30 19:58:28 -05:00
Charlie Marsh
69e20c4554
Minor improvements to the docs ( #2371 )
2023-01-30 19:06:05 -05:00
Charlie Marsh
b5816634b3
Add a link to MkDocs ( #2370 )
2023-01-30 19:00:57 -05:00
Charlie Marsh
1cbd929a0a
Bump version to 0.0.238
2023-01-30 16:44:19 -05:00
Charlie Marsh
5f07e70762
Recommend disabling `explicit-string-concatenation` ( #2366 )
...
If `allow-multiline = false` is set, then if the user enables `explicit-string-concatenation` (`ISC003`), there's no way for them to create valid multiline strings. This PR notes that they should turn off `ISC003`.
Closes #2362 .
2023-01-30 16:42:30 -05:00
Charlie Marsh
4589daa0bd
Ignore magic comparisons to bytes by default ( #2365 )
2023-01-30 16:31:48 -05:00
Charlie Marsh
ea0274d22c
Use bold for deprecated
2023-01-30 16:28:21 -05:00
Charlie Marsh
ca1129ad27
Document new rule config resolution
2023-01-30 16:26:59 -05:00
Martin Fischer
ba457c21b5
Improve rule config resolution
...
Ruff allows rules to be enabled with `select` and disabled with
`ignore`, where the more specific rule selector takes precedence,
for example:
`--select ALL --ignore E501` selects all rules except E501
`--ignore ALL --select E501` selects only E501
(If both selectors have the same specificity ignore selectors
take precedence.)
Ruff always had two quirks:
* If `pyproject.toml` specified `ignore = ["E501"]` then you could
previously not override that with `--select E501` on the command-line
(since the resolution didn't take into account that the select was
specified after the ignore).
* If `pyproject.toml` specified `select = ["E501"]` then you could
previously not override that with `--ignore E` on the command-line
(since the resolution didn't take into account that the ignore was
specified after the select).
Since d067efe265 (#1245 )
`extend-select` and `extend-ignore` always override
`select` and `ignore` and are applied iteratively in pairs,
which introduced another quirk:
* If some `pyproject.toml` file specified `extend-select`
or `extend-ignore`, `select` and `ignore` became pretty much
unreliable after that with no way of resetting that.
This commit fixes all of these quirks by making later configuration
sources take precedence over earlier configuration sources.
While this is a breaking change, we expect most ruff configuration
files to not rely on the previous unintutive behavior.
2023-01-30 16:26:59 -05:00
Charlie Marsh
01fedec1e7
Add SciPy and meson-python ( #2363 )
2023-01-30 15:34:19 -05:00
Martin Fischer
ef20692149
fix: clap usage for CLI help generation in the README ( #2358 )
2023-01-30 13:14:40 -05:00
Simon Brugman
50046fbed3
Extend conventional imports defaults to include TensorFlow et al ( #2353 )
...
extend conventional imports
Based on configuration from Visual Studio for Python
(https://code.visualstudio.com/docs/python/editing#_quick-fixes )
2023-01-30 11:04:19 -05:00
Akhil
8e5a944ce1
Implement Pylint's `too-many-arguments` rule (`PLR0913`) ( #2308 )
2023-01-30 07:34:37 -05:00
Simon Brugman
2ef28f217c
pandas vet autofix for PD002 and general refactor
2023-01-29 22:30:37 -05:00
Martin Fischer
d76a47d366
Implement `ruff linter` subcommand
...
The subcommand lists all supported upstream linters and their prefixes:
$ ruff linter
F Pyflakes
E/W pycodestyle
C90 mccabe
I isort
N pep8-naming
D pydocstyle
UP pyupgrade
YTT flake8-2020
# etc...
Just like with the `rule` subcommand `--format json` is supported:
$ ruff linter --format json
[
{
"prefix": "F",
"name": "Pyflakes"
},
{
"prefix": "",
"name": "pycodestyle",
"categories": [
{
"prefix": "E",
"name": "Error"
},
{
"prefix": "W",
"name": "Warning"
}
]
},
# etc...
2023-01-29 21:32:37 -05:00
Charlie Marsh
3ee6a90905
Remove remove-six-compat (UP016) ( #2332 )
2023-01-29 21:19:59 -05:00