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

Add checks for dataclasses #3877

Merged
merged 2 commits into from
Apr 9, 2023
Merged

Add checks for dataclasses #3877

merged 2 commits into from
Apr 9, 2023

Conversation

mosauter
Copy link
Contributor

@mosauter mosauter commented Apr 4, 2023

Adds checks specifically for dataclasses in combination with mutable defaults.

@dataclass
class A:
    mutable_default: list[int] = [1, 2, 3]

@dataclass
class B:
    even_more_dangerous: A = A()

It is quite closely related to the flake8-bugbear rules B006 (mutable-argument-default) and B008 (function-call-in-default-argument). As the original bugbear implementation doesn't really catch those errors in dataclasses (esp. the second B variant), I created the new errors under RUF200 and RUF201.

If you have some feedback in that regard it would be highly appreciated.

Also I'm not that experienced with rust in general if you have feedback there, be happy to work that in as well :)

Still working on:

  • testing
  • documentation

@mosauter mosauter force-pushed the main branch 2 times, most recently from 117b2ec to 695b0b3 Compare April 4, 2023 16:24
@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2023

PR Check Results

Ecosystem

ℹ️ ecosystem check detected changes. (+11, -0, 0 error(s))

airflow (+9, -0)

+ dev/breeze/src/airflow_breeze/params/build_prod_params.py:47:27: RUF009 Do not perform function call `get_airflow_extras` in dataclass defaults
+ dev/breeze/src/airflow_breeze/params/common_build_params.py:42:27: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
+ dev/breeze/src/airflow_breeze/params/common_build_params.py:43:39: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
+ dev/breeze/src/airflow_breeze/params/common_build_params.py:54:27: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
+ dev/breeze/src/airflow_breeze/params/common_build_params.py:56:25: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
+ dev/breeze/src/airflow_breeze/params/shell_params.py:70:27: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
+ dev/breeze/src/airflow_breeze/params/shell_params.py:71:39: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
+ dev/breeze/src/airflow_breeze/params/shell_params.py:87:27: RUF009 Do not perform function call `os.environ.get` in dataclass defaults
+ dev/breeze/src/airflow_breeze/params/shell_params.py:89:25: RUF009 Do not perform function call `os.environ.get` in dataclass defaults

scikit-build-core (+2, -0)

+ src/scikit_build_core/file_api/model/toolchains.py:41:27: RUF009 Do not perform function call `APIVersion` in dataclass defaults
+ tests/test_settings.py:23:17: RUF009 Do not perform function call `Path` in dataclass defaults

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.00     15.1±0.04ms     2.7 MB/sec    1.00     15.1±0.08ms     2.7 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.8±0.01ms     4.3 MB/sec    1.00      3.9±0.03ms     4.3 MB/sec
linter/all-rules/numpy/globals.py          1.00    417.3±3.01µs     7.1 MB/sec    1.00    419.1±4.36µs     7.0 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.5±0.02ms     3.9 MB/sec    1.00      6.5±0.05ms     3.9 MB/sec
linter/default-rules/large/dataset.py      1.01      7.9±0.02ms     5.2 MB/sec    1.00      7.8±0.02ms     5.2 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.01  1755.6±16.27µs     9.5 MB/sec    1.00   1740.5±2.65µs     9.6 MB/sec
linter/default-rules/numpy/globals.py      1.00    182.0±0.53µs    16.2 MB/sec    1.00    182.1±0.55µs    16.2 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.6±0.02ms     7.0 MB/sec    1.00      3.6±0.01ms     7.0 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.01     16.0±0.28ms     2.5 MB/sec    1.00     15.8±0.16ms     2.6 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.02      4.1±0.08ms     4.0 MB/sec    1.00      4.0±0.04ms     4.1 MB/sec
linter/all-rules/numpy/globals.py          1.02   498.5±10.04µs     5.9 MB/sec    1.00    487.2±6.05µs     6.1 MB/sec
linter/all-rules/pydantic/types.py         1.02      6.8±0.08ms     3.8 MB/sec    1.00      6.7±0.05ms     3.8 MB/sec
linter/default-rules/large/dataset.py      1.08      8.7±0.53ms     4.7 MB/sec    1.00      8.0±0.04ms     5.1 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.05  1873.0±62.95µs     8.9 MB/sec    1.00  1778.2±38.86µs     9.4 MB/sec
linter/default-rules/numpy/globals.py      1.00    192.9±5.92µs    15.3 MB/sec    1.01    194.2±4.42µs    15.2 MB/sec
linter/default-rules/pydantic/types.py     1.03      3.8±0.10ms     6.7 MB/sec    1.00      3.7±0.04ms     6.9 MB/sec

@mosauter mosauter force-pushed the main branch 5 times, most recently from 0bacc37 to 6fa00e6 Compare April 6, 2023 12:13
@mosauter mosauter marked this pull request as ready for review April 6, 2023 12:13
@charliermarsh charliermarsh self-requested a review April 6, 2023 17:49
Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, I really appreciate the thoroughness of the work here. I left some comments but they're mostly minor changes.

@@ -701,6 +701,8 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<Rule> {
(Ruff, "006") => Rule::AsyncioDanglingTask,
(Ruff, "007") => Rule::PairwiseOverZipped,
(Ruff, "100") => Rule::UnusedNOQA,
(Ruff, "200") => Rule::MutableDataclassDefault,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just make these RUF008 and RUF009. The choice of codes within the RUF category doesn't have semantic meaning, so I'd rather stick to autoincrement until the point at which we make an explicit decision to do otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Actually I found it to be quite difficult to choose something right. Might just be because the "new checks" are extremely similar to the bugbear ones and one could certainly make a case for them just being the same.

In the end I thought that matching the bugbear implementation and creating new ones is better. But at some point they probably should be combined (imho).

@@ -816,6 +816,20 @@ where
flake8_pie::rules::non_unique_enums(self, stmt, body);
}

if ruff::rules::is_dataclass(self, decorator_list) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marginal, but can we check if either of the relevant rules are enabled before doing this is_dataclass check, since this'll be more expensive (requires resolving all the decorators)? E.g.:

if self.settings.rules.any_enabled(...) {
  if ruff:rules::is_dataclass(...) {
    ...
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

)
}

const ALLOWED_FUNCS: &[&[&str]] = &[&["dataclasses", "field"]];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to make this a setting, to allow users to allow certain functions here. But, we can wait on that, see if it's a real need that comes up in Issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually thought about that (mainly because the bugbear implementation has something similar), but I couldn't come up with something I would really want there. The only thing that is sensible in my mind at least, would be something like "registering" your NamedTuples as they are immutable or ignoring the error for one specific function.

So yeah personally I did leave it as "kinda prepared if necessary, but only if needed in the future" :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, now that I've revisited that thought, it could also match the IMMUTABLE_FUNCS from here (function_call_argument_default.rs) + the added dataclass-specific dataclass.field one.

I'm not sure if you want to do that as it would probably mean exporting one or the other (or both) and having configuration options for two (very far apart) rule checkers in one of them; or duplicating the array on both sides.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this would have implications for "user-added" things. As "sharing" the list would mean the user adds a to-ignore function to the flake8-bugbear-config and it gets ignored in the dataclass as well.

Therefore I'm leaning more to a duplicate of the array at the moment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay to skip for now. Let's see if it comes up. If you do feel like implementing, my gut reaction is just to duplicate for now, but there's not great precedent to follow (it's odd to have two different configuration options for what are really very similar rules, but we also tend to avoid sharing configuration across "sub-linters").

@charliermarsh
Copy link
Member

(Also, I'm sorry that I didn't reply when this was originally proposed as a draft.)

@mosauter mosauter force-pushed the main branch 3 times, most recently from 6c3985b to 2885e7a Compare April 7, 2023 08:49
@mosauter
Copy link
Contributor Author

mosauter commented Apr 7, 2023

And regarding the "late" reply, don't be sorry. I'm following the project for quite a while now and it was (and still is) amazing what you created here. So you absolutely deserve more than ... (looking it up) ... 1 day delay until answering 😄

(Also in retrospect, it wasn't ready for review at that point)

@charliermarsh charliermarsh enabled auto-merge (squash) April 9, 2023 02:41
@charliermarsh charliermarsh merged commit d4af2dd into astral-sh:main Apr 9, 2023
@andersk
Copy link
Contributor

andersk commented Apr 20, 2023

This new rule should respect the same exemptions for mutable defaults with immutable type annotations that B006 does (see is_immutable_annotation from #821). For example, this should be allowed:

from dataclasses import dataclass
from typing import Sequence

@dataclass
class A:
    immutable_default: Sequence[int] = [1, 2, 3]

@charliermarsh
Copy link
Member

Agreed, created a new issue.

renovate bot referenced this pull request in ixm-one/pytest-cmake-presets Apr 20, 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.261` ->
`^0.0.262` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/compatibility-slim/0.0.261)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/confidence-slim/0.0.261)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

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

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

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

#### What's Changed

##### Configuration

- Allow users to extend the set of included files via `include` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3914](https://togithub.com/charliermarsh/ruff/pull/3914)
- Implement isort custom sections and ordering
([#&#8203;2419](https://togithub.com/charliermarsh/ruff/issues/2419)) by
[@&#8203;hackedd](https://togithub.com/hackedd) in
[https://github.com/charliermarsh/ruff/pull/3900](https://togithub.com/charliermarsh/ruff/pull/3900)

##### Rules

- \[`flake8-simplify`] Add autofix for `contextlib.suppress` (`SIM105`)
by [@&#8203;leiserfg](https://togithub.com/leiserfg) in
[https://github.com/charliermarsh/ruff/pull/3915](https://togithub.com/charliermarsh/ruff/pull/3915)
- \[`flake8-bandit`] Ignore assert errors (S101) in `TYPE_CHECKING`
blocks by [@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3960](https://togithub.com/charliermarsh/ruff/pull/3960)
- \[`flake8-comprehensions`] Implement
`unnecessary-literal-within-dict-call` (`C418`) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3969](https://togithub.com/charliermarsh/ruff/pull/3969)
- \[`ruff`] Add checks for mutable defaults `dataclass`es by
[@&#8203;mosauter](https://togithub.com/mosauter) in
[https://github.com/charliermarsh/ruff/pull/3877](https://togithub.com/charliermarsh/ruff/pull/3877)
- \[`flake8-import-conventions`] Add a rule for `BannedImportAlias` by
[@&#8203;stancld](https://togithub.com/stancld) in
[https://github.com/charliermarsh/ruff/pull/3926](https://togithub.com/charliermarsh/ruff/pull/3926)
- \[`flake8-pyi`] Implement duplicate types in unions (`PYI016`) by
[@&#8203;USER-5](https://togithub.com/USER-5) in
[https://github.com/charliermarsh/ruff/pull/3922](https://togithub.com/charliermarsh/ruff/pull/3922)
- \[`flake8-bandit`] Implement flake8-bandit shell injection rules by
[@&#8203;robyoung](https://togithub.com/robyoung) in
[https://github.com/charliermarsh/ruff/pull/3924](https://togithub.com/charliermarsh/ruff/pull/3924)
- \[`flake8-comprehensions`] Redirect `PIE802` to `C419` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3971](https://togithub.com/charliermarsh/ruff/pull/3971)

##### Bug Fixes

- Fix unicode handling in PLE2515 by
[@&#8203;konstin](https://togithub.com/konstin) in
[https://github.com/charliermarsh/ruff/pull/3898](https://togithub.com/charliermarsh/ruff/pull/3898)
- Avoid adding required imports to stub files by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3940](https://togithub.com/charliermarsh/ruff/pull/3940)
- Add 'or if cond' to `E712` message by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3962](https://togithub.com/charliermarsh/ruff/pull/3962)
- Ignore argument assignments when enforcing `RET504` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4004](https://togithub.com/charliermarsh/ruff/pull/4004)
- Fix (doc-)line-too-long start location by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4006](https://togithub.com/charliermarsh/ruff/pull/4006)
- Ignore stub file assignments to value-requiring targets by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4030](https://togithub.com/charliermarsh/ruff/pull/4030)
- Allow legacy C and T selectors in JSON schema by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3889](https://togithub.com/charliermarsh/ruff/pull/3889)
- Ignore `PLW2901` when using typing cast by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3891](https://togithub.com/charliermarsh/ruff/pull/3891)
- Visit comprehension to detect group name usage/overrides by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3887](https://togithub.com/charliermarsh/ruff/pull/3887)
- Ensure that tab characters aren't in multi-line strings before
throwing a violation by
[@&#8203;evanrittenhouse](https://togithub.com/evanrittenhouse) in
[https://github.com/charliermarsh/ruff/pull/3837](https://togithub.com/charliermarsh/ruff/pull/3837)
- Avoid N802 violations for `@override` methods by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3912](https://togithub.com/charliermarsh/ruff/pull/3912)
- Check for arguments in inner/outer call for `C414` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3916](https://togithub.com/charliermarsh/ruff/pull/3916)
- Do not skip analysis if `*args` present for `F523` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3923](https://togithub.com/charliermarsh/ruff/pull/3923)
- Extend SIM105 to match also 'Ellipsis only' bodies in exception
handlers by [@&#8203;leiserfg](https://togithub.com/leiserfg) in
[https://github.com/charliermarsh/ruff/pull/3925](https://togithub.com/charliermarsh/ruff/pull/3925)
- Support `pyright: ignore` comments by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3941](https://togithub.com/charliermarsh/ruff/pull/3941)
- Tidy up some `pygrep-hooks` rules by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3942](https://togithub.com/charliermarsh/ruff/pull/3942)
- Use identifier range for pytest rules by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3948](https://togithub.com/charliermarsh/ruff/pull/3948)
- Allow `typing_extensions.TypeVar` assignments in `.pyi` files by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3951](https://togithub.com/charliermarsh/ruff/pull/3951)
- Raise percent-format upgrade rule (`UP031`) for hanging modulos by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3953](https://togithub.com/charliermarsh/ruff/pull/3953)
- Check for parenthesis in implicit str concat in `PT006` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3955](https://togithub.com/charliermarsh/ruff/pull/3955)
- Do not consider nested comment as part of code by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3984](https://togithub.com/charliermarsh/ruff/pull/3984)
- Preserve type annotations when fixing `E731` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3983](https://togithub.com/charliermarsh/ruff/pull/3983)
- Remove autofix behavior for uncapitalized-environment-variables
(`SIM112`) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3988](https://togithub.com/charliermarsh/ruff/pull/3988)
- Respect typing-modules when evaluating no-return functions by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4001](https://togithub.com/charliermarsh/ruff/pull/4001)
- Avoid short-circuiting when detecting RET rules by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4002](https://togithub.com/charliermarsh/ruff/pull/4002)
- Set non-empty range for indentation diagnostics by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4005](https://togithub.com/charliermarsh/ruff/pull/4005)
- Ignore relative imports in `banned-api` rules by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4024](https://togithub.com/charliermarsh/ruff/pull/4024)
- Support relative imports in `banned-api` enforcement by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4025](https://togithub.com/charliermarsh/ruff/pull/4025)
- Treat non-future function annotations as required-at-runtime by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4028](https://togithub.com/charliermarsh/ruff/pull/4028)
- Ignore certain flake8-pyi errors within function bodies by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4029](https://togithub.com/charliermarsh/ruff/pull/4029)

#### New Contributors

- [@&#8203;tjkuson](https://togithub.com/tjkuson) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3886](https://togithub.com/charliermarsh/ruff/pull/3886)
- [@&#8203;mosauter](https://togithub.com/mosauter) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3877](https://togithub.com/charliermarsh/ruff/pull/3877)
- [@&#8203;stancld](https://togithub.com/stancld) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3926](https://togithub.com/charliermarsh/ruff/pull/3926)
- [@&#8203;USER-5](https://togithub.com/USER-5) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3922](https://togithub.com/charliermarsh/ruff/pull/3922)
- [@&#8203;robyoung](https://togithub.com/robyoung) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3924](https://togithub.com/charliermarsh/ruff/pull/3924)
- [@&#8203;hackedd](https://togithub.com/hackedd) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3900](https://togithub.com/charliermarsh/ruff/pull/3900)
- [@&#8203;justinchuby](https://togithub.com/justinchuby) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3982](https://togithub.com/charliermarsh/ruff/pull/3982)
- [@&#8203;mirecl](https://togithub.com/mirecl) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4008](https://togithub.com/charliermarsh/ruff/pull/4008)
- [@&#8203;Xemnas0](https://togithub.com/Xemnas0) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4026](https://togithub.com/charliermarsh/ruff/pull/4026)

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

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

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/flux-local Apr 21, 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.261` ->
`==0.0.262` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/compatibility-slim/0.0.261)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.262/confidence-slim/0.0.261)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

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

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

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

#### What's Changed

##### Configuration

- Allow users to extend the set of included files via `include` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3914](https://togithub.com/charliermarsh/ruff/pull/3914)
- Implement isort custom sections and ordering
([#&#8203;2419](https://togithub.com/charliermarsh/ruff/issues/2419)) by
[@&#8203;hackedd](https://togithub.com/hackedd) in
[https://github.com/charliermarsh/ruff/pull/3900](https://togithub.com/charliermarsh/ruff/pull/3900)

##### Rules

- \[`flake8-simplify`] Add autofix for `contextlib.suppress` (`SIM105`)
by [@&#8203;leiserfg](https://togithub.com/leiserfg) in
[https://github.com/charliermarsh/ruff/pull/3915](https://togithub.com/charliermarsh/ruff/pull/3915)
- \[`flake8-bandit`] Ignore assert errors (S101) in `TYPE_CHECKING`
blocks by [@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3960](https://togithub.com/charliermarsh/ruff/pull/3960)
- \[`flake8-comprehensions`] Implement
`unnecessary-literal-within-dict-call` (`C418`) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3969](https://togithub.com/charliermarsh/ruff/pull/3969)
- \[`ruff`] Add checks for mutable defaults `dataclass`es by
[@&#8203;mosauter](https://togithub.com/mosauter) in
[https://github.com/charliermarsh/ruff/pull/3877](https://togithub.com/charliermarsh/ruff/pull/3877)
- \[`flake8-import-conventions`] Add a rule for `BannedImportAlias` by
[@&#8203;stancld](https://togithub.com/stancld) in
[https://github.com/charliermarsh/ruff/pull/3926](https://togithub.com/charliermarsh/ruff/pull/3926)
- \[`flake8-pyi`] Implement duplicate types in unions (`PYI016`) by
[@&#8203;USER-5](https://togithub.com/USER-5) in
[https://github.com/charliermarsh/ruff/pull/3922](https://togithub.com/charliermarsh/ruff/pull/3922)
- \[`flake8-bandit`] Implement flake8-bandit shell injection rules by
[@&#8203;robyoung](https://togithub.com/robyoung) in
[https://github.com/charliermarsh/ruff/pull/3924](https://togithub.com/charliermarsh/ruff/pull/3924)
- \[`flake8-comprehensions`] Redirect `PIE802` to `C419` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3971](https://togithub.com/charliermarsh/ruff/pull/3971)

##### Bug Fixes

- Fix unicode handling in PLE2515 by
[@&#8203;konstin](https://togithub.com/konstin) in
[https://github.com/charliermarsh/ruff/pull/3898](https://togithub.com/charliermarsh/ruff/pull/3898)
- Avoid adding required imports to stub files by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3940](https://togithub.com/charliermarsh/ruff/pull/3940)
- Add 'or if cond' to `E712` message by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3962](https://togithub.com/charliermarsh/ruff/pull/3962)
- Ignore argument assignments when enforcing `RET504` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4004](https://togithub.com/charliermarsh/ruff/pull/4004)
- Fix (doc-)line-too-long start location by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4006](https://togithub.com/charliermarsh/ruff/pull/4006)
- Ignore stub file assignments to value-requiring targets by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4030](https://togithub.com/charliermarsh/ruff/pull/4030)
- Allow legacy C and T selectors in JSON schema by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3889](https://togithub.com/charliermarsh/ruff/pull/3889)
- Ignore `PLW2901` when using typing cast by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3891](https://togithub.com/charliermarsh/ruff/pull/3891)
- Visit comprehension to detect group name usage/overrides by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3887](https://togithub.com/charliermarsh/ruff/pull/3887)
- Ensure that tab characters aren't in multi-line strings before
throwing a violation by
[@&#8203;evanrittenhouse](https://togithub.com/evanrittenhouse) in
[https://github.com/charliermarsh/ruff/pull/3837](https://togithub.com/charliermarsh/ruff/pull/3837)
- Avoid N802 violations for `@override` methods by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3912](https://togithub.com/charliermarsh/ruff/pull/3912)
- Check for arguments in inner/outer call for `C414` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3916](https://togithub.com/charliermarsh/ruff/pull/3916)
- Do not skip analysis if `*args` present for `F523` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3923](https://togithub.com/charliermarsh/ruff/pull/3923)
- Extend SIM105 to match also 'Ellipsis only' bodies in exception
handlers by [@&#8203;leiserfg](https://togithub.com/leiserfg) in
[https://github.com/charliermarsh/ruff/pull/3925](https://togithub.com/charliermarsh/ruff/pull/3925)
- Support `pyright: ignore` comments by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3941](https://togithub.com/charliermarsh/ruff/pull/3941)
- Tidy up some `pygrep-hooks` rules by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3942](https://togithub.com/charliermarsh/ruff/pull/3942)
- Use identifier range for pytest rules by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3948](https://togithub.com/charliermarsh/ruff/pull/3948)
- Allow `typing_extensions.TypeVar` assignments in `.pyi` files by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3951](https://togithub.com/charliermarsh/ruff/pull/3951)
- Raise percent-format upgrade rule (`UP031`) for hanging modulos by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3953](https://togithub.com/charliermarsh/ruff/pull/3953)
- Check for parenthesis in implicit str concat in `PT006` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3955](https://togithub.com/charliermarsh/ruff/pull/3955)
- Do not consider nested comment as part of code by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3984](https://togithub.com/charliermarsh/ruff/pull/3984)
- Preserve type annotations when fixing `E731` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3983](https://togithub.com/charliermarsh/ruff/pull/3983)
- Remove autofix behavior for uncapitalized-environment-variables
(`SIM112`) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3988](https://togithub.com/charliermarsh/ruff/pull/3988)
- Respect typing-modules when evaluating no-return functions by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4001](https://togithub.com/charliermarsh/ruff/pull/4001)
- Avoid short-circuiting when detecting RET rules by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4002](https://togithub.com/charliermarsh/ruff/pull/4002)
- Set non-empty range for indentation diagnostics by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4005](https://togithub.com/charliermarsh/ruff/pull/4005)
- Ignore relative imports in `banned-api` rules by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4024](https://togithub.com/charliermarsh/ruff/pull/4024)
- Support relative imports in `banned-api` enforcement by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4025](https://togithub.com/charliermarsh/ruff/pull/4025)
- Treat non-future function annotations as required-at-runtime by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4028](https://togithub.com/charliermarsh/ruff/pull/4028)
- Ignore certain flake8-pyi errors within function bodies by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4029](https://togithub.com/charliermarsh/ruff/pull/4029)

#### New Contributors

- [@&#8203;tjkuson](https://togithub.com/tjkuson) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3886](https://togithub.com/charliermarsh/ruff/pull/3886)
- [@&#8203;mosauter](https://togithub.com/mosauter) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3877](https://togithub.com/charliermarsh/ruff/pull/3877)
- [@&#8203;stancld](https://togithub.com/stancld) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3926](https://togithub.com/charliermarsh/ruff/pull/3926)
- [@&#8203;USER-5](https://togithub.com/USER-5) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3922](https://togithub.com/charliermarsh/ruff/pull/3922)
- [@&#8203;robyoung](https://togithub.com/robyoung) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3924](https://togithub.com/charliermarsh/ruff/pull/3924)
- [@&#8203;hackedd](https://togithub.com/hackedd) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3900](https://togithub.com/charliermarsh/ruff/pull/3900)
- [@&#8203;justinchuby](https://togithub.com/justinchuby) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3982](https://togithub.com/charliermarsh/ruff/pull/3982)
- [@&#8203;mirecl](https://togithub.com/mirecl) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4008](https://togithub.com/charliermarsh/ruff/pull/4008)
- [@&#8203;Xemnas0](https://togithub.com/Xemnas0) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4026](https://togithub.com/charliermarsh/ruff/pull/4026)

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

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

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

---

### Release Notes

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

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

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

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

#### What's Changed

##### Configuration

- Allow users to extend the set of included files via `include` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3914](https://togithub.com/charliermarsh/ruff/pull/3914)
- Implement isort custom sections and ordering
([#&#8203;2419](https://togithub.com/charliermarsh/ruff/issues/2419)) by
[@&#8203;hackedd](https://togithub.com/hackedd) in
[https://github.com/charliermarsh/ruff/pull/3900](https://togithub.com/charliermarsh/ruff/pull/3900)

##### Rules

- \[`flake8-simplify`] Add autofix for `contextlib.suppress` (`SIM105`)
by [@&#8203;leiserfg](https://togithub.com/leiserfg) in
[https://github.com/charliermarsh/ruff/pull/3915](https://togithub.com/charliermarsh/ruff/pull/3915)
- \[`flake8-bandit`] Ignore assert errors (S101) in `TYPE_CHECKING`
blocks by [@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3960](https://togithub.com/charliermarsh/ruff/pull/3960)
- \[`flake8-comprehensions`] Implement
`unnecessary-literal-within-dict-call` (`C418`) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3969](https://togithub.com/charliermarsh/ruff/pull/3969)
- \[`ruff`] Add checks for mutable defaults `dataclass`es by
[@&#8203;mosauter](https://togithub.com/mosauter) in
[https://github.com/charliermarsh/ruff/pull/3877](https://togithub.com/charliermarsh/ruff/pull/3877)
- \[`flake8-import-conventions`] Add a rule for `BannedImportAlias` by
[@&#8203;stancld](https://togithub.com/stancld) in
[https://github.com/charliermarsh/ruff/pull/3926](https://togithub.com/charliermarsh/ruff/pull/3926)
- \[`flake8-pyi`] Implement duplicate types in unions (`PYI016`) by
[@&#8203;USER-5](https://togithub.com/USER-5) in
[https://github.com/charliermarsh/ruff/pull/3922](https://togithub.com/charliermarsh/ruff/pull/3922)
- \[`flake8-bandit`] Implement flake8-bandit shell injection rules by
[@&#8203;robyoung](https://togithub.com/robyoung) in
[https://github.com/charliermarsh/ruff/pull/3924](https://togithub.com/charliermarsh/ruff/pull/3924)
- \[`flake8-comprehensions`] Redirect `PIE802` to `C419` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3971](https://togithub.com/charliermarsh/ruff/pull/3971)

##### Bug Fixes

- Fix unicode handling in PLE2515 by
[@&#8203;konstin](https://togithub.com/konstin) in
[https://github.com/charliermarsh/ruff/pull/3898](https://togithub.com/charliermarsh/ruff/pull/3898)
- Avoid adding required imports to stub files by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3940](https://togithub.com/charliermarsh/ruff/pull/3940)
- Add 'or if cond' to `E712` message by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3962](https://togithub.com/charliermarsh/ruff/pull/3962)
- Ignore argument assignments when enforcing `RET504` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4004](https://togithub.com/charliermarsh/ruff/pull/4004)
- Fix (doc-)line-too-long start location by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4006](https://togithub.com/charliermarsh/ruff/pull/4006)
- Ignore stub file assignments to value-requiring targets by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4030](https://togithub.com/charliermarsh/ruff/pull/4030)
- Allow legacy C and T selectors in JSON schema by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3889](https://togithub.com/charliermarsh/ruff/pull/3889)
- Ignore `PLW2901` when using typing cast by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3891](https://togithub.com/charliermarsh/ruff/pull/3891)
- Visit comprehension to detect group name usage/overrides by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3887](https://togithub.com/charliermarsh/ruff/pull/3887)
- Ensure that tab characters aren't in multi-line strings before
throwing a violation by
[@&#8203;evanrittenhouse](https://togithub.com/evanrittenhouse) in
[https://github.com/charliermarsh/ruff/pull/3837](https://togithub.com/charliermarsh/ruff/pull/3837)
- Avoid N802 violations for `@override` methods by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3912](https://togithub.com/charliermarsh/ruff/pull/3912)
- Check for arguments in inner/outer call for `C414` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3916](https://togithub.com/charliermarsh/ruff/pull/3916)
- Do not skip analysis if `*args` present for `F523` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3923](https://togithub.com/charliermarsh/ruff/pull/3923)
- Extend SIM105 to match also 'Ellipsis only' bodies in exception
handlers by [@&#8203;leiserfg](https://togithub.com/leiserfg) in
[https://github.com/charliermarsh/ruff/pull/3925](https://togithub.com/charliermarsh/ruff/pull/3925)
- Support `pyright: ignore` comments by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3941](https://togithub.com/charliermarsh/ruff/pull/3941)
- Tidy up some `pygrep-hooks` rules by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3942](https://togithub.com/charliermarsh/ruff/pull/3942)
- Use identifier range for pytest rules by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3948](https://togithub.com/charliermarsh/ruff/pull/3948)
- Allow `typing_extensions.TypeVar` assignments in `.pyi` files by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3951](https://togithub.com/charliermarsh/ruff/pull/3951)
- Raise percent-format upgrade rule (`UP031`) for hanging modulos by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3953](https://togithub.com/charliermarsh/ruff/pull/3953)
- Check for parenthesis in implicit str concat in `PT006` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3955](https://togithub.com/charliermarsh/ruff/pull/3955)
- Do not consider nested comment as part of code by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3984](https://togithub.com/charliermarsh/ruff/pull/3984)
- Preserve type annotations when fixing `E731` by
[@&#8203;dhruvmanila](https://togithub.com/dhruvmanila) in
[https://github.com/charliermarsh/ruff/pull/3983](https://togithub.com/charliermarsh/ruff/pull/3983)
- Remove autofix behavior for uncapitalized-environment-variables
(`SIM112`) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/3988](https://togithub.com/charliermarsh/ruff/pull/3988)
- Respect typing-modules when evaluating no-return functions by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4001](https://togithub.com/charliermarsh/ruff/pull/4001)
- Avoid short-circuiting when detecting RET rules by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4002](https://togithub.com/charliermarsh/ruff/pull/4002)
- Set non-empty range for indentation diagnostics by
[@&#8203;MichaReiser](https://togithub.com/MichaReiser) in
[https://github.com/charliermarsh/ruff/pull/4005](https://togithub.com/charliermarsh/ruff/pull/4005)
- Ignore relative imports in `banned-api` rules by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4024](https://togithub.com/charliermarsh/ruff/pull/4024)
- Support relative imports in `banned-api` enforcement by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4025](https://togithub.com/charliermarsh/ruff/pull/4025)
- Treat non-future function annotations as required-at-runtime by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4028](https://togithub.com/charliermarsh/ruff/pull/4028)
- Ignore certain flake8-pyi errors within function bodies by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/4029](https://togithub.com/charliermarsh/ruff/pull/4029)

#### New Contributors

- [@&#8203;tjkuson](https://togithub.com/tjkuson) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3886](https://togithub.com/charliermarsh/ruff/pull/3886)
- [@&#8203;mosauter](https://togithub.com/mosauter) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3877](https://togithub.com/charliermarsh/ruff/pull/3877)
- [@&#8203;stancld](https://togithub.com/stancld) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3926](https://togithub.com/charliermarsh/ruff/pull/3926)
- [@&#8203;USER-5](https://togithub.com/USER-5) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3922](https://togithub.com/charliermarsh/ruff/pull/3922)
- [@&#8203;robyoung](https://togithub.com/robyoung) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3924](https://togithub.com/charliermarsh/ruff/pull/3924)
- [@&#8203;hackedd](https://togithub.com/hackedd) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/3900](https://togithub.com/charliermarsh/ruff/pull/3900)
- [@&#8203;justinchuby](https://togithub.com/justinchuby) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/3982](https://togithub.com/charliermarsh/ruff/pull/3982)
- [@&#8203;mirecl](https://togithub.com/mirecl) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4008](https://togithub.com/charliermarsh/ruff/pull/4008)
- [@&#8203;Xemnas0](https://togithub.com/Xemnas0) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/4026](https://togithub.com/charliermarsh/ruff/pull/4026)

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

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@henryiii
Copy link
Contributor

henryiii commented Apr 25, 2023

This check is likely to have a lot of false positives. If you have an immutable class, like pathlib.Path, this is just fine:

@dataclasses.dataclass
class Something:
    dir: Path = Path("build")

However, these are now flagged as unsafe. This is also true for frozen dataclasses, named tuples, etc. Maybe some common immutable things could be tracked?

(Both cases in the scikit-build-core ecosystem check above are just fine - one's a Path, and the other is a frozen dataclass).

@charliermarsh
Copy link
Member

Will look into this - I agree those should be excluded, and we do exclude them in the bugbear-equivalent rules IIRC, so it may be a matter of extending that logic to this check.

@mosauter
Copy link
Contributor Author

The code is set up similar or rather almost identically like the bugbear equivalent that allows at least for a Path and some others. If it's okay just to copy the list from there I could create a small PR for this one.

But as far as I understood up until now Ruff cannot do a deep inspection into "generic" types. So determining that a "call" is a dataclass (or a NamedTuple) is not possible. (Again to my very limited understanding)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants