-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always report parse errors back to the user #2505
Conversation
893d8ce
to
4a9db74
Compare
@@ -325,7 +362,7 @@ pub fn lint_fix( | |||
); | |||
|
|||
// Apply autofix. | |||
if let Some((fixed_contents, applied)) = fix_file(&diagnostics, &locator) { | |||
if let Some((fixed_contents, applied)) = fix_file(&result.data, &locator) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having access to the parse error here means that we can also catch errors that we introduced.
4a9db74
to
b64ce04
Compare
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://github.com/charliermarsh/ruff) | `^0.0.240` -> `^0.0.241` | [![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.241/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.241/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.241/compatibility-slim/0.0.240)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.241/confidence-slim/0.0.240)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>charliermarsh/ruff</summary> ### [`v0.0.241`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.241) [Compare Source](https://github.com/charliermarsh/ruff/compare/v0.0.240...v0.0.241) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Deprecates - Soft-deprecate `update-check` by [@​akx](https://github.com/akx) in [https://github.com/charliermarsh/ruff/pull/2530](https://github.com/charliermarsh/ruff/pull/2530) ##### Rules - feat: add autofix for PLR0402 by [@​spaceone](https://github.com/spaceone) in [https://github.com/charliermarsh/ruff/pull/2504](https://github.com/charliermarsh/ruff/pull/2504) - Allow F811 noqa declarations on containing import lines by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2553](https://github.com/charliermarsh/ruff/pull/2553) ##### Features - Mark fixable issues in printer output by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2500](https://github.com/charliermarsh/ruff/pull/2500) - Always report parse errors back to the user by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2505](https://github.com/charliermarsh/ruff/pull/2505) - Notify user if autofix introduces syntax error by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2507](https://github.com/charliermarsh/ruff/pull/2507) - Add `known-standard-library` for each Python version by [@​JonathanPlasse](https://github.com/JonathanPlasse) in [https://github.com/charliermarsh/ruff/pull/2491](https://github.com/charliermarsh/ruff/pull/2491) ##### Bug Fixes - Avoid renaming unused loop variables with deferred usages by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2509](https://github.com/charliermarsh/ruff/pull/2509) - \[`flake8-self`] Fix False Negative Issue on Rule `SLF001` by [@​saadmk11](https://github.com/saadmk11) in [https://github.com/charliermarsh/ruff/pull/2527](https://github.com/charliermarsh/ruff/pull/2527) - Minor fixes to PLR0915 logic by [@​chanman3388](https://github.com/chanman3388) in [https://github.com/charliermarsh/ruff/pull/2518](https://github.com/charliermarsh/ruff/pull/2518) - Exit upon showing files with `--show-files` by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2543](https://github.com/charliermarsh/ruff/pull/2543) - Ignore direct source-children in `implicit-namespace-package` by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2560](https://github.com/charliermarsh/ruff/pull/2560) - Allow `list()` and `tuple()` calls in `__all__` assignments by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2499](https://github.com/charliermarsh/ruff/pull/2499) - Don't walk past project root when figuring out exclusion by [@​akx](https://github.com/akx) in [https://github.com/charliermarsh/ruff/pull/2471](https://github.com/charliermarsh/ruff/pull/2471) - Avoid hang when detecting trailing comments by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2549](https://github.com/charliermarsh/ruff/pull/2549) #### New Contributors - [@​JacobCoffee](https://github.com/JacobCoffee) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2516](https://github.com/charliermarsh/ruff/pull/2516) - [@​Pierre-Sassoulas](https://github.com/Pierre-Sassoulas) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2559](https://github.com/charliermarsh/ruff/pull/2559) **Full Changelog**: astral-sh/ruff@v0.0.240...v0.0.241 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/ixm-one/pytest-cmake-presets). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMTkuNSIsInVwZGF0ZWRJblZlciI6IjM0LjExOS41In0=--> Signed-off-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Hi! I've just upgraded to 0.0.241 from 0.0.240 and seeing this as new error in
|
@gertvdijk - Hi! We could omit this warning if you run under Curious though - what's the context in which you're running over code consistently that fails to parse? |
Yes, I think I would like that, but I'm afraid that it also hides more/other/future problems. It produced errors in regular mode, but it allowed me start using Ruff in
The infamous #282. 😐 I just released a project last weekend and this started to show suddenly when running the |
Interestingly this seemed to remove the ability for us to do |
The intent is that the behavior is totally unchanged, except that we also show you an |
I could add an |
The other option is that we could avoid omitting these if you add |
To summarize a few options -- and I'd love feedback:
|
Thanks for the thoughts! I would vote for option 1, if it's not possible to silence it on a block-level (whole match/case block). If you see the chance of making it fail on the use of that flag if there are no parse errors, that would be great. It will then act as a notification that a future Ruff will understand the syntax. (Just like how mypy will complain if a typing-ignore is not needed (anymore).) Against option 2 for the given reason - it would silence half my project. Option 3 sounds confusing to me. I think I get both E999 and the syntax error on the match/case block. I would need a |
(Sorry, for Option 3, I meant that we'd only show the error if the E999 code wasn't selected at all. So if you ran |
Oh yes, I was just confused by the error output when I'd already had the I think I'd vote for a 4th option: don't show the parse errors if the line is decorated with E999 ignore, even if that error isn't selected. For clarity, my code is:
And the output I get is
|
That's a nice idea. I went ahead and added it. So if you have this: x = 1
y = 2
match x: # noqa: E999
1 We'll always suppress that parse error, regardless of whether |
Work-around with suppression of syntax error printed has been added in version 0.0.245. - astral-sh/ruff#2697 - astral-sh/ruff#2505 (comment)
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [ruff](https://github.com/charliermarsh/ruff) | `^0.0.237` -> `^0.0.247` | [![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.247/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.247/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.247/compatibility-slim/0.0.237)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.247/confidence-slim/0.0.237)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>charliermarsh/ruff</summary> ### [`v0.0.247`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.247) [Compare Source](https://github.com/charliermarsh/ruff/compare/v0.0.246...v0.0.247) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Rules - \[`NPY001`] deprecated type aliases by [@​sbrugman](https://github.com/sbrugman) in [https://github.com/charliermarsh/ruff/pull/2810](https://github.com/charliermarsh/ruff/pull/2810) - \[`RUF006`] Implement `asyncio-dangling-task` to track `asyncio.create_task` calls by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2935](https://github.com/charliermarsh/ruff/pull/2935) ##### CLI - Implement shell autocompletion for rule codes by [@​not-my-profile](https://github.com/not-my-profile) in [https://github.com/charliermarsh/ruff/pull/2906](https://github.com/charliermarsh/ruff/pull/2906) ##### Bug Fixes - Handle multiple receiver decorators in receiver-decorator by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2858](https://github.com/charliermarsh/ruff/pull/2858) - Avoid false-positives with multi-byte characters in B005 by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2862](https://github.com/charliermarsh/ruff/pull/2862) - Avoid false-positives for runtime-types in type checking blocks by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2863](https://github.com/charliermarsh/ruff/pull/2863) - Avoid noqa removal upon unhandled syntax errors by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2864](https://github.com/charliermarsh/ruff/pull/2864) - Ignore non-imperative-mood in Google docstring convention by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2900](https://github.com/charliermarsh/ruff/pull/2900) - \[`flake8-tidy-imports`] autofix relative imports by [@​sbrugman](https://github.com/sbrugman) in [https://github.com/charliermarsh/ruff/pull/2891](https://github.com/charliermarsh/ruff/pull/2891) - Respect self as positional-only argument in annotation rules by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2927](https://github.com/charliermarsh/ruff/pull/2927) - Apply nullable-model-string-field to all classes by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2928](https://github.com/charliermarsh/ruff/pull/2928) - Deduplicate files provided on the command-line by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2931](https://github.com/charliermarsh/ruff/pull/2931) - Re-show --target-version on CLI interface by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2859](https://github.com/charliermarsh/ruff/pull/2859) - Remove autofix for prefer-type-error by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2880](https://github.com/charliermarsh/ruff/pull/2880) - Avoid unnecessary-else violations in `elif` branches by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2881](https://github.com/charliermarsh/ruff/pull/2881) - Extend B904 to else branches by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2886](https://github.com/charliermarsh/ruff/pull/2886) - Allow private accesses on current class by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2929](https://github.com/charliermarsh/ruff/pull/2929) #### New Contributors - [@​Jeremiah-England](https://github.com/Jeremiah-England) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2884](https://github.com/charliermarsh/ruff/pull/2884) - [@​Chris-May](https://github.com/Chris-May) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2896](https://github.com/charliermarsh/ruff/pull/2896) - [@​simon04](https://github.com/simon04) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2904](https://github.com/charliermarsh/ruff/pull/2904) **Full Changelog**: astral-sh/ruff@v0.0.246...v0.0.247 ### [`v0.0.246`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.246) [Compare Source](https://github.com/charliermarsh/ruff/compare/v0.0.245...v0.0.246) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Breaking Changes - Remove multiple-statements-on-one-line-def (E704) by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2773](https://github.com/charliermarsh/ruff/pull/2773) ##### Rules - \[`flake8-pyi`]: add rules for unrecognized platform check (PYI007, PYI008) by [@​SigureMo](https://github.com/SigureMo) in [https://github.com/charliermarsh/ruff/pull/2805](https://github.com/charliermarsh/ruff/pull/2805) - \[`flake8-simplify`]: combine-if-conditions by [@​colin99d](https://github.com/colin99d) in [https://github.com/charliermarsh/ruff/pull/2823](https://github.com/charliermarsh/ruff/pull/2823) - \[`flake8-django`] Implemented flake8-django plugin rules by [@​konysko](https://github.com/konysko) in [https://github.com/charliermarsh/ruff/pull/2586](https://github.com/charliermarsh/ruff/pull/2586) ##### CLI - Implement `config` subcommand by [@​not-my-profile](https://github.com/not-my-profile) in [https://github.com/charliermarsh/ruff/pull/2775](https://github.com/charliermarsh/ruff/pull/2775) - Add rendering of rule markdown for terminal output by [@​ngnpope](https://github.com/ngnpope) in [https://github.com/charliermarsh/ruff/pull/2747](https://github.com/charliermarsh/ruff/pull/2747) - Add `--show-fixes` flag to show applied fixes by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2707](https://github.com/charliermarsh/ruff/pull/2707) ##### Settings - implemented option lines-between-types for isort by [@​PushUpek](https://github.com/PushUpek) in [https://github.com/charliermarsh/ruff/pull/2762](https://github.com/charliermarsh/ruff/pull/2762) ##### Autofix - \[`pyflakes`] Support unused variable removal in multi-assignment statements by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2786](https://github.com/charliermarsh/ruff/pull/2786) - \[`flake8-comprehensions`] autofix C414 and C417 + bugfix by [@​sbrugman](https://github.com/sbrugman) in [https://github.com/charliermarsh/ruff/pull/2693](https://github.com/charliermarsh/ruff/pull/2693) - \[`flake8-comprehensions`] bugfix for C413 autofix by [@​sbrugman](https://github.com/sbrugman) in [https://github.com/charliermarsh/ruff/pull/2804](https://github.com/charliermarsh/ruff/pull/2804) - \[`flake8-simplify`] Use smarter inversion for comparison checks by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2831](https://github.com/charliermarsh/ruff/pull/2831) - \[`flake8-comprehensions`] improve autofix for C401, C402 and C417 by [@​sbrugman](https://github.com/sbrugman) in [https://github.com/charliermarsh/ruff/pull/2806](https://github.com/charliermarsh/ruff/pull/2806) ##### Bug Fixes - Ignore colon-after-lambda in compound statement rules by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2771](https://github.com/charliermarsh/ruff/pull/2771) - Don't treat all future import accesses as non-runtime by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2774](https://github.com/charliermarsh/ruff/pull/2774) - Avoid treating deferred string annotations as required-at-runtime by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2779](https://github.com/charliermarsh/ruff/pull/2779) - Respect continuations in `noqa` enforcement by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2783](https://github.com/charliermarsh/ruff/pull/2783) - Improve unused-variable autofixes for with statements by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2785](https://github.com/charliermarsh/ruff/pull/2785) - Refactor generator to use Astor-derived precedence levels by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2798](https://github.com/charliermarsh/ruff/pull/2798) - Allow private accesses on super calls by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2815](https://github.com/charliermarsh/ruff/pull/2815) - Allow non-verbose raise when cause is present by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2816](https://github.com/charliermarsh/ruff/pull/2816) - Avoid duplicates in if-with-same-arms by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2827](https://github.com/charliermarsh/ruff/pull/2827) - Include package inference during --add-noqa command by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2832](https://github.com/charliermarsh/ruff/pull/2832) - Allow compound statements of single ellipsis by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2837](https://github.com/charliermarsh/ruff/pull/2837) #### New Contributors - [@​trag1c](https://github.com/trag1c) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2757](https://github.com/charliermarsh/ruff/pull/2757) - [@​PushUpek](https://github.com/PushUpek) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2762](https://github.com/charliermarsh/ruff/pull/2762) - [@​konysko](https://github.com/konysko) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2586](https://github.com/charliermarsh/ruff/pull/2586) - [@​SigureMo](https://github.com/SigureMo) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2805](https://github.com/charliermarsh/ruff/pull/2805) **Full Changelog**: astral-sh/ruff@v0.0.245...v0.0.246 ### [`v0.0.245`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.245) [Compare Source](https://github.com/charliermarsh/ruff/compare/v0.0.244...v0.0.245) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Breaking Changes - Remove public Rust API by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2709](https://github.com/charliermarsh/ruff/pull/2709) ##### Rules - \[`flake8-pyi`]Add flake8-pyi with one rule by [@​sbdchd](https://github.com/sbdchd) in [https://github.com/charliermarsh/ruff/pull/2682](https://github.com/charliermarsh/ruff/pull/2682) - \[`pylint`]: bad-string-format-type by [@​colin99d](https://github.com/colin99d) in [https://github.com/charliermarsh/ruff/pull/2572](https://github.com/charliermarsh/ruff/pull/2572) - \[`pylint`]: yield-in-init by [@​tomecki](https://github.com/tomecki) in [https://github.com/charliermarsh/ruff/pull/2716](https://github.com/charliermarsh/ruff/pull/2716) - \[`flake8-tidy-imports`] Implement autofix for relative imports (TID252) by [@​sbrugman](https://github.com/sbrugman) in [https://github.com/charliermarsh/ruff/pull/2739](https://github.com/charliermarsh/ruff/pull/2739) - \[`flake8-bandit`]: try-except-continue by [@​colin99d](https://github.com/colin99d) in [https://github.com/charliermarsh/ruff/pull/2674](https://github.com/charliermarsh/ruff/pull/2674) - \[`flake8-bandit`] Implement bandit's 'hardcoded-sql-expressions' S608 by [@​mattoberle](https://github.com/mattoberle) in [https://github.com/charliermarsh/ruff/pull/2698](https://github.com/charliermarsh/ruff/pull/2698) - \[`pycodestyle`] Implement compound-statements (E701, E702, E703, E704) by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2680](https://github.com/charliermarsh/ruff/pull/2680) ##### Settings - feat(isort): Implement known-local-folder by [@​spaceone](https://github.com/spaceone) in [https://github.com/charliermarsh/ruff/pull/2657](https://github.com/charliermarsh/ruff/pull/2657) - Suppress parse errors with explicit `# noqa: E999` directives by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2697](https://github.com/charliermarsh/ruff/pull/2697) ##### Bug Fixes - Support callable decorators in classmethod_decorators et al by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2675](https://github.com/charliermarsh/ruff/pull/2675) - Avoid flagging typed exceptions in tuples by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2728](https://github.com/charliermarsh/ruff/pull/2728) - Mark flake8-simplify rules as unfixable in non-fixable cases by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2676](https://github.com/charliermarsh/ruff/pull/2676) - Treat re-exported annotations as used-at-runtime by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2689](https://github.com/charliermarsh/ruff/pull/2689) - Gate `Path.readlink()` behind Python 3.9+ guard by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2708](https://github.com/charliermarsh/ruff/pull/2708) - Handle functions that never return in RET503 ([#​2602](https://github.com/charliermarsh/ruff/issues/2602)) by [@​ppentchev](https://github.com/ppentchev) in [https://github.com/charliermarsh/ruff/pull/2701](https://github.com/charliermarsh/ruff/pull/2701) - Handle more functions that never return in RET503 by [@​ngnpope](https://github.com/ngnpope) in [https://github.com/charliermarsh/ruff/pull/2719](https://github.com/charliermarsh/ruff/pull/2719) - Expand S110 and S112 ranges to include entire exception handler by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2729](https://github.com/charliermarsh/ruff/pull/2729) - Relax conditions in bad-string-format-type by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2731](https://github.com/charliermarsh/ruff/pull/2731) - Mark `__all__` members as used at end-of-scope by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2733](https://github.com/charliermarsh/ruff/pull/2733) - Only validate `__all__` bindings for global scope by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2738](https://github.com/charliermarsh/ruff/pull/2738) - Only trigger compound statements after select keywords by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2737](https://github.com/charliermarsh/ruff/pull/2737) - Use `function_type::classify` for `yield-in-init` by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2742](https://github.com/charliermarsh/ruff/pull/2742) - Allow named unicodes in bidirectional escape check by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2710](https://github.com/charliermarsh/ruff/pull/2710) - Respect NO_COLOR flags in --show-source by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2750](https://github.com/charliermarsh/ruff/pull/2750) - Flag private member accesses on calls et al by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2753](https://github.com/charliermarsh/ruff/pull/2753) #### New Contributors - [@​ngnpope](https://github.com/ngnpope) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2692](https://github.com/charliermarsh/ruff/pull/2692) - [@​ppentchev](https://github.com/ppentchev) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2701](https://github.com/charliermarsh/ruff/pull/2701) - [@​tomecki](https://github.com/tomecki) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2716](https://github.com/charliermarsh/ruff/pull/2716) **Full Changelog**: astral-sh/ruff@v0.0.244...v0.0.245 ### [`v0.0.244`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.244) [Compare Source](https://github.com/charliermarsh/ruff/compare/v0.0.243...v0.0.244) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Rules - \[`pylint`]: bidirectional-unicode by [@​colin99d](https://github.com/colin99d) in [https://github.com/charliermarsh/ruff/pull/2589](https://github.com/charliermarsh/ruff/pull/2589) - Implement whitespace-around-keywords (E271, E272, E273, E274) by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2653](https://github.com/charliermarsh/ruff/pull/2653) - Implement whitespace-before-comment (E261, E262, E265, E266) by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2654](https://github.com/charliermarsh/ruff/pull/2654) ##### Settings - flake8-annotations: add ignore-fully-untyped by [@​akx](https://github.com/akx) in [https://github.com/charliermarsh/ruff/pull/2128](https://github.com/charliermarsh/ruff/pull/2128) - Add `--exit-non-zero-on-fix` by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2668](https://github.com/charliermarsh/ruff/pull/2668) ##### Documentation - Derive `explanation` method on Rule struct via rustdoc by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2642](https://github.com/charliermarsh/ruff/pull/2642) - Create per-rule pages and link from README by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2644](https://github.com/charliermarsh/ruff/pull/2644) - Add documentation for flake8-quotes rules by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2650](https://github.com/charliermarsh/ruff/pull/2650) - Disable autofix for flake8-print rules by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2651](https://github.com/charliermarsh/ruff/pull/2651) - Add documentation for eradicate, flake8-import-conventions, and flake8-no-pep420 by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2652](https://github.com/charliermarsh/ruff/pull/2652) - doc: add documentation for TRY002 by [@​nm-remarkable](https://github.com/nm-remarkable) in [https://github.com/charliermarsh/ruff/pull/2655](https://github.com/charliermarsh/ruff/pull/2655) ##### Bug Fixes - Accommodate pos-only arguments when checking self name by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2626](https://github.com/charliermarsh/ruff/pull/2626) - Avoid non-recursion in nested typing function calls by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2627](https://github.com/charliermarsh/ruff/pull/2627) - Avoid no-unnecessary-dict-kwargs errors with reserved keywords by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2628](https://github.com/charliermarsh/ruff/pull/2628) - Treat [@​staticmethod](https://github.com/staticmethod) as higher-precedence than ABC by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2635](https://github.com/charliermarsh/ruff/pull/2635) - Avoid boolean-trap errors in `__setitem__` by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2636](https://github.com/charliermarsh/ruff/pull/2636) - Skip ternary fixes for yields and awaits by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2637](https://github.com/charliermarsh/ruff/pull/2637) - Ignore all non-`.py` wrt. implicit namespace package by [@​scop](https://github.com/scop) in [https://github.com/charliermarsh/ruff/pull/2640](https://github.com/charliermarsh/ruff/pull/2640) - Avoid false-positive in chained type calls by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2663](https://github.com/charliermarsh/ruff/pull/2663) - Treat annotated assignments in class and module scopes as runtime by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2667](https://github.com/charliermarsh/ruff/pull/2667) - Accommodate multiple `@pytest.mark.parametrize` decorators by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2662](https://github.com/charliermarsh/ruff/pull/2662) - Use separate exit codes for fatal errors vs. lint errors by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2670](https://github.com/charliermarsh/ruff/pull/2670) #### New Contributors - [@​nm-remarkable](https://github.com/nm-remarkable) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2655](https://github.com/charliermarsh/ruff/pull/2655) **Full Changelog**: astral-sh/ruff@v0.0.243...v0.0.244 ### [`v0.0.243`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.243) [Compare Source](https://github.com/charliermarsh/ruff/compare/v0.0.242...v0.0.243) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Rules - Add flake8-pie single_starts_ends_with by [@​sbdchd](https://github.com/sbdchd) in [https://github.com/charliermarsh/ruff/pull/2616](https://github.com/charliermarsh/ruff/pull/2616) ##### Bug Fixes - fix(pep8-naming): `typing.NamedTuple` and `typing.TypedDict` treatment by [@​scop](https://github.com/scop) in [https://github.com/charliermarsh/ruff/pull/2611](https://github.com/charliermarsh/ruff/pull/2611) - Support `ignore-names` for all relevant pep8-naming rules by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2617](https://github.com/charliermarsh/ruff/pull/2617) - Avoid removing quotes from runtime annotations by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2614](https://github.com/charliermarsh/ruff/pull/2614) - Support relative paths for typing-modules by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2615](https://github.com/charliermarsh/ruff/pull/2615) **Full Changelog**: astral-sh/ruff@v0.0.242...v0.0.243 ### [`v0.0.242`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.242) [Compare Source](https://github.com/charliermarsh/ruff/compare/v0.0.241...v0.0.242) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Rules - Implement pylint's `too-many-branches` rule (`PLR0912`) by [@​chanman3388](https://github.com/chanman3388) in [https://github.com/charliermarsh/ruff/pull/2550](https://github.com/charliermarsh/ruff/pull/2550) - Implement pylint's `too-many-return-statements` rule (`PLR0911`) by [@​chanman3388](https://github.com/chanman3388) in [https://github.com/charliermarsh/ruff/pull/2564](https://github.com/charliermarsh/ruff/pull/2564) - \[`pyupgrade`]: Removes quotes from annotations by [@​colin99d](https://github.com/colin99d) in [https://github.com/charliermarsh/ruff/pull/2431](https://github.com/charliermarsh/ruff/pull/2431) - \[`pylint`]: bad-str-strip-call by [@​colin99d](https://github.com/colin99d) in [https://github.com/charliermarsh/ruff/pull/2570](https://github.com/charliermarsh/ruff/pull/2570) - Implement pycodestyle's logical line detection by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/1130](https://github.com/charliermarsh/ruff/pull/1130) - Enable autofix for unnecessary-paren-on-raise-exception by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2596](https://github.com/charliermarsh/ruff/pull/2596) - Automatically remove empty type-checking blocks by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2598](https://github.com/charliermarsh/ruff/pull/2598) ##### Bug Fixes - Avoid infinite renames for unused-loop-control-variable by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2581](https://github.com/charliermarsh/ruff/pull/2581) - Ignore direct root-children in implicit-namespace-package by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2565](https://github.com/charliermarsh/ruff/pull/2565) - Allow blank line before sticky-comment functions in docstrings by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2597](https://github.com/charliermarsh/ruff/pull/2597) - Visit deferred assignments after deferred type annotations by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2607](https://github.com/charliermarsh/ruff/pull/2607) - Fix python module invocation by [@​trottomv](https://github.com/trottomv) in [https://github.com/charliermarsh/ruff/pull/2563](https://github.com/charliermarsh/ruff/pull/2563) - Portably find ruff binary path from Python by [@​andersk](https://github.com/andersk) in [https://github.com/charliermarsh/ruff/pull/2574](https://github.com/charliermarsh/ruff/pull/2574) - fix(commented-out-code): `mypy` and `SPDX-License-Identifier` false positives by [@​scop](https://github.com/scop) in [https://github.com/charliermarsh/ruff/pull/2587](https://github.com/charliermarsh/ruff/pull/2587) #### New Contributors - [@​trottomv](https://github.com/trottomv) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2563](https://github.com/charliermarsh/ruff/pull/2563) - [@​MichaReiser](https://github.com/MichaReiser) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2088](https://github.com/charliermarsh/ruff/pull/2088) **Full Changelog**: astral-sh/ruff@v0.0.241...v0.0.242 ### [`v0.0.241`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.241) [Compare Source](https://github.com/charliermarsh/ruff/compare/v0.0.240...v0.0.241) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Deprecates - Soft-deprecate `update-check` by [@​akx](https://github.com/akx) in [https://github.com/charliermarsh/ruff/pull/2530](https://github.com/charliermarsh/ruff/pull/2530) ##### Rules - feat: add autofix for PLR0402 by [@​spaceone](https://github.com/spaceone) in [https://github.com/charliermarsh/ruff/pull/2504](https://github.com/charliermarsh/ruff/pull/2504) - Allow F811 noqa declarations on containing import lines by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2553](https://github.com/charliermarsh/ruff/pull/2553) ##### Features - Mark fixable issues in printer output by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2500](https://github.com/charliermarsh/ruff/pull/2500) - Always report parse errors back to the user by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2505](https://github.com/charliermarsh/ruff/pull/2505) - Notify user if autofix introduces syntax error by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2507](https://github.com/charliermarsh/ruff/pull/2507) - Add `known-standard-library` for each Python version by [@​JonathanPlasse](https://github.com/JonathanPlasse) in [https://github.com/charliermarsh/ruff/pull/2491](https://github.com/charliermarsh/ruff/pull/2491) ##### Bug Fixes - Avoid renaming unused loop variables with deferred usages by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2509](https://github.com/charliermarsh/ruff/pull/2509) - \[`flake8-self`] Fix False Negative Issue on Rule `SLF001` by [@​saadmk11](https://github.com/saadmk11) in [https://github.com/charliermarsh/ruff/pull/2527](https://github.com/charliermarsh/ruff/pull/2527) - Minor fixes to PLR0915 logic by [@​chanman3388](https://github.com/chanman3388) in [https://github.com/charliermarsh/ruff/pull/2518](https://github.com/charliermarsh/ruff/pull/2518) - Exit upon showing files with `--show-files` by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2543](https://github.com/charliermarsh/ruff/pull/2543) - Ignore direct source-children in `implicit-namespace-package` by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2560](https://github.com/charliermarsh/ruff/pull/2560) - Allow `list()` and `tuple()` calls in `__all__` assignments by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2499](https://github.com/charliermarsh/ruff/pull/2499) - Don't walk past project root when figuring out exclusion by [@​akx](https://github.com/akx) in [https://github.com/charliermarsh/ruff/pull/2471](https://github.com/charliermarsh/ruff/pull/2471) - Avoid hang when detecting trailing comments by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2549](https://github.com/charliermarsh/ruff/pull/2549) #### New Contributors - [@​JacobCoffee](https://github.com/JacobCoffee) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2516](https://github.com/charliermarsh/ruff/pull/2516) - [@​Pierre-Sassoulas](https://github.com/Pierre-Sassoulas) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2559](https://github.com/charliermarsh/ruff/pull/2559) **Full Changelog**: astral-sh/ruff@v0.0.240...v0.0.241 ### [`v0.0.240`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.240) [Compare Source](https://github.com/charliermarsh/ruff/compare/v0.0.239...v0.0.240) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Rules - \[`pyupgrade`]: Remove outdated `sys.version_info` blocks by [@​colin99d](https://github.com/colin99d) in [https://github.com/charliermarsh/ruff/pull/2099](https://github.com/charliermarsh/ruff/pull/2099) - \[`flake8-self`] Add Plugin and Rule `SLF001` by [@​saadmk11](https://github.com/saadmk11) in [https://github.com/charliermarsh/ruff/pull/2470](https://github.com/charliermarsh/ruff/pull/2470) - \[`pylint`] Implement pylint's `too-many-statements` rule (`PLR0915`) by [@​chanman3388](https://github.com/chanman3388) in [https://github.com/charliermarsh/ruff/pull/2445](https://github.com/charliermarsh/ruff/pull/2445) ##### Settings - \[`isort`] Support forced_separate by [@​akx](https://github.com/akx) in [https://github.com/charliermarsh/ruff/pull/2268](https://github.com/charliermarsh/ruff/pull/2268) - \[`isort`] Add isort option lines-after-imports by [@​reidswan](https://github.com/reidswan) in [https://github.com/charliermarsh/ruff/pull/2440](https://github.com/charliermarsh/ruff/pull/2440) - Allow non-ruff.toml-named files for --config by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2463](https://github.com/charliermarsh/ruff/pull/2463) ##### Bug Fixes - Trigger, but don't fix, SIM rules if comments are present by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2450](https://github.com/charliermarsh/ruff/pull/2450) - Only avoid PEP604 rewrites for pre-Python 3.10 code by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2449](https://github.com/charliermarsh/ruff/pull/2449) - Use LibCST to reverse Yoda conditions by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2468](https://github.com/charliermarsh/ruff/pull/2468) - fix: assertTrue()/assertFalse() fixer should not test for identity by [@​spaceone](https://github.com/spaceone) in [https://github.com/charliermarsh/ruff/pull/2476](https://github.com/charliermarsh/ruff/pull/2476) - Treat `if 0:` and `if False:` as type-checking blocks by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2485](https://github.com/charliermarsh/ruff/pull/2485) - Avoid iterating over body twice by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2439](https://github.com/charliermarsh/ruff/pull/2439) - more builtin name checks when autofixing by [@​spaceone](https://github.com/spaceone) in [https://github.com/charliermarsh/ruff/pull/2430](https://github.com/charliermarsh/ruff/pull/2430) - Respect parent noqa in --add-noqa by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2464](https://github.com/charliermarsh/ruff/pull/2464) - Avoid removing un-selected codes when applying `--add-noqa` edits by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2465](https://github.com/charliermarsh/ruff/pull/2465) - Carry-over `ignore` to next config layer if `select = []` by [@​not-my-profile](https://github.com/not-my-profile) in [https://github.com/charliermarsh/ruff/pull/2467](https://github.com/charliermarsh/ruff/pull/2467) - Visit NamedExpr values before targets by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2484](https://github.com/charliermarsh/ruff/pull/2484) #### New Contributors - [@​reidswan](https://github.com/reidswan) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2440](https://github.com/charliermarsh/ruff/pull/2440) - [@​chanman3388](https://github.com/chanman3388) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2445](https://github.com/charliermarsh/ruff/pull/2445) **Full Changelog**: astral-sh/ruff@v0.0.239...v0.0.240 ### [`v0.0.239`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.239) [Compare Source](https://github.com/charliermarsh/ruff/compare/v0.0.238...v0.0.239) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### Rules - \[`pyupgrade`] Implement import-replacement rule (`UP035`) by [@​colin99d](https://github.com/colin99d) in [https://github.com/charliermarsh/ruff/pull/2049](https://github.com/charliermarsh/ruff/pull/2049) - \[`flake8-raise`] Add Plugin and `RSE102` Rule by [@​saadmk11](https://github.com/saadmk11) in [https://github.com/charliermarsh/ruff/pull/2354](https://github.com/charliermarsh/ruff/pull/2354) - \[`flake8-quotes`] Allow implicit multiline strings with internal quotes to use non-preferred quote by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2416](https://github.com/charliermarsh/ruff/pull/2416) ##### Documentation - Add a link to MkDocs by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2370](https://github.com/charliermarsh/ruff/pull/2370) - Use human-readable types for documentation values by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2375](https://github.com/charliermarsh/ruff/pull/2375) ##### Bug Fixes - \[`I001`] fix isort check for files with tabs and no indented blocks by [@​sciyoshi](https://github.com/sciyoshi) in [https://github.com/charliermarsh/ruff/pull/2374](https://github.com/charliermarsh/ruff/pull/2374) - Don't panic for --statistics with no errors by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2391](https://github.com/charliermarsh/ruff/pull/2391) - Handle multi-byte lines in RUF100 by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2392](https://github.com/charliermarsh/ruff/pull/2392) - Avoid implicit-namespace-package checks for .pyi files by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2420](https://github.com/charliermarsh/ruff/pull/2420) - Include per-file ignore matches in debug logging by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2376](https://github.com/charliermarsh/ruff/pull/2376) - Include method name in B027 message by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2403](https://github.com/charliermarsh/ruff/pull/2403) - Avoid flagging same-condition cases in SIM103 by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2404](https://github.com/charliermarsh/ruff/pull/2404) - feat: let SIM103 return expressions without bool() wrapping by [@​spaceone](https://github.com/spaceone) in [https://github.com/charliermarsh/ruff/pull/2410](https://github.com/charliermarsh/ruff/pull/2410) - feat: let SIM210 return expressions without bool() wrapping ([#​2410](https://github.com/charliermarsh/ruff/issues/2410)) by [@​spaceone](https://github.com/spaceone) in [https://github.com/charliermarsh/ruff/pull/2426](https://github.com/charliermarsh/ruff/pull/2426) - fix: ignore fix if "bool" is not builtin by [@​spaceone](https://github.com/spaceone) in [https://github.com/charliermarsh/ruff/pull/2429](https://github.com/charliermarsh/ruff/pull/2429) - Avoid Bandit false-positives for empty-string-as-password by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2421](https://github.com/charliermarsh/ruff/pull/2421) #### New Contributors - [@​eriknw](https://github.com/eriknw) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2380](https://github.com/charliermarsh/ruff/pull/2380) - [@​has2k1](https://github.com/has2k1) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2386](https://github.com/charliermarsh/ruff/pull/2386) **Full Changelog**: astral-sh/ruff@v0.0.238...v0.0.239 ### [`v0.0.238`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.238) [Compare Source](https://github.com/charliermarsh/ruff/compare/v0.0.237...v0.0.238) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed #####⚠️ Breaking Changes⚠️ ##### `select`, `extend-select`, `ignore`, and `extend-ignore` have new semantics ([#​2312](https://github.com/charliermarsh/ruff/pull/2312)) Previously, the interplay between `select` and its related options could lead to unexpected behavior. For example, `ruff --select E501 --ignore ALL` and `ruff --select E501 --extend-ignore ALL` behaved differently. (See [#​2312](https://github.com/charliermarsh/ruff/pull/2312) for more examples.) The new semantics are such that Ruff uses the "highest-priority" `select` as the basis for the rule set, and then applies any `extend-select`, `ignore`, and `extend-ignore` adjustments. CLI options are given higher priority than `pyproject.toml` options, and the current `pyproject.toml` file is given higher priority than any inherited `pyproject.toml` files. As an example: `ruff --select F401` will select rule `F401`, and ignore any of the modifiers from the `pyproject.toml`, as the "highest-priorty" select kicks off the resolution chain. This change is largely backwards compatible -- most users should experience no change in behavior. For more, see [BREAKING_CHANGES.md](https://github.com/charliermarsh/ruff/blob/main/BREAKING_CHANGES.md#select-extend-select-ignore-and-extend-ignore-have-new-semantics-2312). ##### `remove-six-compat` (`UP016`) has been removed ([#​2332](https://github.com/charliermarsh/ruff/pull/2332)) The `remove-six-compat` rule has been removed. This rule was only useful for one-time Python 2-to-3 upgrades. ##### Rules - Implement Pylint's `too-many-arguments` rule (`PLR0913`) by [@​akhildevelops](https://github.com/akhildevelops) in [https://github.com/charliermarsh/ruff/pull/2308](https://github.com/charliermarsh/ruff/pull/2308) - Extend conventional imports defaults to include TensorFlow et al by [@​sbrugman](https://github.com/sbrugman) in [https://github.com/charliermarsh/ruff/pull/2353](https://github.com/charliermarsh/ruff/pull/2353) ##### Settings - feat: add ruff --statistics by [@​spaceone](https://github.com/spaceone) in [https://github.com/charliermarsh/ruff/pull/2284](https://github.com/charliermarsh/ruff/pull/2284) - Ignore magic comparisons to bytes by default by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2365](https://github.com/charliermarsh/ruff/pull/2365) - Implement `ruff linter` subcommand by [@​not-my-profile](https://github.com/not-my-profile) in [https://github.com/charliermarsh/ruff/pull/2294](https://github.com/charliermarsh/ruff/pull/2294) - Improve rule config resolution by [@​not-my-profile](https://github.com/not-my-profile) in [https://github.com/charliermarsh/ruff/pull/2312](https://github.com/charliermarsh/ruff/pull/2312) ##### Bug Fixes - Refine criteria for `exc_info` logger rules by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2364](https://github.com/charliermarsh/ruff/pull/2364) - Respect per-file-ignores when checking noqa by [@​sciyoshi](https://github.com/sciyoshi) in [https://github.com/charliermarsh/ruff/pull/2309](https://github.com/charliermarsh/ruff/pull/2309) - Place star before other member imports by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2320](https://github.com/charliermarsh/ruff/pull/2320) - Allow list comprehensions for **all** assignment by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2326](https://github.com/charliermarsh/ruff/pull/2326) - \[`TRY201`] don't check raise statements in nested exception handlers by [@​sciyoshi](https://github.com/sciyoshi) in [https://github.com/charliermarsh/ruff/pull/2337](https://github.com/charliermarsh/ruff/pull/2337) - include tomllib in standard lib by [@​sbrugman](https://github.com/sbrugman) in [https://github.com/charliermarsh/ruff/pull/2345](https://github.com/charliermarsh/ruff/pull/2345) - Avoid removing trailing comments when autofixing by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2352](https://github.com/charliermarsh/ruff/pull/2352) - \[`I001`] fix isort for files with tab-based indentation by [@​sciyoshi](https://github.com/sciyoshi) in [https://github.com/charliermarsh/ruff/pull/2361](https://github.com/charliermarsh/ruff/pull/2361) - Disable incompatible rules rather than merely warning by [@​charliermarsh](https://github.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/2369](https://github.com/charliermarsh/ruff/pull/2369) #### New Contributors - [@​chirag127](https://github.com/chirag127) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2307](https://github.com/charliermarsh/ruff/pull/2307) - [@​akhildevelops](https://github.com/akhildevelops) made their first contribution in [https://github.com/charliermarsh/ruff/pull/2308](https://github.com/charliermarsh/ruff/pull/2308) **Full Changelog**: astral-sh/ruff@v0.0.237...v0.0.238 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/premiscale/premiscale). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xNDMuMSIsInVwZGF0ZWRJblZlciI6IjM0LjE0My4xIn0=-->
## Summary Follow-up to #11901 This PR avoids displaying the syntax errors as log message now that the `E999` diagnostic cannot be disabled. For context on why this was added, refer to #2505. Basically, we would allow ignoring the syntax error diagnostic because certain syntax feature weren't supported back then like `match` statement. And, if a user ignored `E999`, Ruff would give no feedback if the source code contained any syntax error. So, this log message was a way to indicate to the user even if `E999` was disabled. The current state of the parser is such that (a) it matches with the latest grammar and (b) it's easy to add support for any new syntax. **Note:** This PR doesn't remove the `DisplayParseError` struct because it's still being used by the formatter. ## Test Plan Update existing snapshots from the integration tests.
## Summary Follow-up to #11901 This PR avoids displaying the syntax errors as log message now that the `E999` diagnostic cannot be disabled. For context on why this was added, refer to #2505. Basically, we would allow ignoring the syntax error diagnostic because certain syntax feature weren't supported back then like `match` statement. And, if a user ignored `E999`, Ruff would give no feedback if the source code contained any syntax error. So, this log message was a way to indicate to the user even if `E999` was disabled. The current state of the parser is such that (a) it matches with the latest grammar and (b) it's easy to add support for any new syntax. **Note:** This PR doesn't remove the `DisplayParseError` struct because it's still being used by the formatter. ## Test Plan Update existing snapshots from the integration tests.
## Summary Follow-up to #11901 This PR avoids displaying the syntax errors as log message now that the `E999` diagnostic cannot be disabled. For context on why this was added, refer to #2505. Basically, we would allow ignoring the syntax error diagnostic because certain syntax feature weren't supported back then like `match` statement. And, if a user ignored `E999`, Ruff would give no feedback if the source code contained any syntax error. So, this log message was a way to indicate to the user even if `E999` was disabled. The current state of the parser is such that (a) it matches with the latest grammar and (b) it's easy to add support for any new syntax. **Note:** This PR doesn't remove the `DisplayParseError` struct because it's still being used by the formatter. ## Test Plan Update existing snapshots from the integration tests.
## Summary Follow-up to #11901 This PR avoids displaying the syntax errors as log message now that the `E999` diagnostic cannot be disabled. For context on why this was added, refer to #2505. Basically, we would allow ignoring the syntax error diagnostic because certain syntax feature weren't supported back then like `match` statement. And, if a user ignored `E999`, Ruff would give no feedback if the source code contained any syntax error. So, this log message was a way to indicate to the user even if `E999` was disabled. The current state of the parser is such that (a) it matches with the latest grammar and (b) it's easy to add support for any new syntax. **Note:** This PR doesn't remove the `DisplayParseError` struct because it's still being used by the formatter. ## Test Plan Update existing snapshots from the integration tests.
Summary
We treat parse errors as lint errors -- they have their own code (
E999
). If we fail to parse a file, we add anE999
diagnostic, and move on. Parse errors are recoverable, as many checks don't rely on the AST (likeE501
, line-length enforcement) -- so even if the parse fails, we can still report some other diagnostics.However, here's a common and confusing workflow: say a user introduces (e.g.) a
match
statement into their code, then runsruff --select I /path/to/file.py
. They'll then wonder why their imports aren't being sorted. We can't parsematch
statements, so under the hood, we're adding anE999
to the diagnostic list, but it's being suppressed (sinceE999
isn't in theselect
), so the user doesn't get any feedback.This PR modifies the linter to propagate parse errors. They're still included as
E999
, and we still try to find other violations; however, we also log a warning to the console and avoid doing any caching to the file (so the warning appears on every invocation).Here's an example.
Given these code changes:
We now yield:
So it's a little redundant, between the warning and the
E999
, but I think it's much clearer.Closes #2473.