@@ -51,6 +51,7 @@ exclude = [
5151 " .tox" ,
5252 " build" ,
5353 " output" ,
54+ " .venv" ,
5455 # When excluding concrete paths relative to a directory,
5556 # not matching multiple folders by name e.g. `__pycache__`,
5657 # paths are relative to the configuration file.
@@ -59,6 +60,8 @@ exclude = [
5960 " ./source/louis" ,
6061 # #10924: generated by third-party dependencies
6162 " ./source/comInterfaces/*" ,
63+ # Code from add-ons
64+ " ./source/userConfig/addons/*" ,
6265]
6366
6467[tool .ruff .format ]
@@ -115,3 +118,154 @@ ignore_packages = [
115118 " wxPython" , # wxWindows Library License
116119 " pillow" , # PIL Software License
117120]
121+
122+
123+ [tool .pyright ]
124+ venvPath = " .venv"
125+ venv = " ."
126+ pythonPlatform = " Windows"
127+ typeCheckingMode = " strict"
128+
129+ include = [
130+ " **/*.py" ,
131+ " **/*.pyw" ,
132+ ]
133+
134+ exclude = [
135+ " sconstruct" ,
136+ " *sconscript" ,
137+ " .git" ,
138+ " __pycache__" ,
139+ " .tox" ,
140+ " build" ,
141+ " output" ,
142+ " .venv" ,
143+ # When excluding concrete paths relative to a directory,
144+ # not matching multiple folders by name e.g. `__pycache__`,
145+ # paths are relative to the configuration file.
146+ " ./include/*" ,
147+ " ./miscDeps" ,
148+ " ./source/louis" ,
149+ # #10924: generated by third-party dependencies
150+ " ./source/comInterfaces/*" ,
151+ # Code from add-ons
152+ " ./source/userConfig/addons/*" ,
153+ ]
154+
155+ # Tell pyright where to load python code from
156+ extraPaths = [
157+ " ./source" ,
158+ # Used by system tests
159+ " ./tests/system/libraries" ,
160+ # Used internally in NVDA
161+ " ./miscDeps/python" ,
162+ ]
163+
164+ # General config
165+ analyzeUnannotatedFunctions = true
166+ deprecateTypingAliases = true
167+
168+ # Stricter typing
169+ strictParameterNoneValue = true
170+ strictListInference = true
171+ strictDictionaryInference = true
172+ strictSetInference = true
173+
174+ # Compliant rules
175+ reportAssertAlwaysTrue = true
176+ reportAssertTypeFailure = true
177+ reportDuplicateImport = true
178+ reportIncompleteStub = true
179+ reportInconsistentOverload = true
180+ reportInconsistentConstructor = true
181+ reportInvalidStringEscapeSequence = true
182+ reportInvalidStubStatement = true
183+ reportInvalidTypeVarUse = true
184+ reportMatchNotExhaustive = true
185+ reportMissingModuleSource = true
186+ reportMissingImports = true
187+ reportNoOverloadImplementation = true
188+ reportOptionalContextManager = true
189+ reportOverlappingOverload = true
190+ reportPrivateImportUsage = true
191+ reportPropertyTypeMismatch = true
192+ reportSelfClsParameterName = true
193+ reportShadowedImports = true
194+ reportTypeCommentUsage = true
195+ reportTypedDictNotRequiredAccess = true
196+ reportUndefinedVariable = true
197+ reportUnusedExpression = true
198+ reportUnboundVariable = true
199+ reportUnhashable = true
200+ reportUnnecessaryCast = true
201+ reportUnnecessaryContains = true
202+ reportUnnecessaryTypeIgnoreComment = true
203+ reportUntypedClassDecorator = true
204+ reportUntypedFunctionDecorator = true
205+ reportUnusedClass = true
206+ reportUnusedCoroutine = true
207+ reportUnusedExcept = true
208+
209+ # Should switch to true when possible
210+ reportDeprecated = false # 1834 errors
211+
212+ # Can be enabled by generating type stubs for modules via pyright CLI
213+ reportMissingTypeStubs = false
214+
215+ # Bad rules
216+ # These are roughly sorted by compliance to make it easier for devs to focus on enabling them.
217+ # Errors were last checked Feb 2025.
218+ # 1-50 errors
219+ reportUnsupportedDunderAll = false # 2 errors
220+ reportAbstractUsage = false # 3 errors
221+ reportUntypedBaseClass = false # 4 errors
222+ reportOptionalIterable = false # 5 errors
223+ reportCallInDefaultInitializer = false # 6 errors
224+ reportInvalidTypeArguments = false # 7 errors
225+ reportUntypedNamedTuple = false # 11 errors
226+ reportRedeclaration = false # 12 errors
227+ reportOptionalCall = false # 16 errors
228+ reportConstantRedefinition = false # 18 errors
229+ reportWildcardImportFromLibrary = false # 26 errors
230+ reportIncompatibleVariableOverride = false # 28 errors
231+ reportInvalidTypeForm = false # 38 errors
232+
233+
234+ # 50-100 errors
235+ reportGeneralTypeIssues = false # 53 errors
236+ reportOptionalOperand = false # 59 errors
237+ reportUnnecessaryComparison = false # 67 errors
238+ reportFunctionMemberAccess = false # 80 errors
239+ reportUnnecessaryIsInstance = false # 88 errors
240+ reportUnusedFunction = false # 97 errors
241+ reportImportCycles = false # 99 errors
242+ reportUnusedImport = false # 113 errors
243+ reportUnusedVariable = false # 147 errors
244+
245+ # 100-1000 errors
246+ reportOperatorIssue = false # 102 errors
247+ reportAssignmentType = false # 103 errors
248+ reportReturnType = false # 104 errors
249+ reportPossiblyUnboundVariable = false # 126 errors
250+ reportMissingSuperCall = false # 159 errors
251+ reportUninitializedInstanceVariable = false # 179 errors
252+ reportUnknownLambdaType = false # 196 errors
253+ reportMissingTypeArgument = false # 204 errors
254+ reportImplicitStringConcatenation = false # 300+ errors
255+ reportIncompatibleMethodOverride = false # 300+ errors
256+ reportPrivateUsage = false # 900+ errors
257+
258+ # 1000+ errors
259+ reportUnusedCallResult = false # 1000+ errors
260+ reportOptionalSubscript = false # 1000+ errors, mostly failing to recognize config setter/getter
261+ reportCallIssue = false # 1000+ errors, mostly failing to recognize config setter/getter
262+ reportOptionalMemberAccess = false # 1683 errors
263+ reportImplicitOverride = false # 2000+ errors
264+ reportIndexIssue = false # 2000+ errors, mostly failing to recognize config setter/getter
265+ reportAttributeAccessIssue = false # 2000+ errors
266+ reportArgumentType = false # 2000+ errors
267+ reportUnknownParameterType = false # 4000+ errors
268+ reportMissingParameterType = false # 4000+ errors
269+ reportUnknownVariableType = false # 6000+ errors
270+ reportUnknownArgumentType = false # 6000+ errors
271+ reportUnknownMemberType = false # 20000+ errors
0 commit comments