Charlie Marsh
061495a9eb
Make BoolOp its own located token ( #3265 )
2023-02-28 03:43:28 +00:00
Charlie Marsh
470e1c1754
Preserve comments on non-defaulted arguments ( #3264 )
2023-02-27 23:41:40 +00:00
Charlie Marsh
16be691712
Enable more non-panicking formatter tests ( #3262 )
2023-02-27 18:21:53 -05:00
Charlie Marsh
270015865b
Don't flag keyword-based logging format strings ( #3261 )
2023-02-27 23:11:13 +00:00
Charlie Marsh
ccfa9d5b20
Deduplicate SIM116 errors ( #3260 )
2023-02-27 18:08:45 -05:00
Charlie Marsh
2261e194a0
Create dedicated Body
nodes in the formatter CST ( #3223 )
2023-02-27 22:55:05 +00:00
Ville Skyttä
cd6413ca09
Match non-lowercase with S105 again ( #3258 )
2023-02-27 16:38:23 -05:00
Charlie Marsh
c65585e14a
Use identifier_range
for a few more rules ( #3254 )
2023-02-27 18:23:33 +00:00
Charlie Marsh
16e2dae0c2
Handle empty NamedTuple and TypedDict conversions ( #3251 )
2023-02-27 11:18:34 -05:00
Carlos Gonçalves
e8ba9c9e21
feat(W191): add indentation_contains_tabs ( #3249 )
2023-02-27 10:36:03 -05: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
40c5abf16e
Avoid flagging Pylint logging rules with starred arguments ( #3244 )
2023-02-26 22:58:24 -05:00
Matthew Lloyd
7e7aec7d74
Expand the range of the COM812 autofix to include the preceding token ( #3241 )
...
This prevents the UP034 autofix simultaneously stripping the
parentheses from generators in the same linter pass, which causes
a SyntaxError.
Closes #3234 .
With this fix:
```python
$ cat test.py
the_first_one = next(
(i for i in range(10) if i // 2 == 0)
)
$ cargo run --bin ruff check test.py --no-cache --select UP034,COM812 --fix
Finished dev [unoptimized + debuginfo] target(s) in 0.08s
Running `target/debug/ruff check test.py --no-cache --select UP034,COM812 --fix`
Found 1 error (1 fixed, 0 remaining).
$ cat test.py
the_first_one = next(
i for i in range(10) if i // 2 == 0
)
```
* Use format
---------
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2023-02-27 03:47:07 +00:00
Ivan Gozali
4b5538f74e
[pylint
] W0603: global-statement
( #3227 )
...
Implements pylint rule [W0603: global-statement](https://pylint.readthedocs.io/en/latest/user_guide/messages/warning/global-statement.html ).
Currently checks for global statement usage in a few StmtKinds (as tested in the `pylint` `global-statement` test case [here](b70d2abd7f/tests/functional/g/globals.py
)):
* Assign
* AugAssign
* ClassDef
* FunctionDef | AsyncFunctionDef
* Import
* ImportFrom
* Delete
2023-02-26 23:40:24 +00:00
Chris Chan
0b7d6b9097
Implement pylint's else-if-used
rule (PLR5501
) ( #3231 )
...
Attempt to implement else-if-used
https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/else-if-used.html
Issue #970
2023-02-26 22:42:33 +00:00
Nick Pope
994e2e0903
Rename some flake8-simplify
rules ( #2915 )
...
Renames the following rules that stood out to me at a glance as needing better names:
- `or-true` to `expr-or-true`
- `and-false` to `expr-and-false`
- `a-or-not-a` to `expr-or-not-expr`
- `a-and-not-a` to `expr-and-not-expr`
Related to #2902 .
2023-02-26 22:35:15 +00:00
Luc Khai Hai
bc79f540e4
[flake8-django] DJ003, DJ006, DJ007 ( #3236 )
...
Implements [flake8-django](https://github.com/rocioar/flake8-django ) rules:
- DJ03
- DJ06
- DJ07
2023-02-26 22:29:42 +00:00
Steve Dignam
3a78b59314
[flake8-pyi]: PYI011, PYI014 ( #3238 )
...
Implement PYI011 and PYI014 with the latest changes:
https://github.com/PyCQA/flake8-pyi/pull/326
https://github.com/PyCQA/flake8-pyi/issues/316
rel: https://github.com/charliermarsh/ruff/issues/848
rel: 4212bec43d/pyi.py (L718)
2023-02-26 22:11:58 +00:00
Edgar R. M
5f83851329
[pydocstyle]: Implement ignore-decorators
( #3229 )
2023-02-26 21:40:01 +00:00
Carlos Gonçalves
484ce7b8fc
feat(E275): add Missing whitespace after keyword ( #3225 )
2023-02-26 21:36:05 +00:00
Charlie Marsh
1c75071136
Implement basic rendering of remaining AST nodes ( #3233 )
2023-02-26 05:05:56 +00:00
Charlie Marsh
51bca19c1d
Add builders for common comment rendering ( #3232 )
2023-02-26 04:16:24 +00:00
Steve Dignam
a8a312e862
[flake8-pyi]: PYI009, PYI010, PYI021 ( #3230 )
...
PYI009 and PYI010 are very similar, always use `...` in function and class bodies in stubs.
PYI021 bans doc strings in stubs.
I think all of these rules should be relatively straightforward to implement auto fixes for but can do that later once we get all the other rules added.
rel: https://github.com/charliermarsh/ruff/issues/848
2023-02-25 22:29:04 -05:00
Ran Benita
33c31cda27
Add noqa_row
to diagnostics JSON format ( #3228 )
...
In ruff-lsp (https://github.com/charliermarsh/ruff-lsp/pull/76 ) we want to add a "Disable \<rule\> for this line" quickfix. However, finding the correct line into which the `noqa` comment should be inserted is non-trivial (multi-line strings for example).
Ruff already has this info, so expose it in the JSON output for use by ruff-lsp.
2023-02-25 18:13:16 -05:00
Edgar R. M
cd9fbeb560
[bandit]: Do not treat "passed" as "password" for S105
/S106
/S107
( #3222 )
2023-02-25 15:32:53 -05:00
Jeong YunWon
84e96cdcd9
More enum work ( #3212 )
2023-02-25 11:40:16 -05:00
Charlie Marsh
248590224a
Avoid flagging logging-too-few-args with no arguments ( #3220 )
2023-02-24 21:57:49 -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
Charlie Marsh
0694aee1b6
Avoid EXE001 and EXE002 errors from stdin input ( #3218 )
2023-02-24 22:55:32 +00:00
Charlie Marsh
a17b5c134a
Avoid rewriting any PEP 604 runtime annotations ( #3217 )
...
Following `pyupgrade`, we'll just _never_ touch these.
Closes #2981 .
Closes #3215 .
2023-02-24 22:39:58 +00:00
Charlie Marsh
42f61535b5
Normalize treatment of aliased and unaliased imports ( #3216 )
2023-02-24 22:11:03 +00:00
Carlos Gonçalves
1c01b3c934
fix(docs): broken links inside Configuration.md ( #3205 )
2023-02-24 18:55:33 +00:00
monosans
24add5f56c
Avoid boolean-trap rules for ConfigParser get() methods ( #3209 )
2023-02-24 12:52:33 -05:00
Samuel Cormier-Iijima
0b7736ad79
[flake8-tidy-imports
] fix autofix for relative imports ( #3197 )
2023-02-23 23:40:28 -05:00
Charlie Marsh
eef85067c8
Exclude globsets for --show-settings ( #3201 )
2023-02-24 04:23:00 +00:00
Jeong YunWon
da98fab4ae
Adapt is-macro for a few enums ( #3182 )
2023-02-24 04:06:56 +00:00
Charlie Marsh
0f37a98d91
Use then-some pattern for sometimes-fixable rules ( #3199 )
2023-02-24 03:57:14 +00:00
Charlie Marsh
f38624824d
Avoid autofixing some PT violations when comments are present ( #3198 )
2023-02-24 03:48:41 +00:00
Charlie Marsh
159422071e
Handle end-of-line comments on excepthandler
and alias
( #3196 )
2023-02-23 22:35:39 -05:00
Charlie Marsh
6eaacf96be
Introduce a new CST element for slice segments ( #3195 )
2023-02-24 00:49:41 +00:00
Charlie Marsh
eb15371453
Make Locator available in AST-to-CST conversion pass ( #3194 )
2023-02-23 19:43:03 -05:00
Matt Nawara
198b301baf
[pycodestyle] trailing-whitespace, blank-line-contains-whitespace (W291, W293) ( #3122 )
2023-02-23 19:04:45 -05:00
Jeong YunWon
c8c575dd43
Adapt BoolLike to flags ( #3175 )
2023-02-23 16:31:46 -05:00
Jonathan Plasse
6e54cd8233
Normalize relative markdown links ( #3190 )
2023-02-23 16:24:31 -05:00
Charlie Marsh
bda2a0007a
Parenthesize numbers during attribute accesses ( #3189 )
2023-02-23 14:57:23 -05:00
Charlie Marsh
32d165b7ad
Implement complex literal formatting ( #3186 )
2023-02-23 19:09:33 +00:00
Charlie Marsh
ac79bf4ee9
Implement float literal formatting ( #3184 )
2023-02-23 14:02:23 -05:00
Charlie Marsh
376eab3a53
Implement integer literal formatting ( #3183 )
2023-02-23 18:31:56 +00:00
Charlie Marsh
08be7bd285
Add a TODO to string_literal ( #3181 )
2023-02-23 12:46:20 -05:00