Skip to content

[ruff] Skip SQLModel base classes for mutable-class-default (RUF012)#14949

Merged
dylwil3 merged 3 commits intoastral-sh:mainfrom
krishnan-chandra:ruf012-sqlmodel-exemption
Dec 13, 2024
Merged

[ruff] Skip SQLModel base classes for mutable-class-default (RUF012)#14949
dylwil3 merged 3 commits intoastral-sh:mainfrom
krishnan-chandra:ruf012-sqlmodel-exemption

Conversation

@krishnan-chandra
Copy link
Contributor

Summary

Closes #14892, by adding sqlmodel.SQLModel to the list of classes with default copy semantics.

Test Plan

Added a test into RUF012.py containing the example from the original issue.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 13, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Collaborator

@dylwil3 dylwil3 left a comment

Choose a reason for hiding this comment

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

Thank you so much! Just one request for some more tests and then it looks good to me

@dylwil3 dylwil3 added the rule Implementing or modifying a lint rule label Dec 13, 2024
@dylwil3 dylwil3 changed the title RUF012 exemption for SQLModel base class [ruff] Skip SQLModel base classes for mutable-class-default (RUF012) Dec 13, 2024
Copy link
Collaborator

@dylwil3 dylwil3 left a comment

Choose a reason for hiding this comment

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

LGTM - thank you again for your contribution!

@dylwil3 dylwil3 merged commit be4ce16 into astral-sh:main Dec 13, 2024
@krishnan-chandra krishnan-chandra deleted the ruf012-sqlmodel-exemption branch December 13, 2024 12:10
dcreager added a commit that referenced this pull request Dec 13, 2024
* main:
  [red-knot] Display definition range in trace logs (#14955)
  [red-knot] Move the `ClassBase` enum to its own submodule (#14957)
  [red-knot] mdtest: python version requirements (#14954)
  [airflow]: Import modules that has been moved to airflow providers (AIR303) (#14764)
  [red-knot] Support `typing.TYPE_CHECKING` (#14952)
  Add tracing support to mdtest (#14935)
  Re-enable the fuzzer job on PRs (#14953)
  [red-knot] Improve `match` mdtests (#14951)
  Rename `custom-typeshed-dir`, `target-version` and `current-directory` CLI options (#14930)
  [red-knot] Add narrowing for 'while' loops (#14947)
  [`ruff`]  Skip SQLModel base classes for `mutable-class-default` (`RUF012`) (#14949)
  [red-knot] Tests for 'while' loop boundness (#14944)
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.

RUF012 should not trigger on SQLModel models

2 participants