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 N815 for TypedDict fields #4066

Merged

Conversation

JonathanPlasse
Copy link
Contributor

@github-actions
Copy link
Contributor

github-actions bot commented Apr 22, 2023

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.03     14.7±0.06ms     2.8 MB/sec    1.00     14.3±0.07ms     2.9 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.01      3.6±0.00ms     4.6 MB/sec    1.00      3.6±0.01ms     4.6 MB/sec
linter/all-rules/numpy/globals.py          1.00    456.9±0.75µs     6.5 MB/sec    1.01    462.5±0.89µs     6.4 MB/sec
linter/all-rules/pydantic/types.py         1.02      6.2±0.02ms     4.1 MB/sec    1.00      6.0±0.01ms     4.2 MB/sec
linter/default-rules/large/dataset.py      1.04      7.5±0.02ms     5.4 MB/sec    1.00      7.2±0.01ms     5.7 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.02   1655.1±4.80µs    10.1 MB/sec    1.00   1619.2±2.43µs    10.3 MB/sec
linter/default-rules/numpy/globals.py      1.00    181.2±0.37µs    16.3 MB/sec    1.00    181.2±0.50µs    16.3 MB/sec
linter/default-rules/pydantic/types.py     1.03      3.4±0.01ms     7.4 MB/sec    1.00      3.3±0.01ms     7.7 MB/sec
parser/large/dataset.py                    1.00      5.7±0.00ms     7.1 MB/sec    1.01      5.8±0.00ms     7.0 MB/sec
parser/numpy/ctypeslib.py                  1.00   1142.2±0.66µs    14.6 MB/sec    1.01   1148.9±0.76µs    14.5 MB/sec
parser/numpy/globals.py                    1.00    114.6±0.36µs    25.7 MB/sec    1.01    115.4±0.28µs    25.6 MB/sec
parser/pydantic/types.py                   1.00      2.5±0.00ms    10.3 MB/sec    1.01      2.5±0.00ms    10.2 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.06     22.3±0.73ms  1869.8 KB/sec    1.00     21.1±0.62ms  1973.7 KB/sec
linter/all-rules/numpy/ctypeslib.py        1.04      5.7±0.25ms     2.9 MB/sec    1.00      5.5±0.24ms     3.0 MB/sec
linter/all-rules/numpy/globals.py          1.05   675.7±46.69µs     4.4 MB/sec    1.00   646.5±57.72µs     4.6 MB/sec
linter/all-rules/pydantic/types.py         1.04      9.4±0.33ms     2.7 MB/sec    1.00      9.0±0.48ms     2.8 MB/sec
linter/default-rules/large/dataset.py      1.05     10.9±0.31ms     3.7 MB/sec    1.00     10.3±0.39ms     3.9 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.05      2.4±0.08ms     6.9 MB/sec    1.00      2.3±0.12ms     7.2 MB/sec
linter/default-rules/numpy/globals.py      1.04   290.6±11.50µs    10.2 MB/sec    1.00   279.9±19.84µs    10.5 MB/sec
linter/default-rules/pydantic/types.py     1.05      5.0±0.18ms     5.1 MB/sec    1.00      4.8±0.33ms     5.3 MB/sec
parser/large/dataset.py                    1.02      9.0±0.30ms     4.5 MB/sec    1.00      8.8±0.29ms     4.6 MB/sec
parser/numpy/ctypeslib.py                  1.04  1755.4±71.30µs     9.5 MB/sec    1.00  1687.5±61.20µs     9.9 MB/sec
parser/numpy/globals.py                    1.06   180.0±12.21µs    16.4 MB/sec    1.00   169.5±10.91µs    17.4 MB/sec
parser/pydantic/types.py                   1.05      3.9±0.16ms     6.5 MB/sec    1.00      3.7±0.14ms     6.8 MB/sec

@@ -36,6 +37,14 @@ pub fn mixed_case_variable_in_class_scope(
{
return;
}
if bases.iter().any(|base| {
if let ExprKind::Name { id, .. } = &base.node {
return id == "TypedDict";
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 this should check checker.ctx.match_typing_expr.

false
}) {
return;
}
if helpers::is_mixed_case(name) && !helpers::is_namedtuple_assignment(checker, stmt) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's maybe move to a helper (is_typeddict) and do the check at the end here (&& !helpers...).

@charliermarsh charliermarsh changed the title Ignore N815 for TypedDict Ignore N815 for TypedDict fields Apr 22, 2023
@charliermarsh charliermarsh merged commit 2da149f into astral-sh:main Apr 22, 2023
@JonathanPlasse JonathanPlasse deleted the ignore-n815-for-typed-dict branch April 23, 2023 04:59
renovate bot added a commit to ixm-one/pytest-cmake-presets that referenced this pull request Apr 25, 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://github.com/charliermarsh/ruff) | `^0.0.262` ->
`^0.0.263` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/compatibility-slim/0.0.262)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/confidence-slim/0.0.262)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

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

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

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

#### What's Changed

##### Rules

- \[`flake8-bugbear`] Add `pytest.raises(Exception)` support to B017 by
[@&#8203;alanhdu](https://github.com/alanhdu) in
[astral-sh/ruff#4052
- \[`flake8-import-conventions`] Implement new rule `ICN003` to ban
`from ... import ...` for selected modules by
[@&#8203;edgarrmondragon](https://github.com/edgarrmondragon) in
[astral-sh/ruff#4040
- \[`pylint`] Implement PLE0302 `unexpected-special-method-signature` by
[@&#8203;mccullocht](https://github.com/mccullocht) in
[astral-sh/ruff#4075
- \[`pep8-naming`] Ignore `N815` for `TypedDict` fields by
[@&#8203;JonathanPlasse](https://github.com/JonathanPlasse) in
[astral-sh/ruff#4066

##### Bug Fixes

- Avoid `PYI015` for valid default value without annotation by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4043
- Avoid infinite-propagation of inline comments when force-splitting
imports by [@&#8203;charliermarsh](https://github.com/charliermarsh)
in
[astral-sh/ruff#4074
- Fix SIM222 and SIM223 false positives and auto-fix by
[@&#8203;JonathanPlasse](https://github.com/JonathanPlasse) in
[astral-sh/ruff#4063
- Unify positional and keyword arguments when checking for missing
arguments in docstring by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#4067
- Avoid `RUF008` if field annotation is immutable by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4039
- Increment priority should be (branch-local, global) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4070
- Ignore `ClassVar` annotation for `RUF008`, `RUF009` by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4081
- Support --fix in watch mode by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#4035

#### New Contributors

- [@&#8203;alanhdu](https://github.com/alanhdu) made their first
contribution in
[astral-sh/ruff#4052
- [@&#8203;pronoym99](https://github.com/pronoym99) made their first
contribution in
[astral-sh/ruff#4055
- [@&#8203;Secrus](https://github.com/Secrus) made their first
contribution in
[astral-sh/ruff#4085
- [@&#8203;madkinsz](https://github.com/madkinsz) made their first
contribution in
[astral-sh/ruff#4084
- [@&#8203;mccullocht](https://github.com/mccullocht) made their first
contribution in
[astral-sh/ruff#4075

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

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

Signed-off-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot added a commit to allenporter/flux-local that referenced this pull request Apr 27, 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://github.com/charliermarsh/ruff) | `==0.0.262` ->
`==0.0.263` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/compatibility-slim/0.0.262)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.263/confidence-slim/0.0.262)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

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

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

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

#### What's Changed

##### Rules

- \[`flake8-bugbear`] Add `pytest.raises(Exception)` support to B017 by
[@&#8203;alanhdu](https://github.com/alanhdu) in
[astral-sh/ruff#4052
- \[`flake8-import-conventions`] Implement new rule `ICN003` to ban
`from ... import ...` for selected modules by
[@&#8203;edgarrmondragon](https://github.com/edgarrmondragon) in
[astral-sh/ruff#4040
- \[`pylint`] Implement PLE0302 `unexpected-special-method-signature` by
[@&#8203;mccullocht](https://github.com/mccullocht) in
[astral-sh/ruff#4075
- \[`pep8-naming`] Ignore `N815` for `TypedDict` fields by
[@&#8203;JonathanPlasse](https://github.com/JonathanPlasse) in
[astral-sh/ruff#4066

##### Bug Fixes

- Avoid `PYI015` for valid default value without annotation by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4043
- Avoid infinite-propagation of inline comments when force-splitting
imports by [@&#8203;charliermarsh](https://github.com/charliermarsh)
in
[astral-sh/ruff#4074
- Fix SIM222 and SIM223 false positives and auto-fix by
[@&#8203;JonathanPlasse](https://github.com/JonathanPlasse) in
[astral-sh/ruff#4063
- Unify positional and keyword arguments when checking for missing
arguments in docstring by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#4067
- Avoid `RUF008` if field annotation is immutable by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4039
- Increment priority should be (branch-local, global) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4070
- Ignore `ClassVar` annotation for `RUF008`, `RUF009` by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4081
- Support --fix in watch mode by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#4035

#### New Contributors

- [@&#8203;alanhdu](https://github.com/alanhdu) made their first
contribution in
[astral-sh/ruff#4052
- [@&#8203;pronoym99](https://github.com/pronoym99) made their first
contribution in
[astral-sh/ruff#4055
- [@&#8203;Secrus](https://github.com/Secrus) made their first
contribution in
[astral-sh/ruff#4085
- [@&#8203;madkinsz](https://github.com/madkinsz) made their first
contribution in
[astral-sh/ruff#4084
- [@&#8203;mccullocht](https://github.com/mccullocht) made their first
contribution in
[astral-sh/ruff#4075

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

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

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

---

### Release Notes

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

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

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

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

##### What's Changed

##### Rules

- \[`flake8-bugbear`] Add `pytest.raises(Exception)` support to B017 by
[@&#8203;alanhdu](https://github.com/alanhdu) in
[astral-sh/ruff#4052
- \[`flake8-import-conventions`] Implement new rule `ICN003` to ban
`from ... import ...` for selected modules by
[@&#8203;edgarrmondragon](https://github.com/edgarrmondragon) in
[astral-sh/ruff#4040
- \[`pylint`] Implement PLE0302 `unexpected-special-method-signature` by
[@&#8203;mccullocht](https://github.com/mccullocht) in
[astral-sh/ruff#4075
- \[`pep8-naming`] Ignore `N815` for `TypedDict` fields by
[@&#8203;JonathanPlasse](https://github.com/JonathanPlasse) in
[astral-sh/ruff#4066

##### Bug Fixes

- Avoid `PYI015` for valid default value without annotation by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4043
- Avoid infinite-propagation of inline comments when force-splitting
imports by [@&#8203;charliermarsh](https://github.com/charliermarsh)
in
[astral-sh/ruff#4074
- Fix SIM222 and SIM223 false positives and auto-fix by
[@&#8203;JonathanPlasse](https://github.com/JonathanPlasse) in
[astral-sh/ruff#4063
- Unify positional and keyword arguments when checking for missing
arguments in docstring by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#4067
- Avoid `RUF008` if field annotation is immutable by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4039
- Increment priority should be (branch-local, global) by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4070
- Ignore `ClassVar` annotation for `RUF008`, `RUF009` by
[@&#8203;dhruvmanila](https://github.com/dhruvmanila) in
[astral-sh/ruff#4081
- Support --fix in watch mode by
[@&#8203;evanrittenhouse](https://github.com/evanrittenhouse) in
[astral-sh/ruff#4035

##### New Contributors

- [@&#8203;alanhdu](https://github.com/alanhdu) made their first
contribution in
[astral-sh/ruff#4052
- [@&#8203;pronoym99](https://github.com/pronoym99) made their first
contribution in
[astral-sh/ruff#4055
- [@&#8203;Secrus](https://github.com/Secrus) made their first
contribution in
[astral-sh/ruff#4085
- [@&#8203;madkinsz](https://github.com/madkinsz) made their first
contribution in
[astral-sh/ruff#4084
- [@&#8203;mccullocht](https://github.com/mccullocht) made their first
contribution in
[astral-sh/ruff#4075

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

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

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

N815 (mixed-case-variable-in-class-scope) probably should not check TypedDict
2 participants