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

## Summary

Resolves #12717.

This change incorporates the logic added in #15588.

## Test Plan

`cargo nextest run` and `cargo insta test`.

---------

Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
This commit is contained in:
InSync 2025-01-29 17:26:17 +07:00 committed by GitHub
parent 6090408f65
commit 4bec8ba731
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 88 additions and 55 deletions

View file

@ -35,3 +35,14 @@ def okay(obj=Class()):
def error(obj=OtherClass()):
...
# https://github.com/astral-sh/ruff/issues/12717
from typing import NewType
N = NewType("N", int)
L = NewType("L", list[str])
def okay(obj = N()): ...
def error(obj = L()): ...