Flag unidiomatic-typecheck for type(x) is type(y)
Type of Changes
| Type | |
|---|---|
| ✓ | :bug: Bug fix |
Description
Closes #10365
🤖 Effect of this PR on checked open source code: 🤖
Effect on home-assistant: The following messages are now emitted:
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/home-assistant/core/blob/0bf807b96e771f855deeaa5d44008f7bf8eac771/homeassistant/helpers/entity.py#L338
Effect on music21: The following messages are now emitted:
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/cuthbertLab/music21/blob/599c5c4128c09d7cee0be077a794326b82b68839/music21/duration.py#L1771
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/cuthbertLab/music21/blob/599c5c4128c09d7cee0be077a794326b82b68839/music21/metadata/primitives.py#L499
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/cuthbertLab/music21/blob/599c5c4128c09d7cee0be077a794326b82b68839/music21/metadata/primitives.py#L898
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/cuthbertLab/music21/blob/599c5c4128c09d7cee0be077a794326b82b68839/music21/metadata/primitives.py#L915
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/cuthbertLab/music21/blob/599c5c4128c09d7cee0be077a794326b82b68839/music21/metadata/primitives.py#L1011
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/cuthbertLab/music21/blob/599c5c4128c09d7cee0be077a794326b82b68839/music21/metadata/primitives.py#L1197
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/cuthbertLab/music21/blob/599c5c4128c09d7cee0be077a794326b82b68839/music21/tree/spans.py#L91
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/cuthbertLab/music21/blob/599c5c4128c09d7cee0be077a794326b82b68839/music21/common/objects.py#L258
Effect on pytest: The following messages are now emitted:
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/pytest-dev/pytest/blob/89b84cb56295c46e1d8834b599e858bc65c15a5b/src/_pytest/assertion/util.py#L263
Effect on django: The following messages are now emitted:
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/django/django/blob/1fb3f57e81239a75eb8f873b392e11534c041fdc/django/db/migrations/operations/models.py#L683
Effect on pandas: The following messages are now emitted:
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/pandas-dev/pandas/blob/7bb58a82d444fa4d672a484180c567b17bed5da4/pandas/core/generic.py#L9301
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/pandas-dev/pandas/blob/7bb58a82d444fa4d672a484180c567b17bed5da4/pandas/core/arrays/masked.py#L1108
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/pandas-dev/pandas/blob/7bb58a82d444fa4d672a484180c567b17bed5da4/pandas/core/arrays/interval.py#L337
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/pandas-dev/pandas/blob/7bb58a82d444fa4d672a484180c567b17bed5da4/pandas/core/arrays/interval.py#L992
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/pandas-dev/pandas/blob/7bb58a82d444fa4d672a484180c567b17bed5da4/pandas/core/arrays/_mixins.py#L175
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/pandas-dev/pandas/blob/7bb58a82d444fa4d672a484180c567b17bed5da4/pandas/core/arrays/base.py#L1510
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/pandas-dev/pandas/blob/7bb58a82d444fa4d672a484180c567b17bed5da4/pandas/core/arrays/arrow/extension_types.py#L43
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/pandas-dev/pandas/blob/7bb58a82d444fa4d672a484180c567b17bed5da4/pandas/core/arrays/arrow/extension_types.py#L97
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/pandas-dev/pandas/blob/7bb58a82d444fa4d672a484180c567b17bed5da4/pandas/core/indexes/base.py#L5545
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/pandas-dev/pandas/blob/7bb58a82d444fa4d672a484180c567b17bed5da4/pandas/core/internals/concat.py#L465
Effect on sentry: The following messages are now emitted:
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/getsentry/sentry/blob/e6287c10d05a093cec48a4b7dc27420279eb3f37/src/sentry/tagstore/types.py#L26
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/getsentry/sentry/blob/e6287c10d05a093cec48a4b7dc27420279eb3f37/src/sentry/apidocs/spectacular_ports.py#L146
Effect on psycopg: The following messages are now emitted:
- unidiomatic-typecheck: Use isinstance() rather than type() for a typecheck. https://github.com/psycopg/psycopg/blob/4ab4c02ef8cde95c5e79703cc47d6676426f6d08/psycopg/psycopg/sql.py#L102
This comment was generated for commit ec62635b42d0b4d689616c60b0866ecd3ff2cfa6
Cool stuff @alexprabhat99! We're still discussing the merit of the idea, but I'm wondering if you'd be game to try to add some sort of exception for calls inside def __eq__(self, other)? If we can filter those out, we might get a much better analysis from the primer. Ta!
This PR needs take over because because it has been open 8 weeks with no activity.
Feel free to reopen if you return to this.