Wei Lee
edce559431
[airflow]: extend removed names (AIR302) ( #14734 )
2024-12-03 21:39:43 +00:00
Brent Westbrook
62e358e929
[ruff
] Extend unnecessary-regular-expression to non-literal strings (RUF055
) ( #14679 )
...
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2024-12-03 15:17:20 +00:00
Alex Waygood
81bfcc9899
Minor followups to RUF052 ( #14755 )
...
## Summary
Just some minor followups to the recently merged RUF052 rule, that was
added in bf0fd04
:
- Some small tweaks to the docs
- A minor code-style nit
- Some more tests for my peace of mind, just to check that the new
methods on the semantic model are working correctly
I'm adding the "internal" label as this doesn't deserve a changelog
entry. RUF052 is a new rule that hasn't been released yet.
## Test Plan
`cargo test -p ruff_linter`
2024-12-03 13:33:29 +00:00
Lokejoke
bf0fd04e4e
[ruff
] Implemented used-dummy-variable
(RUF052
) ( #14611 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-12-03 08:36:16 +01:00
Dylan
91e2d9a139
[refurb
] Handle non-finite decimals in verbose-decimal-constructor (FURB157)
( #14596 )
...
This PR extends the Decimal parsing used in [verbose-decimal-constructor
(FURB157)](https://docs.astral.sh/ruff/rules/verbose-decimal-constructor/ )
to better handle non-finite `Decimal` objects, avoiding some false
negatives.
Closes #14587
---------
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-12-02 18:13:20 -06:00
Matt Ord
83651deac7
[pylint
] Ignore overload in PLR0904
( #14730 )
...
Fixes #14727
## Summary
Fixes #14727
## Test Plan
cargo test
---------
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-12-02 14:36:51 +00:00
Micha Reiser
f96dfc179f
Revert: [pyflakes] Avoid false positives in @no_type_check
contexts (F821, F722) ( #14615 ) ( #14726 )
2024-12-02 14:28:27 +01:00
Tzu-ping Chung
76d2e56501
[airflow] Avoid deprecated values (AIR302) ( #14582 )
2024-12-02 07:39:26 +00:00
Brent Westbrook
9e017634cb
[pep8-naming
] Avoid false positive for class Bar(type(foo))
(N804
) ( #14683 )
2024-11-30 22:37:28 +00:00
Simon Brugman
56ae73a925
[pylint
] Fix false negatives for ascii
and sorted
in len-as-condition
(PLC1802) ( #14692 )
2024-11-30 14:10:30 -06:00
Alex Waygood
f3d8c023d3
[ruff
] Avoid emitting assignment-in-assert
when all references to the assigned variable are themselves inside assert
s (RUF018
) ( #14661 )
2024-11-29 13:36:59 +00:00
Simon Brugman
abb3c6ea95
[flake8-pyi
] Avoid rewriting invalid type expressions in unnecessary-type-union
(PYI055) ( #14660 )
2024-11-28 18:30:50 +00:00
Brent Westbrook
224fe75a76
[ruff
] Implement unnecessary-regular-expression
(RUF055
) ( #14659 )
...
Co-authored-by: Micha Reiser <micha@reiser.io>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Simon Brugman <sbrugman@users.noreply.github.com>
2024-11-28 18:29:23 +00:00
Simon Brugman
dc29f52750
[flake8-pyi
, ruff
] Fix traversal of nested literals and unions (PYI016
, PYI051
, PYI055
, PYI062
, RUF041
) ( #14641 )
2024-11-28 18:07:12 +00:00
Alex Waygood
d8bca0d3a2
Fix bug where methods defined using lambdas were flagged by FURB118 ( #14639 )
2024-11-28 12:58:23 +00:00
David Salvisberg
8a7ba5d2df
[flake8-type-checking
] Fixes quote_type_expression
( #14634 )
2024-11-27 18:58:48 +01:00
Brent Westbrook
6fcbe8efb4
[ruff
] Detect redirected-noqa in file-level comments (RUF101
) ( #14635 )
2024-11-27 18:25:47 +01:00
Alexandra Valentine-Ketchum
c40b37aa36
N811 & N814: eliminate false positives for single-letter names ( #14584 )
...
Co-authored-by: Micha Reiser <micha@reiser.io>
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2024-11-27 14:38:36 +00:00
Simon Brugman
11a2929ed7
[ruff
] Implement unnecessary-nested-literal
(RUF041
) ( #14323 )
...
Co-authored-by: Micha Reiser <micha@reiser.io>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-11-27 10:01:50 +00:00
InSync
187974eff4
[flake8-use-pathlib
] Recommend Path.iterdir()
over os.listdir()
(PTH208
) ( #14509 )
...
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-11-27 09:53:13 +00:00
David Salvisberg
6fd10e2fe7
[flake8-type-checking
] Adds implementation for TC007 and TC008 ( #12927 )
...
Co-authored-by: Simon Brugman <sbrugman@users.noreply.github.com>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-11-27 09:51:20 +01:00
Lokejoke
82c01aa662
[pylint]
Implement len-test
(PLC1802
) (#14309 )
...
## Summary
This PR implements [`use-implicit-booleaness-not-len` /
`C1802`](https://pylint.pycqa.org/en/latest/user_guide/messages/convention/use-implicit-booleaness-not-len.html )
> For sequences, (strings, lists, tuples), use the fact that empty
sequences are false.
---------
Co-authored-by: xbrtnik1 <524841@mail.muni.cz>
Co-authored-by: xbrtnik1 <xbrtnik1@mail.muni.cz>
2024-11-26 13:30:17 -06:00
Brent Westbrook
9f446faa6c
[pyflakes] Avoid false positives in @no_type_check
contexts (F821, F722) ( #14615 )
2024-11-26 19:13:43 +00:00
Dylan
24c90d6953
[pylint
] Do not wrap function calls in parentheses in the fix for unnecessary-dunder-call (PLC2801) ( #14601 )
2024-11-26 06:47:01 -06:00
Tzu-ping Chung
fbff4dec3a
[airflow] Avoid implicit DAG schedule (AIR301) ( #14581 )
2024-11-26 13:38:18 +01:00
Simon Brugman
e4cefd9bf9
Extend test cases for flake8-pyi
( #14280 )
2024-11-26 09:10:38 +01:00
Lokejoke
9e4ee98109
[ruff
] Implement invalid-assert-message-literal-argument
(RUF040
) ( #14488 )
...
## Summary
This PR implements new rule discussed
[here](https://github.com/astral-sh/ruff/discussions/14449 ).
In short, it searches for assert messages which were unintentionally
used as a expression to be matched against.
## Test Plan
`cargo test` and review of `ruff-ecosystem`
2024-11-25 17:41:07 -06:00
Simon Brugman
c606bf014e
[flake8-pyi
] Improve autofix safety for redundant-none-literal
(PYI061) ( #14583 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-11-25 17:40:57 +00:00
Simon Brugman
e8fce20736
[ruff
] Improve autofix safety for never-union
(RUF020) ( #14589 )
2024-11-25 18:35:07 +01:00
Harutaka Kawamura
fa22bd604a
Fix pytest.mark.parametrize
rules to check calls instead of decorators ( #14515 )
...
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-11-25 13:55:18 +01:00
Charlie Marsh
de62e39eba
Use truthiness check in auto_attribs
detection ( #14562 )
2024-11-23 22:06:10 -05:00
InSync
d285717da8
[ruff
] Handle attrs
's auto_attribs
correctly (RUF009
) ( #14520 )
...
## Summary
Resolves #14519 .
## Test Plan
`cargo nextest run` and `cargo insta test`.
2024-11-23 21:46:38 -05:00
InSync
545e9deba3
[flake8-builtins
] Exempt private built-in modules (A005
) ( #14505 )
...
## Summary
Resolves #12949 .
## Test Plan
`cargo nextest run` and `cargo insta test`.
2024-11-23 21:39:04 -05:00
Harutaka Kawamura
e3d792605f
[flake8-bugbear
] Fix mutable-contextvar-default (B039)
to resolve annotated function calls properly ( #14532 )
...
## Summary
<!-- What's the purpose of the change? What does it do, and why? -->
Fix #14525
## Test Plan
<!-- How was it tested? -->
New test cases
---------
Signed-off-by: harupy <hkawamura0130@gmail.com>
2024-11-23 21:29:25 -05:00
Harutaka Kawamura
931fa06d85
Extend invalid-envvar-default (PLW1508)
to detect os.environ.get
( #14512 )
2024-11-22 19:13:58 +00:00
David Salvisberg
e25e7044ba
[flake8-type-checking
] Adds implementation for TC006 ( #14511 )
...
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-11-22 15:22:59 +01:00
Alex Waygood
c400725713
[ruff 0.8] [flake8-pytest-style
] Remove deprecated rules PT004 and PT005 ( #14385 )
...
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-11-20 13:11:51 +01:00
Alex Waygood
1081694140
[ruff 0.8] [flake8-annotations
] Remove deprecated rules ANN101 and ANN102 ( #14384 )
...
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-11-20 13:11:51 +01:00
David Salvisberg
dc05b38165
[ruff 0.8][flake8-type-checking
] Rename TCH
to TC
( #14438 )
...
Closes #9573
2024-11-20 13:11:51 +01:00
konsti
b46cc6ac0b
Update pyproject-toml to support PEP 639 ( #13902 )
...
Fixes #13869
2024-11-20 13:11:51 +01:00
Alex Waygood
5f6607bf54
[ruff 0.8] Remove deprecated rule UP027 ( #14382 )
2024-11-20 13:11:51 +01:00
InSync
b9c53a74f9
[pycodestyle
] Exempt pytest.importorskip()
calls (E402
) ( #14474 )
...
## Summary
Resolves #13537 .
## Test Plan
`cargo nextest run` and `cargo insta test`.
2024-11-19 22:08:15 -05:00
Micha Reiser
dbbe7a773c
Mark UP043 fix unsafe when the type annotation contains any comments ( #14458 )
2024-11-19 15:24:02 +01:00
InSync
5f09d4a90a
[ruff
] re
and regex
calls with unraw string as first argument (RUF039
) ( #14446 )
2024-11-19 13:44:55 +01:00
InSync
3642381489
[ruff
] Add rule forbidding map(int, package.__version__.split('.'))
(RUF048
) ( #14373 )
...
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2024-11-18 13:43:24 +00:00
Steve C
577653551c
[pylint
] - use sets when possible for PLR1714
autofix (repeated-equality-comparison
) ( #14372 )
2024-11-18 08:57:43 +01:00
Charlie Marsh
fccbe56d23
Reverse order of __contains__
arguments ( #14424 )
...
## Summary
Closes https://github.com/astral-sh/ruff/issues/14423 .
2024-11-18 03:58:12 +00:00
InSync
0a27c9dabd
[flake8-pie
] Mark fix as unsafe if the following statement is a string literal (PIE790
) ( #14393 )
...
## Summary
Resolves #12616 .
## Test Plan
`cargo nextest run` and `cargo insta test`.
---------
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-11-18 02:30:06 +00:00
InSync
3c9e76eb66
[flake8-datetimez
] Also exempt .time()
(DTZ901
) ( #14394 )
...
## Summary
Resolves #14378 .
## Test Plan
`cargo nextest run` and `cargo insta test`.
---------
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-11-18 02:24:35 +00:00
Simon Brugman
1fbed6c325
[ruff
] Implement redundant-bool-literal
(RUF038
) ( #14319 )
...
## Summary
Implements `redundant-bool-literal`
## Test Plan
<!-- How was it tested? -->
`cargo test`
The ecosystem results are all correct, but for `Airflow` the rule is not
relevant due to the use of overloading (and is marked as unsafe
correctly).
---------
Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2024-11-16 21:52:51 +00:00