Skip to content

Promote 7 ty rules from ignore to warn#3852

Merged
jlowin merged 1 commit intomainfrom
ty-promote-rules
Apr 12, 2026
Merged

Promote 7 ty rules from ignore to warn#3852
jlowin merged 1 commit intomainfrom
ty-promote-rules

Conversation

@strawgate
Copy link
Copy Markdown
Collaborator

Enables stricter type checking by promoting 7 ty rules from their default ignore level to warn (which becomes error via the existing error-on-warning = true setting).

Rules promoted:

Rule Violations What it catches
division-by-zero 0 Literal division by zero
possibly-missing-attribute 0 Attribute access on types that may not have it
possibly-missing-import 0 Names that look like they should be imported
possibly-unresolved-reference 9 Variables used when possibly not defined
unsupported-dynamic-base 0 Classes with dynamic base classes
unsupported-operator 0 Operators on incompatible types
unused-ignore-comment 0 Stale ty: ignore comments

Fixes (9 total):

  • openapi/schemas.py: Initialize body_schema before conditional block (5 hits)
  • test_input_validation.py: Initialize error_msg before try/except (2 hits)
  • test_real_world_schemas.py: Initialize old_handler before conditional (1 hit)
  • mcp_config.py: Suppress walrus-operator false positive with ty: ignore (1 hit)

Following the pattern from scipy-stubs which promotes all of these to error.

🤖 Generated with Claude Code

Enables stricter type checking by promoting rules that default to
ignore: division-by-zero, possibly-missing-attribute,
possibly-missing-import, possibly-unresolved-reference,
unsupported-dynamic-base, unsupported-operator, unused-ignore-comment.

6 of the 7 rules had zero violations. possibly-unresolved-reference
had 9 (5 in src/, 3 in tests/, 1 walrus-operator false positive
suppressed with ty: ignore).

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@strawgate strawgate added the enhancement Improvement to existing functionality. For issues and smaller PR improvements. label Apr 11, 2026
Copy link
Copy Markdown
Member

@jlowin jlowin left a comment

Choose a reason for hiding this comment

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

Promoting 7 ty rules from ignore to warn. The 9 accompanying fixes are legitimate — one was a latent NameError waiting to happen.

@jlowin jlowin merged commit 7825355 into main Apr 12, 2026
10 checks passed
@jlowin jlowin deleted the ty-promote-rules branch April 12, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement to existing functionality. For issues and smaller PR improvements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants