Matthieu Devlin
8fde63b323
[pylint] Implement E1205 and E106 ( #3084 )
2023-02-21 22:53:11 -05:00
Matthew Lloyd
97338e4cd6
[pylint] redefined-loop-name (W2901) ( #3022 )
...
Slightly broadens W2901 to cover `with` statements too.
Closes #2972 .
2023-02-22 03:23:47 +00:00
Carlos Gonçalves
6eb014b3b2
feat(B032): add b032 flake8_bugbear ( #3085 )
2023-02-21 19:53:29 +00:00
Carlos Gonçalves
b657468346
feat(B029): Add B029 from flake8-bugbear ( #3068 )
2023-02-20 15:57:13 -05:00
Colin Delahunty
9545958ad8
[flake8-simplify]: Implement manual-dict-lookup ( #2767 )
2023-02-20 20:00:59 +00:00
Colin Delahunty
41faa335d1
[tryceratops]: Verbose Log Messages ( #3036 )
2023-02-20 18:21:04 +00:00
Tomer Chachamu
4d3d04ee61
[PLE0101] error when __init__ returns a value ( #3007 )
2023-02-19 14:54:43 +00:00
Manuel Jacob
87422ba362
Add configuration option for C408 to allow dict calls with keyword arguments. ( #2977 )
...
When creating a dict with string keys, some prefer to call dict instead of writing a dict literal.
For example: `dict(a=1, b=2, c=3)` instead of `{"a": 1, "b": 2, "c": 3}`.
2023-02-19 14:47:03 +00:00
Charlie Marsh
a10a500a26
Ignore namedtuple methods in flake8-self ( #2998 )
2023-02-17 17:16:25 -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
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
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
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
Martin Fischer
849b947b3e
many-to-one 7/9: Update JSON schema
2023-02-14 16:16:12 -05: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
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
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
Nick Pope
9f84c497f9
Adjust heading level in rule documentation ( #2749 )
2023-02-10 19:10:42 -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
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
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
739a92e99d
Implement compound-statements (E701, E702, E703, E704) ( #2680 )
2023-02-08 22:57:39 -05:00
Colin Delahunty
31027497c6
[flake8-bandit]: try-except-continue ( #2674 )
2023-02-08 21:44:01 -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
Steve Dignam
3b3466f6da
Add flake8-pie single_starts_ends_with ( #2616 )
2023-02-06 21:22:32 -05:00
Colin Delahunty
6272293180
[pylint]: bad-str-strip-call (With Autofix) ( #2570 )
2023-02-06 15:34:37 -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
Jonathan Plasse
bdcab87d2f
Add markdownlint and dev Ruff to pre-commit ( #2303 )
2023-02-02 16:29:07 -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
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
Maksudul Haque
7c1a6bce7b
[flake8-raise] Add Plugin and RSE102 Rule ( #2354 )
2023-01-31 18:09:40 -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
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
Martin Fischer
104c63afc6
Exclude deprecated extend-ignore from the JSON schema
...
Now that the option is deprecated we no longer
want IDEs to suggest it in their autocompletion.
2023-01-30 16:26:59 -05:00