Will It Vibe logoWill It Vibe?
PY-014Low severity-4 points

type() equality instead of isinstance()

Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 4 points from that category, once per scan, no matter how many places it turns up.

What it detects

type(a) == type(b) (or type(a) == SomeClass) only matches an exact type and silently rejects subclasses that isinstance() would correctly accept.

Why it matters

type(a) == type(b) (or type(a) == SomeClass) only matches when the type is exactly identical, so it silently rejects subclasses even when a subclass instance should be treated the same way by the calling code. isinstance() is the idiomatic check because it respects inheritance and duck typing, which is how most Python APIs are actually designed to be extended.

How to fix it

Use isinstance(a, SomeClass) or isinstance(a, type(b)) instead. If you specifically need to exclude subclasses, a genuinely rare requirement, keep the type() comparison but add a comment explaining why subclasses must be excluded, so the next reader does not fix it into a bug.

The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing

Does your repo trip this check?

Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.

Scan your repo

Related Code Quality & Syntax checks