Skip to content

Comments

[flake8-bugbear] Exempt NewType calls where the original type is immutable (B008)#15765

Merged
dhruvmanila merged 4 commits intoastral-sh:mainfrom
InSyncWithFoo:B008
Jan 29, 2025
Merged

[flake8-bugbear] Exempt NewType calls where the original type is immutable (B008)#15765
dhruvmanila merged 4 commits intoastral-sh:mainfrom
InSyncWithFoo:B008

Conversation

@InSyncWithFoo
Copy link
Contributor

Summary

Resolves #12717.

This change incorporates the logic added in #15588.

Test Plan

cargo nextest run and cargo insta test.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@dhruvmanila dhruvmanila added the rule Implementing or modifying a lint rule label Jan 27, 2025
Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

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

Thanks.

I added docs for the is_immutable_newtype_call and updated the parameter to use ExprName instead of Expr

@dhruvmanila dhruvmanila enabled auto-merge (squash) January 29, 2025 10:21
@dhruvmanila dhruvmanila merged commit 4bec8ba into astral-sh:main Jan 29, 2025
20 checks passed
@InSyncWithFoo InSyncWithFoo deleted the B008 branch January 29, 2025 12:35
dcreager added a commit that referenced this pull request Jan 29, 2025
* main:
  [red-knot] Extend instance-attribute tests (#15808)
  Fix formatter warning message for `flake8-quotes` option (#15788)
  [`flake8-bugbear`] Exempt `NewType` calls where the original type is immutable (`B008`) (#15765)
  Add missing config docstrings (#15803)
  [`refurb`] Do not emit diagnostic when loop variables are used outside loop body (`FURB122`) (#15757)
  [`ruff`] Check for shadowed `map` before suggesting fix (`RUF058`) (#15790)
  [red-knot] Do not use explicit `knot_extensions.Unknown` declaration (#15787)
  Preserve quotes in generated byte strings (#15778)
  [minor] Simplify some `ExprStringLiteral` creation logic (#15775)
  Preserve quote style in generated code (#15726)
  Rename internal helper functions (#15771)
  [`airflow`] Extend airflow context parameter check for `BaseOperator.execute` (`AIR302`) (#15713)
  Implement tab autocomplete for `ruff config` (#15603)
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.

B008 should ignore NewType wrapper

2 participants