nvda
f3c7d285 - Add pyright for static type checking (#17744)

Commit
1 year ago
Add pyright for static type checking (#17744) Related to #17301 Summary of the issue: NVDA has no type checking for python. Python is a dynamically typed language meaning typing issues can occur at runtime. Static analysers like `mypy` or `pyright` can be used to avoid typing errors. Description of user facing changes None Description of development approach `pyright` was chosen over `mypy` for performance reasons. Additionally, pyright has better pre-commit integration, and is built-in to VS Code, which is used by most NVDA developers. We are far from compliant with static type checking, so most rules are currently disabled. The intention is to fix compliance and turn on rules over time. Various trivial typing fixes have occurred, particularly: - removing unnecessary casts - fixing type hints - adding relevant type ignore comments - removing redundant type ignore comments - adding type stubs for `gettext` builtins and `_buildVersion` generated build vars - remove duplicate imports - adding `__all__` to mark export for private classes - adding missing `match` cases Testing strategy: - [x] Smoke test NVDA - [x] pyright passing - [x] Automated testing passes Known issues with pull request: We are far from compliant with static type checking, so most rules are currently disabled. The intention is to fix compliance and turn on rules over time.
Author
Parents
Loading