-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore N815
for TypedDict
fields
#4066
Ignore N815
for TypedDict
fields
#4066
Conversation
JonathanPlasse
commented
Apr 22, 2023
- Close N815 (mixed-case-variable-in-class-scope) probably should not check TypedDict #4014
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinux
Windows
|
@@ -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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should check checker.ctx.match_typing_expr
.
false | ||
}) { | ||
return; | ||
} | ||
if helpers::is_mixed_case(name) && !helpers::is_namedtuple_assignment(checker, stmt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's maybe move to a helper (is_typeddict
) and do the check at the end here (&& !helpers...
).
N815
for TypedDict
fields
[![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.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://togithub.com/charliermarsh/ruff/releases/tag/v0.0.263) [Compare Source](https://togithub.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 [@​alanhdu](https://togithub.com/alanhdu) in [https://github.com/charliermarsh/ruff/pull/4052](https://togithub.com/charliermarsh/ruff/pull/4052) - \[`flake8-import-conventions`] Implement new rule `ICN003` to ban `from ... import ...` for selected modules by [@​edgarrmondragon](https://togithub.com/edgarrmondragon) in [https://github.com/charliermarsh/ruff/pull/4040](https://togithub.com/charliermarsh/ruff/pull/4040) - \[`pylint`] Implement PLE0302 `unexpected-special-method-signature` by [@​mccullocht](https://togithub.com/mccullocht) in [https://github.com/charliermarsh/ruff/pull/4075](https://togithub.com/charliermarsh/ruff/pull/4075) - \[`pep8-naming`] Ignore `N815` for `TypedDict` fields by [@​JonathanPlasse](https://togithub.com/JonathanPlasse) in [https://github.com/charliermarsh/ruff/pull/4066](https://togithub.com/charliermarsh/ruff/pull/4066) ##### Bug Fixes - Avoid `PYI015` for valid default value without annotation by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/4043](https://togithub.com/charliermarsh/ruff/pull/4043) - Avoid infinite-propagation of inline comments when force-splitting imports by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4074](https://togithub.com/charliermarsh/ruff/pull/4074) - Fix SIM222 and SIM223 false positives and auto-fix by [@​JonathanPlasse](https://togithub.com/JonathanPlasse) in [https://github.com/charliermarsh/ruff/pull/4063](https://togithub.com/charliermarsh/ruff/pull/4063) - Unify positional and keyword arguments when checking for missing arguments in docstring by [@​evanrittenhouse](https://togithub.com/evanrittenhouse) in [https://github.com/charliermarsh/ruff/pull/4067](https://togithub.com/charliermarsh/ruff/pull/4067) - Avoid `RUF008` if field annotation is immutable by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/4039](https://togithub.com/charliermarsh/ruff/pull/4039) - Increment priority should be (branch-local, global) by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/4070](https://togithub.com/charliermarsh/ruff/pull/4070) - Ignore `ClassVar` annotation for `RUF008`, `RUF009` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/4081](https://togithub.com/charliermarsh/ruff/pull/4081) - Support --fix in watch mode by [@​evanrittenhouse](https://togithub.com/evanrittenhouse) in [https://github.com/charliermarsh/ruff/pull/4035](https://togithub.com/charliermarsh/ruff/pull/4035) #### New Contributors - [@​alanhdu](https://togithub.com/alanhdu) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4052](https://togithub.com/charliermarsh/ruff/pull/4052) - [@​pronoym99](https://togithub.com/pronoym99) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4055](https://togithub.com/charliermarsh/ruff/pull/4055) - [@​Secrus](https://togithub.com/Secrus) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4085](https://togithub.com/charliermarsh/ruff/pull/4085) - [@​madkinsz](https://togithub.com/madkinsz) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4084](https://togithub.com/charliermarsh/ruff/pull/4084) - [@​mccullocht](https://togithub.com/mccullocht) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4075](https://togithub.com/charliermarsh/ruff/pull/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 <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![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.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://togithub.com/charliermarsh/ruff/releases/tag/v0.0.263) [Compare Source](https://togithub.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 [@​alanhdu](https://togithub.com/alanhdu) in [https://github.com/charliermarsh/ruff/pull/4052](https://togithub.com/charliermarsh/ruff/pull/4052) - \[`flake8-import-conventions`] Implement new rule `ICN003` to ban `from ... import ...` for selected modules by [@​edgarrmondragon](https://togithub.com/edgarrmondragon) in [https://github.com/charliermarsh/ruff/pull/4040](https://togithub.com/charliermarsh/ruff/pull/4040) - \[`pylint`] Implement PLE0302 `unexpected-special-method-signature` by [@​mccullocht](https://togithub.com/mccullocht) in [https://github.com/charliermarsh/ruff/pull/4075](https://togithub.com/charliermarsh/ruff/pull/4075) - \[`pep8-naming`] Ignore `N815` for `TypedDict` fields by [@​JonathanPlasse](https://togithub.com/JonathanPlasse) in [https://github.com/charliermarsh/ruff/pull/4066](https://togithub.com/charliermarsh/ruff/pull/4066) ##### Bug Fixes - Avoid `PYI015` for valid default value without annotation by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/4043](https://togithub.com/charliermarsh/ruff/pull/4043) - Avoid infinite-propagation of inline comments when force-splitting imports by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4074](https://togithub.com/charliermarsh/ruff/pull/4074) - Fix SIM222 and SIM223 false positives and auto-fix by [@​JonathanPlasse](https://togithub.com/JonathanPlasse) in [https://github.com/charliermarsh/ruff/pull/4063](https://togithub.com/charliermarsh/ruff/pull/4063) - Unify positional and keyword arguments when checking for missing arguments in docstring by [@​evanrittenhouse](https://togithub.com/evanrittenhouse) in [https://github.com/charliermarsh/ruff/pull/4067](https://togithub.com/charliermarsh/ruff/pull/4067) - Avoid `RUF008` if field annotation is immutable by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/4039](https://togithub.com/charliermarsh/ruff/pull/4039) - Increment priority should be (branch-local, global) by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/4070](https://togithub.com/charliermarsh/ruff/pull/4070) - Ignore `ClassVar` annotation for `RUF008`, `RUF009` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/4081](https://togithub.com/charliermarsh/ruff/pull/4081) - Support --fix in watch mode by [@​evanrittenhouse](https://togithub.com/evanrittenhouse) in [https://github.com/charliermarsh/ruff/pull/4035](https://togithub.com/charliermarsh/ruff/pull/4035) #### New Contributors - [@​alanhdu](https://togithub.com/alanhdu) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4052](https://togithub.com/charliermarsh/ruff/pull/4052) - [@​pronoym99](https://togithub.com/pronoym99) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4055](https://togithub.com/charliermarsh/ruff/pull/4055) - [@​Secrus](https://togithub.com/Secrus) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4085](https://togithub.com/charliermarsh/ruff/pull/4085) - [@​madkinsz](https://togithub.com/madkinsz) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4084](https://togithub.com/charliermarsh/ruff/pull/4084) - [@​mccullocht](https://togithub.com/mccullocht) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4075](https://togithub.com/charliermarsh/ruff/pull/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>
[![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.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://togithub.com/charliermarsh/ruff/releases/tag/v0.0.263) [Compare Source](https://togithub.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 [@​alanhdu](https://togithub.com/alanhdu) in [https://github.com/charliermarsh/ruff/pull/4052](https://togithub.com/charliermarsh/ruff/pull/4052) - \[`flake8-import-conventions`] Implement new rule `ICN003` to ban `from ... import ...` for selected modules by [@​edgarrmondragon](https://togithub.com/edgarrmondragon) in [https://github.com/charliermarsh/ruff/pull/4040](https://togithub.com/charliermarsh/ruff/pull/4040) - \[`pylint`] Implement PLE0302 `unexpected-special-method-signature` by [@​mccullocht](https://togithub.com/mccullocht) in [https://github.com/charliermarsh/ruff/pull/4075](https://togithub.com/charliermarsh/ruff/pull/4075) - \[`pep8-naming`] Ignore `N815` for `TypedDict` fields by [@​JonathanPlasse](https://togithub.com/JonathanPlasse) in [https://github.com/charliermarsh/ruff/pull/4066](https://togithub.com/charliermarsh/ruff/pull/4066) ##### Bug Fixes - Avoid `PYI015` for valid default value without annotation by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/4043](https://togithub.com/charliermarsh/ruff/pull/4043) - Avoid infinite-propagation of inline comments when force-splitting imports by [@​charliermarsh](https://togithub.com/charliermarsh) in [https://github.com/charliermarsh/ruff/pull/4074](https://togithub.com/charliermarsh/ruff/pull/4074) - Fix SIM222 and SIM223 false positives and auto-fix by [@​JonathanPlasse](https://togithub.com/JonathanPlasse) in [https://github.com/charliermarsh/ruff/pull/4063](https://togithub.com/charliermarsh/ruff/pull/4063) - Unify positional and keyword arguments when checking for missing arguments in docstring by [@​evanrittenhouse](https://togithub.com/evanrittenhouse) in [https://github.com/charliermarsh/ruff/pull/4067](https://togithub.com/charliermarsh/ruff/pull/4067) - Avoid `RUF008` if field annotation is immutable by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/4039](https://togithub.com/charliermarsh/ruff/pull/4039) - Increment priority should be (branch-local, global) by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/4070](https://togithub.com/charliermarsh/ruff/pull/4070) - Ignore `ClassVar` annotation for `RUF008`, `RUF009` by [@​dhruvmanila](https://togithub.com/dhruvmanila) in [https://github.com/charliermarsh/ruff/pull/4081](https://togithub.com/charliermarsh/ruff/pull/4081) - Support --fix in watch mode by [@​evanrittenhouse](https://togithub.com/evanrittenhouse) in [https://github.com/charliermarsh/ruff/pull/4035](https://togithub.com/charliermarsh/ruff/pull/4035) ##### New Contributors - [@​alanhdu](https://togithub.com/alanhdu) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4052](https://togithub.com/charliermarsh/ruff/pull/4052) - [@​pronoym99](https://togithub.com/pronoym99) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4055](https://togithub.com/charliermarsh/ruff/pull/4055) - [@​Secrus](https://togithub.com/Secrus) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4085](https://togithub.com/charliermarsh/ruff/pull/4085) - [@​madkinsz](https://togithub.com/madkinsz) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4084](https://togithub.com/charliermarsh/ruff/pull/4084) - [@​mccullocht](https://togithub.com/mccullocht) made their first contribution in [https://github.com/charliermarsh/ruff/pull/4075](https://togithub.com/charliermarsh/ruff/pull/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>