Skip to content
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

Ignore collapsible-if violations for if False: and if True: #3732

Conversation

JonathanPlasse
Copy link
Contributor

@JonathanPlasse JonathanPlasse commented Mar 25, 2023

Instead of using this to disable code

if False and self._requestid2response_queue:
	do_something()

Use this

if False:
    if self._requestid2response_queue:
        do_something()

It will still flag the rule SIM102 but will not auto-fix.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2023

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.00     14.7±0.33ms     2.8 MB/sec    1.01     15.0±0.20ms     2.7 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.8±0.01ms     4.4 MB/sec    1.01      3.8±0.01ms     4.4 MB/sec
linter/all-rules/numpy/globals.py          1.00    415.0±1.55µs     7.1 MB/sec    1.01    418.3±2.48µs     7.1 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.4±0.10ms     4.0 MB/sec    1.00      6.4±0.01ms     4.0 MB/sec
linter/default-rules/large/dataset.py      1.00      7.8±0.02ms     5.2 MB/sec    1.01      7.9±0.02ms     5.1 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1727.0±4.86µs     9.6 MB/sec    1.01   1752.8±3.23µs     9.5 MB/sec
linter/default-rules/numpy/globals.py      1.00    183.3±1.60µs    16.1 MB/sec    1.01    185.1±1.39µs    15.9 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.6±0.02ms     7.0 MB/sec    1.01      3.7±0.09ms     6.9 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.00     19.8±0.35ms     2.1 MB/sec    1.01     20.0±0.38ms     2.0 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      5.1±0.13ms     3.3 MB/sec    1.01      5.1±0.18ms     3.2 MB/sec
linter/all-rules/numpy/globals.py          1.00   614.8±19.46µs     4.8 MB/sec    1.01   620.9±24.76µs     4.8 MB/sec
linter/all-rules/pydantic/types.py         1.01      8.5±0.28ms     3.0 MB/sec    1.00      8.4±0.21ms     3.0 MB/sec
linter/default-rules/large/dataset.py      1.00     10.3±0.22ms     3.9 MB/sec    1.00     10.3±0.32ms     3.9 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00      2.2±0.08ms     7.5 MB/sec    1.01      2.3±0.07ms     7.4 MB/sec
linter/default-rules/numpy/globals.py      1.02   243.9±22.56µs    12.1 MB/sec    1.00    240.0±8.96µs    12.3 MB/sec
linter/default-rules/pydantic/types.py     1.00      4.7±0.10ms     5.5 MB/sec    1.01      4.7±0.14ms     5.4 MB/sec

@JonathanPlasse JonathanPlasse changed the title Exempt attribute expressions from SIM223 rule Fix contain_effect() Mar 25, 2023
@charliermarsh
Copy link
Member

I think the intent of #2919 was, perhaps, to avoid fixing these at all, since the author was suggesting that the use of if False and X was to temporarily deactivate the block while leaving the intended condition (X). We might consider just closing that issue, I don't know that we can really do much apart from removing that autofix entirely. If the code is intended to be temporarily disabled, then we should recommend:

if False:
  if condition:
    ...

@JonathanPlasse
Copy link
Contributor Author

https://github.com/apache/airflow/blob/f7d5b165fcb8983bd82a852dcc5088b4b7d26a91/airflow/providers/databricks/operators/databricks.py#L73-L76

if "error" in run_output:
    notebook_error = run_output["error"]
else:
    notebook_error = run_state.state_message

https://github.com/zulip/zulip/blob/0bcf03ea64ebc8ad6e621935933196e45dd26e1c/zerver/worker/queue_processors.py#L458-L461

if "email_language" in data:
    email_language = data["email_language"]
else:
    email_language = referrer.realm.default_language

Both if fixed could cause behavior change as attribute access can have side effects.

@charliermarsh
Copy link
Member

Which rule are we talking about, for clarity?

@JonathanPlasse
Copy link
Contributor Author

JonathanPlasse commented Mar 25, 2023

I changed the scope of the issue, as it is bigger than #2919.
The function contain_effect did not consider that attribute access could have side effects.

Which rule are we talking about, for clarity?

It concerns all rules that use contains_effect.

@JonathanPlasse JonathanPlasse changed the title Fix contain_effect() Fix contains_effect() Mar 25, 2023
@JonathanPlasse
Copy link
Contributor Author

This concerns these rules:

  • UselessExpression
  • CompareWithTuple
  • ExprAndNotExpr
  • ExprOrTrue
  • ExprAndFalse
  • IfElseBlockInsteadOfDictLookup
  • IfElseBlockInsteadOfDictGet
  • UnusedVariable

@JonathanPlasse
Copy link
Contributor Author

Should I add tests for each rule concerned?

@charliermarsh
Copy link
Member

Na that's not necessary. I'm just thinking about the tradeoffs here. It's true that it could be unsafe to change these, but it also hinders our ability to fix a lot of useful and valid cases, since the vast majority of attribute accesses are not effectful.

@charliermarsh
Copy link
Member

(Separately: for ExprOrTrue and ExprAndFalse, we should only abort if the effect-ful expression comes after the short-circuiting condition. E.g., False and foo() can be removed, since foo() will never execute regardless; but foo() and False can't be removed.)

@JonathanPlasse JonathanPlasse force-pushed the exempt-attributes-from-sim223-auto-fix branch from 88bdb37 to ab5d1c7 Compare March 26, 2023 10:19
@JonathanPlasse JonathanPlasse force-pushed the exempt-attributes-from-sim223-auto-fix branch from ab5d1c7 to d9f1de0 Compare March 26, 2023 10:34
@JonathanPlasse JonathanPlasse changed the title Fix contains_effect() Disable SIM102 auto-fix for if False block Mar 26, 2023
@JonathanPlasse
Copy link
Contributor Author

(Separately: for ExprOrTrue and ExprAndFalse, we should only abort if the effect-ful expression comes after the short-circuiting condition. E.g., False and foo() can be removed, since foo() will never execute regardless; but foo() and False can't be removed.)

I will make a following PR to fix this.

Na that's not necessary. I'm just thinking about the tradeoffs here. It's true that it could be unsafe to change these, but it also hinders our ability to fix a lot of useful and valid cases, since the vast majority of attribute accesses are not effectful.

I reverted the changes, as you said it will cause too many false negatives for the added auto-fix safety.

@charliermarsh charliermarsh changed the title Disable SIM102 auto-fix for if False block Ignore collapsible-if violations for if False: and if True: blcoks Mar 30, 2023
@charliermarsh charliermarsh changed the title Ignore collapsible-if violations for if False: and if True: blcoks Ignore collapsible-if violations for if False: and if True: Mar 30, 2023
@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Mar 30, 2023
@charliermarsh charliermarsh enabled auto-merge (squash) March 30, 2023 15:47
@charliermarsh charliermarsh merged commit 29c8b75 into astral-sh:main Mar 30, 2023
bruxisma referenced this pull request in ixm-one/pytest-cmake-presets Apr 5, 2023
[![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://togithub.com/charliermarsh/ruff) | `^0.0.260` ->
`^0.0.261` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/compatibility-slim/0.0.260)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/confidence-slim/0.0.260)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.261`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.261)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.260...v0.0.261)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### Rules

- \[`flake8-simplify`] Ignore `collapsible-if` violations for `if
False:` and `if True:` by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3732](https://togithub.com/charliermarsh/ruff/pull/3732)
- \[`flake8-pie`] Extend `unncessary-generator-any-all` to set
comprehensions by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3824](https://togithub.com/charliermarsh/ruff/pull/3824)
- \[`flake8-simplify`] Implement `dict-get-with-none-default` (`SIM910`)
by [@&#8203;kyoto7250](https://togithub.com/kyoto7250) in
[https://github.com/charliermarsh/ruff/pull/3874](https://togithub.com/charliermarsh/ruff/pull/3874)
- \[`flake8-annotations`] Additional simple magic return types by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3805](https://togithub.com/charliermarsh/ruff/pull/3805)
- \[`flake8-pyi`]: fix PYI015 false positive on assignment of TypeVar &
friends by [@&#8203;bluetech](https://togithub.com/bluetech) in
[https://github.com/charliermarsh/ruff/pull/3861](https://togithub.com/charliermarsh/ruff/pull/3861)

##### Bug Fixes

- Improve robustness of argument removal for `encode` calls by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3802](https://togithub.com/charliermarsh/ruff/pull/3802)
- Fix SIM222 and SIM223 false positive by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3832](https://togithub.com/charliermarsh/ruff/pull/3832)
- When checking module visibility, don't check entire ancestry by
[@&#8203;Hnasar](https://togithub.com/Hnasar) in
[https://github.com/charliermarsh/ruff/pull/3835](https://togithub.com/charliermarsh/ruff/pull/3835)
- Improve top-of-file insertions for required imports by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3779](https://togithub.com/charliermarsh/ruff/pull/3779)
- Use multi-fix semantics for `inplace` removal by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3804](https://togithub.com/charliermarsh/ruff/pull/3804)
- Flag non-`Name` expressions in `duplicate-isinstance-call` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3817](https://togithub.com/charliermarsh/ruff/pull/3817)
- Avoid `unnecessary-comprehension-any-all` for async generators by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3823](https://togithub.com/charliermarsh/ruff/pull/3823)
- Fix `is_module_name()` and improve perf of `is_identifier()` by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3795](https://togithub.com/charliermarsh/ruff/pull/3795)
- Allow starred arguments in B030 by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3871](https://togithub.com/charliermarsh/ruff/pull/3871)
- Support mutually exclusive branches for `B031` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3844](https://togithub.com/charliermarsh/ruff/pull/3844)
- Consider logger candidate from `logging` module only by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3878](https://togithub.com/charliermarsh/ruff/pull/3878)

##### Core

- Add import insertion support to autofix capabilities by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3787](https://togithub.com/charliermarsh/ruff/pull/3787)
- Generate `ImportMap` from module path to imported dependencies by
[@&#8203;chanman3388](https://togithub.com/chanman3388) in
[https://github.com/charliermarsh/ruff/pull/3243](https://togithub.com/charliermarsh/ruff/pull/3243)

##### Docs

- Add documentation for `ruff-action` (GitHub Action!) by
[@&#8203;brucearctor](https://togithub.com/brucearctor) in
[https://github.com/charliermarsh/ruff/pull/3857](https://togithub.com/charliermarsh/ruff/pull/3857)

#### New Contributors

- [@&#8203;AetherUnbound](https://togithub.com/AetherUnbound) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3806](https://togithub.com/charliermarsh/ruff/pull/3806)
- [@&#8203;Hnasar](https://togithub.com/Hnasar) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3835](https://togithub.com/charliermarsh/ruff/pull/3835)
- [@&#8203;nvuillam](https://togithub.com/nvuillam) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3848](https://togithub.com/charliermarsh/ruff/pull/3848)
- [@&#8203;brucearctor](https://togithub.com/brucearctor) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3857](https://togithub.com/charliermarsh/ruff/pull/3857)

**Full Changelog**:
astral-sh/ruff@v0.0.260...v0.0.261

</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:eyJjcmVhdGVkSW5WZXIiOiIzNS4zMi4yIiwidXBkYXRlZEluVmVyIjoiMzUuMzIuMiJ9-->

Signed-off-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot referenced this pull request in allenporter/pyrainbird Apr 7, 2023
[![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://togithub.com/charliermarsh/ruff) | `==0.0.260` ->
`==0.0.261` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/compatibility-slim/0.0.260)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/confidence-slim/0.0.260)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.261`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.261)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.260...v0.0.261)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### Rules

- \[`flake8-simplify`] Ignore `collapsible-if` violations for `if
False:` and `if True:` by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3732](https://togithub.com/charliermarsh/ruff/pull/3732)
- \[`flake8-pie`] Extend `unncessary-generator-any-all` to set
comprehensions by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3824](https://togithub.com/charliermarsh/ruff/pull/3824)
- \[`flake8-simplify`] Implement `dict-get-with-none-default` (`SIM910`)
by [@&#8203;kyoto7250](https://togithub.com/kyoto7250) in
[https://github.com/charliermarsh/ruff/pull/3874](https://togithub.com/charliermarsh/ruff/pull/3874)
- \[`flake8-annotations`] Additional simple magic return types by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3805](https://togithub.com/charliermarsh/ruff/pull/3805)
- \[`flake8-pyi`]: fix PYI015 false positive on assignment of TypeVar &
friends by [@&#8203;bluetech](https://togithub.com/bluetech) in
[https://github.com/charliermarsh/ruff/pull/3861](https://togithub.com/charliermarsh/ruff/pull/3861)

##### Bug Fixes

- Improve robustness of argument removal for `encode` calls by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3802](https://togithub.com/charliermarsh/ruff/pull/3802)
- Fix SIM222 and SIM223 false positive by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3832](https://togithub.com/charliermarsh/ruff/pull/3832)
- When checking module visibility, don't check entire ancestry by
[@&#8203;Hnasar](https://togithub.com/Hnasar) in
[https://github.com/charliermarsh/ruff/pull/3835](https://togithub.com/charliermarsh/ruff/pull/3835)
- Improve top-of-file insertions for required imports by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3779](https://togithub.com/charliermarsh/ruff/pull/3779)
- Use multi-fix semantics for `inplace` removal by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3804](https://togithub.com/charliermarsh/ruff/pull/3804)
- Flag non-`Name` expressions in `duplicate-isinstance-call` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3817](https://togithub.com/charliermarsh/ruff/pull/3817)
- Avoid `unnecessary-comprehension-any-all` for async generators by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3823](https://togithub.com/charliermarsh/ruff/pull/3823)
- Fix `is_module_name()` and improve perf of `is_identifier()` by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3795](https://togithub.com/charliermarsh/ruff/pull/3795)
- Allow starred arguments in B030 by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3871](https://togithub.com/charliermarsh/ruff/pull/3871)
- Support mutually exclusive branches for `B031` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3844](https://togithub.com/charliermarsh/ruff/pull/3844)
- Consider logger candidate from `logging` module only by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3878](https://togithub.com/charliermarsh/ruff/pull/3878)

##### Core

- Add import insertion support to autofix capabilities by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3787](https://togithub.com/charliermarsh/ruff/pull/3787)
- Generate `ImportMap` from module path to imported dependencies by
[@&#8203;chanman3388](https://togithub.com/chanman3388) in
[https://github.com/charliermarsh/ruff/pull/3243](https://togithub.com/charliermarsh/ruff/pull/3243)

##### Docs

- Add documentation for `ruff-action` (GitHub Action!) by
[@&#8203;brucearctor](https://togithub.com/brucearctor) in
[https://github.com/charliermarsh/ruff/pull/3857](https://togithub.com/charliermarsh/ruff/pull/3857)

#### New Contributors

- [@&#8203;AetherUnbound](https://togithub.com/AetherUnbound) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3806](https://togithub.com/charliermarsh/ruff/pull/3806)
- [@&#8203;Hnasar](https://togithub.com/Hnasar) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3835](https://togithub.com/charliermarsh/ruff/pull/3835)
- [@&#8203;nvuillam](https://togithub.com/nvuillam) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3848](https://togithub.com/charliermarsh/ruff/pull/3848)
- [@&#8203;brucearctor](https://togithub.com/brucearctor) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3857](https://togithub.com/charliermarsh/ruff/pull/3857)

**Full Changelog**:
astral-sh/ruff@v0.0.260...v0.0.261

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **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/allenporter/pyrainbird).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4zNC4xIiwidXBkYXRlZEluVmVyIjoiMzUuMzQuMSJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot referenced this pull request in allenporter/flux-local Apr 7, 2023
[![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://togithub.com/charliermarsh/ruff) | `==0.0.260` ->
`==0.0.261` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/compatibility-slim/0.0.260)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.261/confidence-slim/0.0.260)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.261`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.261)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.260...v0.0.261)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### Rules

- \[`flake8-simplify`] Ignore `collapsible-if` violations for `if
False:` and `if True:` by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3732](https://togithub.com/charliermarsh/ruff/pull/3732)
- \[`flake8-pie`] Extend `unncessary-generator-any-all` to set
comprehensions by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3824](https://togithub.com/charliermarsh/ruff/pull/3824)
- \[`flake8-simplify`] Implement `dict-get-with-none-default` (`SIM910`)
by [@&#8203;kyoto7250](https://togithub.com/kyoto7250) in
[https://github.com/charliermarsh/ruff/pull/3874](https://togithub.com/charliermarsh/ruff/pull/3874)
- \[`flake8-annotations`] Additional simple magic return types by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3805](https://togithub.com/charliermarsh/ruff/pull/3805)
- \[`flake8-pyi`]: fix PYI015 false positive on assignment of TypeVar &
friends by [@&#8203;bluetech](https://togithub.com/bluetech) in
[https://github.com/charliermarsh/ruff/pull/3861](https://togithub.com/charliermarsh/ruff/pull/3861)

##### Bug Fixes

- Improve robustness of argument removal for `encode` calls by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3802](https://togithub.com/charliermarsh/ruff/pull/3802)
- Fix SIM222 and SIM223 false positive by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3832](https://togithub.com/charliermarsh/ruff/pull/3832)
- When checking module visibility, don't check entire ancestry by
[@&#8203;Hnasar](https://togithub.com/Hnasar) in
[https://github.com/charliermarsh/ruff/pull/3835](https://togithub.com/charliermarsh/ruff/pull/3835)
- Improve top-of-file insertions for required imports by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3779](https://togithub.com/charliermarsh/ruff/pull/3779)
- Use multi-fix semantics for `inplace` removal by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3804](https://togithub.com/charliermarsh/ruff/pull/3804)
- Flag non-`Name` expressions in `duplicate-isinstance-call` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3817](https://togithub.com/charliermarsh/ruff/pull/3817)
- Avoid `unnecessary-comprehension-any-all` for async generators by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3823](https://togithub.com/charliermarsh/ruff/pull/3823)
- Fix `is_module_name()` and improve perf of `is_identifier()` by
[@&#8203;JonathanPlasse](https://togithub.com/JonathanPlasse) in
[https://github.com/charliermarsh/ruff/pull/3795](https://togithub.com/charliermarsh/ruff/pull/3795)
- Allow starred arguments in B030 by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3871](https://togithub.com/charliermarsh/ruff/pull/3871)
- Support mutually exclusive branches for `B031` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3844](https://togithub.com/charliermarsh/ruff/pull/3844)
- Consider logger candidate from `logging` module only by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3878](https://togithub.com/charliermarsh/ruff/pull/3878)

##### Core

- Add import insertion support to autofix capabilities by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3787](https://togithub.com/charliermarsh/ruff/pull/3787)
- Generate `ImportMap` from module path to imported dependencies by
[@&#8203;chanman3388](https://togithub.com/chanman3388) in
[https://github.com/charliermarsh/ruff/pull/3243](https://togithub.com/charliermarsh/ruff/pull/3243)

##### Docs

- Add documentation for `ruff-action` (GitHub Action!) by
[@&#8203;brucearctor](https://togithub.com/brucearctor) in
[https://github.com/charliermarsh/ruff/pull/3857](https://togithub.com/charliermarsh/ruff/pull/3857)

#### New Contributors

- [@&#8203;AetherUnbound](https://togithub.com/AetherUnbound) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3806](https://togithub.com/charliermarsh/ruff/pull/3806)
- [@&#8203;Hnasar](https://togithub.com/Hnasar) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3835](https://togithub.com/charliermarsh/ruff/pull/3835)
- [@&#8203;nvuillam](https://togithub.com/nvuillam) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3848](https://togithub.com/charliermarsh/ruff/pull/3848)
- [@&#8203;brucearctor](https://togithub.com/brucearctor) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3857](https://togithub.com/charliermarsh/ruff/pull/3857)

**Full Changelog**:
astral-sh/ruff@v0.0.260...v0.0.261

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **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/allenporter/flux-local).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4zNC4xIiwidXBkYXRlZEluVmVyIjoiMzUuMzQuMSJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@JonathanPlasse JonathanPlasse deleted the exempt-attributes-from-sim223-auto-fix branch April 30, 2023 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SIM223 autofix makes no sense?
2 participants