High
Python
Use type hints everywhere
Official
Rule Description
Add type hints to all function signatures and class attributes:
- Enables static analysis with mypy/pyright
- Improves IDE autocompletion
- Documents expected types
- Catches type errors before runtime
```python
from typing import Optional
def process_user(user_id: int, name: str | None = None) -> dict[str, Any]:
...
class UserService:
def __init__(self, repo: UserRepository) -> None:
self.repo = repo
```
Add This Rule
Sign in to add this rule to your workspace
Sign in with GitHubDetails
- Severity
- High
- Category
- Python
- Used in
- 4 rulesets