From 2c313972d3a013b8cf828711839da9f2229a746c Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Thu, 6 Jun 2024 15:08:29 -0700 Subject: [PATCH] Simplified JSON schema for config file in advance of adding config overrides for execution contexts. --- .../src/tests/diagnosticOverrides.test.ts | 14 +- .../schemas/pyrightconfig.schema.json | 1006 ++++++++++------- 2 files changed, 582 insertions(+), 438 deletions(-) diff --git a/packages/pyright-internal/src/tests/diagnosticOverrides.test.ts b/packages/pyright-internal/src/tests/diagnosticOverrides.test.ts index d9dd0582c..7e5a29380 100644 --- a/packages/pyright-internal/src/tests/diagnosticOverrides.test.ts +++ b/packages/pyright-internal/src/tests/diagnosticOverrides.test.ts @@ -42,12 +42,14 @@ describe('Diagnostic overrides', () => { for (const propName of overrideNamesInJson) { const p = json.properties[propName]; - expect(p['$id']).toEqual(`#/properties/${propName}`); - expect(p['$ref']).toEqual(`#/definitions/diagnostic`); - expect(p.title).toBeDefined(); - expect(p.title.length).toBeGreaterThan(0); - expect(p.default).toBeDefined(); - expect(enumValues).toContain(p.default); + const ref = p['$ref']; + const def = json.definitions[ref.substring(ref.lastIndexOf('/') + 1)]; + + expect(def['$ref']).toEqual(`#/definitions/diagnostic`); + expect(def.title).toBeDefined(); + expect(def.title.length).toBeGreaterThan(0); + expect(def.default).toBeDefined(); + expect(enumValues).toContain(def.default); } const overrideNamesInCode: string[] = Object.values(DiagnosticRule).filter((x) => x.startsWith('report')); diff --git a/packages/vscode-pyright/schemas/pyrightconfig.schema.json b/packages/vscode-pyright/schemas/pyrightconfig.schema.json index 94c43be98..d3911e34a 100644 --- a/packages/vscode-pyright/schemas/pyrightconfig.schema.json +++ b/packages/vscode-pyright/schemas/pyrightconfig.schema.json @@ -20,61 +20,529 @@ ] } ] + }, + "extraPaths": { + "type": "array", + "title": "Additional import search resolution paths", + "items": { + "type": "string", + "title": "Additional import search resolution path", + "default": "", + "pattern": "^(.*)$" + } + }, + "pythonVersion": { + "type": "string", + "title": "Python version to assume during type analysis", + "default": "", + "examples": [ + "3.7" + ], + "pattern": "^3\\.[0-9]+$" + }, + "pythonPlatform": { + "type": "string", + "title": "Python platform to assume during type analysis", + "default": "", + "examples": [ + "Linux" + ], + "pattern": "^(Linux|Windows|Darwin|All)$" + }, + "disableBytesTypePromotions": { + "type": "boolean", + "title": "Do not treat `bytearray` and `memoryview` as implicit subtypes of `bytes`", + "default": false + }, + "strictListInference": { + "type": "boolean", + "title": "Infer strict types for list expressions", + "default": false + }, + "strictSetInference": { + "type": "boolean", + "title": "Infer strict types for set expressions", + "default": false + }, + "strictDictionaryInference": { + "type": "boolean", + "title": "Infer strict types for dictionary expressions", + "default": false + }, + "analyzeUnannotatedFunctions": { + "type": "boolean", + "title": "Analyze and report diagnostics for functions that have no annotations", + "default": true + }, + "strictParameterNoneValue": { + "type": "boolean", + "title": "Allow implicit Optional when default parameter value is None", + "default": true + }, + "enableExperimentalFeatures": { + "type": "boolean", + "title": "Enable the use of experimental features that are not part of the Python typing spec", + "default": false + }, + "enableTypeIgnoreComments": { + "type": "boolean", + "title": "Allow \"# type: ignore\" comments", + "default": true + }, + "deprecateTypingAliases": { + "type": "boolean", + "title": "Treat typing-specific aliases to standard types as deprecated", + "default": false + }, + "reportGeneralTypeIssues": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of general type issues", + "default": "error" + }, + "reportPropertyTypeMismatch": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of property getter/setter type mismatches", + "default": "none" + }, + "reportFunctionMemberAccess": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of member accesses on function objects", + "default": "error" + }, + "reportMissingImports": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of imports that cannot be resolved", + "default": "error" + }, + "reportMissingModuleSource": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of imports that cannot be resolved to source files", + "default": "warning" + }, + "reportInvalidTypeForm": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of type expressions that use an invalid form", + "default": "error" + }, + "reportMissingTypeStubs": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of imports that cannot be resolved to type stub files", + "default": "none" + }, + "reportImportCycles": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of module imports that create cycles in import graph", + "default": "none" + }, + "reportUnusedImport": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of imported symbols that are not referenced within the source file", + "default": "none" + }, + "reportUnusedClass": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of private classes that are not accessed", + "default": "none" + }, + "reportUnusedFunction": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of private functions or methods that are not accessed", + "default": "none" + }, + "reportUnusedVariable": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of local variables that are not accessed", + "default": "none" + }, + "reportDuplicateImport": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of symbols or modules that are imported more than once", + "default": "none" + }, + "reportWildcardImportFromLibrary": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of wildcard import from external library", + "default": "warning" + }, + "reportAbstractUsage": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempted instantiation of abstract class", + "default": "error" + }, + "reportArgumentType": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of incompatible argument type", + "default": "error" + }, + "reportAssertTypeFailure": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of type mismatch detected by typing.assert_type call", + "default": "error" + }, + "reportAssignmentType": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of type incompatibilities for assignments", + "default": "error" + }, + "reportAttributeAccessIssue": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of issues related to attribute accesses", + "default": "error" + }, + "reportCallIssue": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of issues related to call expressions and arguments", + "default": "error" + }, + "reportInconsistentOverload": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of inconsistencies between function overload signatures", + "default": "error" + }, + "reportIndexIssue": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of issues related to index operations and expressions", + "default": "error" + }, + "reportInvalidTypeArguments": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of invalid type argument usage", + "default": "error" + }, + "reportNoOverloadImplementation": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of an overloaded function or method with a missing implementation", + "default": "error" + }, + "reportOperatorIssue": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of diagnostics related to unary and binary operators", + "default": "error" + }, + "reportOptionalSubscript": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempts to subscript (index) a variable with Optional type", + "default": "error" + }, + "reportOptionalMemberAccess": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempts to access a member of a variable with Optional type", + "default": "error" + }, + "reportOptionalCall": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempts to call a variable with Optional type", + "default": "error" + }, + "reportOptionalIterable": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempts to use an Optional type as an iterable value", + "default": "error" + }, + "reportOptionalContextManager": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempts to use an Optional type as a parameter to a with statement", + "default": "error" + }, + "reportOptionalOperand": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempts to use an Optional type as an operand for a binary or unary operator", + "default": "error" + }, + "reportRedeclaration": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempts to declare the type of a symbol multiple times", + "default": "error" + }, + "reportReturnType": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of function return type incompatibility", + "default": "error" + }, + "reportTypedDictNotRequiredAccess": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempts to access a non-required key in a TypedDict without a check for its presence", + "default": "error" + }, + "reportUntypedFunctionDecorator": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of function decorators without type annotations, which obscure function types", + "default": "none" + }, + "reportUntypedClassDecorator": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of class decorators without type annotations, which obscure class types", + "default": "none" + }, + "reportUntypedBaseClass": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of a base class of an unknown type, which obscures most type checking for the class", + "default": "none" + }, + "reportUntypedNamedTuple": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of a named tuple definition that does not contain type information", + "default": "none" + }, + "reportPrivateUsage": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of private variables and functions used outside of the owning class or module and usage of protected members outside of subclasses", + "default": "none" + }, + "reportTypeCommentUsage": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of deprecated type comment usage", + "default": "none" + }, + "reportPrivateImportUsage": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of improper usage of symbol imported from a \"py.typed\" module that is not re-exported from that module", + "default": "error" + }, + "reportConstantRedefinition": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempts to redefine variables that are in all-caps", + "default": "none" + }, + "reportDeprecated": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of use of deprecated class or function", + "default": "none" + }, + "reportIncompatibleMethodOverride": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of method overrides in subclasses that redefine the method in an incompatible way", + "default": "error" + }, + "reportIncompatibleVariableOverride": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of overrides in subclasses that redefine a variable in an incompatible way", + "default": "error" + }, + "reportInconsistentConstructor": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of __init__ and __new__ methods whose signatures are inconsistent", + "default": "none" + }, + "reportOverlappingOverload": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of function overloads that overlap in signature and obscure each other or do not agree on return type", + "default": "error" + }, + "reportPossiblyUnboundVariable": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempts to use variable that is possibly unbound on some code paths", + "default": "error" + }, + "reportMissingSuperCall": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of missing call to parent class for inherited `__init__` methods", + "default": "none" + }, + "reportUninitializedInstanceVariable": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of instance variables that are not initialized in the constructor", + "default": "none" + }, + "reportInvalidStringEscapeSequence": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of invalid escape sequences used within string literals", + "default": "warning" + }, + "reportUnknownParameterType": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting input and return parameters whose types are unknown", + "default": "none" + }, + "reportUnknownArgumentType": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting argument expressions whose types are unknown", + "default": "none" + }, + "reportUnknownLambdaType": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting input and return parameters for lambdas whose types are unknown", + "default": "none" + }, + "reportUnknownVariableType": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting local variables whose types are unknown", + "default": "none" + }, + "reportUnknownMemberType": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting class and instance variables whose types are unknown", + "default": "none" + }, + "reportMissingParameterType": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting input parameters that are missing a type annotation", + "default": "none" + }, + "reportMissingTypeArgument": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting generic class reference with missing type arguments", + "default": "none" + }, + "reportInvalidTypeVarUse": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting improper use of type variables within function signatures", + "default": "warning" + }, + "reportCallInDefaultInitializer": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting usage of function calls within a default value initializer expression", + "default": "none" + }, + "reportUnnecessaryIsInstance": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting calls to 'isinstance' or 'issubclass' where the result is statically determined to be always true", + "default": "none" + }, + "reportUnnecessaryCast": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting calls to 'cast' that are unnecessary", + "default": "none" + }, + "reportUnnecessaryComparison": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting the use of '==' or '!=' comparisons that are unnecessary", + "default": "none" + }, + "reportUnnecessaryContains": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting the use of 'in' operations that are unnecessary", + "default": "none" + }, + "reportAssertAlwaysTrue": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting assert expressions that will always evaluate to true", + "default": "warning" + }, + "reportSelfClsParameterName": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting missing or misnamed self parameters", + "default": "warning" + }, + "reportImplicitStringConcatenation": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting usage of implicit concatenation of string literals", + "default": "none" + }, + "reportUnboundVariable": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempts to use an unbound variable", + "default": "error" + }, + "reportUnhashable": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of unhashable object in container that requires hashability", + "default": "error" + }, + "reportUndefinedVariable": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of attempts to use an undefined variable", + "default": "error" + }, + "reportInvalidStubStatement": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of type stub statements that do not conform to PEP 484", + "default": "none" + }, + "reportIncompleteStub": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of incomplete type stubs that declare a module-level __getattr__ function", + "default": "none" + }, + "reportUnsupportedDunderAll": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of unsupported operations performed on __all__", + "default": "warning" + }, + "reportUnusedCallResult": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of call expressions whose results are not consumed", + "default": "none" + }, + "reportUnusedCoroutine": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of call expressions that returns Coroutine whose results are not consumed", + "default": "error" + }, + "reportUnusedExcept": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of unreachable except clauses", + "default": "error" + }, + "reportUnusedExpression": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of simple expressions whose value is not used in any way", + "default": "warning" + }, + "reportUnnecessaryTypeIgnoreComment": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of '# type: ignore' comments that have no effect'", + "default": "none" + }, + "reportMatchNotExhaustive": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of 'match' statements that do not exhaustively match all possible values", + "default": "none" + }, + "reportShadowedImports": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting of shadowed imports of stdlib modules", + "default": "none" + }, + "reportImplicitOverride": { + "$ref": "#/definitions/diagnostic", + "title": "Controls reporting overridden methods that are missing an `@override` decorator", + "default": "none" } }, "properties": { "extends": { - "$id": "#/properties/extends", "type": "string", "title": "Path to configuration file that this configuration extends", "pattern": "^(.*)$" }, "include": { - "$id": "#/properties/include", "type": "array", "title": "Files and directories included in type analysis", "items": { - "$id": "#/properties/include/items", "type": "string", "title": "File or directory to include in type analysis", "pattern": "^(.*)$" } }, "exclude": { - "$id": "#/properties/exclude", "type": "array", "title": "Files and directories excluded from type analysis", "items": { - "$id": "#/properties/exclude/items", "type": "string", "title": "File or directory to exclude from type analysis", "pattern": "^(.*)$" } }, "ignore": { - "$id": "#/properties/ignore", "type": "array", "title": "Files and directories whose diagnostics are suppressed", "items": { - "$id": "#/properties/ignore/items", "type": "string", "title": "File or directory where diagnostics should be suppressed", "pattern": "^(.*)$" } }, "strict": { - "$id": "#/properties/strict", "type": "array", "title": "Files and directories that should use 'strict' type checking rules", "items": { - "$id": "#/properties/strict/items", "type": "string", "title": "File or directory that should use 'strict' type checking rules", "pattern": "^(.*)$" } }, "defineConstant": { - "$id": "#/properties/defineConstant", "type": "object", "title": "Identifiers that should be treated as constants", "properties": { @@ -85,7 +553,6 @@ } }, "typeCheckingMode": { - "$id": "#/properties/typeCheckingMode", "type": "string", "enum": [ "off", @@ -97,20 +564,17 @@ "default": "standard" }, "useLibraryCodeForTypes": { - "$id": "#/properties/useLibraryCodeForTypes", "type": "boolean", "title": "Use library implementations to extract type information when type stub is not present", "default": true }, "typeshedPath": { - "$id": "#/properties/typeshedPath", "type": "string", "title": "Path to directory containing typeshed type stub files", "default": "", "pattern": "^(.*)$" }, "stubPath": { - "$id": "#/properties/stubPath", "type": "string", "title": "Path to directory containing custom type stub files", "default": "", @@ -120,586 +584,291 @@ "pattern": "^(.*)$" }, "disableBytesTypePromotions": { - "$id": "#/properties/disableBytesTypePromotions", - "type": "boolean", - "title": "Do not treat `bytearray` and `memoryview` as implicit subtypes of `bytes`", - "default": false + "$ref": "#/definitions/disableBytesTypePromotions" }, "strictListInference": { - "$id": "#/properties/strictListInference", - "type": "boolean", - "title": "Infer strict types for list expressions", - "default": false + "$ref": "#/definitions/strictListInference" }, "strictSetInference": { - "$id": "#/properties/strictSetInference", - "type": "boolean", - "title": "Infer strict types for set expressions", - "default": false + "$ref": "#/definitions/strictSetInference" }, "strictDictionaryInference": { - "$id": "#/properties/strictDictionaryInference", - "type": "boolean", - "title": "Infer strict types for dictionary expressions", - "default": false + "$ref": "#/definitions/strictDictionaryInference" }, "analyzeUnannotatedFunctions": { - "$id": "#/properties/analyzeUnannotatedFunctions", - "type": "boolean", - "title": "Analyze and report diagnostics for functions that have no annotations", - "default": true + "$ref": "#/definitions/analyzeUnannotatedFunctions" }, "strictParameterNoneValue": { - "$id": "#/properties/strictParameterNoneValue", - "type": "boolean", - "title": "Allow implicit Optional when default parameter value is None", - "default": true + "$ref": "#/definitions/strictParameterNoneValue" }, "enableExperimentalFeatures": { - "$id": "#/properties/enableExperimentalFeatures", - "type": "boolean", - "title": "Enable the use of experimental features that are not part of the Python typing spec", - "default": false + "$ref": "#/definitions/enableExperimentalFeatures" }, "enableTypeIgnoreComments": { - "$id": "#/properties/enableTypeIgnoreComments", - "type": "boolean", - "title": "Allow \"# type: ignore\" comments", - "default": true + "$ref": "#/definitions/enableTypeIgnoreComments" }, "deprecateTypingAliases": { - "$id": "#/properties/deprecateTypingAliases", - "type": "boolean", - "title": "Treat typing-specific aliases to standard types as deprecated", - "default": false + "$ref": "#/definitions/deprecateTypingAliases" }, "reportGeneralTypeIssues": { - "$id": "#/properties/reportGeneralTypeIssues", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of general type issues", - "default": "error" + "$ref": "#/definitions/reportGeneralTypeIssues" }, "reportPropertyTypeMismatch": { - "$id": "#/properties/reportPropertyTypeMismatch", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of property getter/setter type mismatches", - "default": "none" + "$ref": "#/definitions/reportPropertyTypeMismatch" }, "reportFunctionMemberAccess": { - "$id": "#/properties/reportFunctionMemberAccess", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of member accesses on function objects", - "default": "error" + "$ref": "#/definitions/reportFunctionMemberAccess" }, "reportMissingImports": { - "$id": "#/properties/reportMissingImports", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of imports that cannot be resolved", - "default": "error" + "$ref": "#/definitions/reportMissingImports" }, "reportMissingModuleSource": { - "$id": "#/properties/reportMissingModuleSource", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of imports that cannot be resolved to source files", - "default": "warning" + "$ref": "#/definitions/reportMissingModuleSource" }, "reportInvalidTypeForm": { - "$id": "#/properties/reportInvalidTypeForm", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of type expressions that use an invalid form", - "default": "error" + "$ref": "#/definitions/reportInvalidTypeForm" }, "reportMissingTypeStubs": { - "$id": "#/properties/reportMissingTypeStubs", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of imports that cannot be resolved to type stub files", - "default": "none" + "$ref": "#/definitions/reportMissingTypeStubs" }, "reportImportCycles": { - "$id": "#/properties/reportImportCycles", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of module imports that create cycles in import graph", - "default": "none" + "$ref": "#/definitions/reportImportCycles" }, "reportUnusedImport": { - "$id": "#/properties/reportUnusedImport", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of imported symbols that are not referenced within the source file", - "default": "none" + "$ref": "#/definitions/reportUnusedImport" }, "reportUnusedClass": { - "$id": "#/properties/reportUnusedClass", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of private classes that are not accessed", - "default": "none" + "$ref": "#/definitions/reportUnusedClass" }, "reportUnusedFunction": { - "$id": "#/properties/reportUnusedFunction", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of private functions or methods that are not accessed", - "default": "none" + "$ref": "#/definitions/reportUnusedFunction" }, "reportUnusedVariable": { - "$id": "#/properties/reportUnusedVariable", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of local variables that are not accessed", - "default": "none" + "$ref": "#/definitions/reportUnusedVariable" }, "reportDuplicateImport": { - "$id": "#/properties/reportDuplicateImport", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of symbols or modules that are imported more than once", - "default": "none" + "$ref": "#/definitions/reportDuplicateImport" }, "reportWildcardImportFromLibrary": { - "$id": "#/properties/reportWildcardImportFromLibrary", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of wildcard import from external library", - "default": "warning" + "$ref": "#/definitions/reportWildcardImportFromLibrary" }, "reportAbstractUsage": { - "$id": "#/properties/reportAbstractUsage", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempted instantiation of abstract class", - "default": "error" + "$ref": "#/definitions/reportAbstractUsage" }, "reportArgumentType": { - "$id": "#/properties/reportArgumentType", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of incompatible argument type", - "default": "error" + "$ref": "#/definitions/reportArgumentType" }, "reportAssertTypeFailure": { - "$id": "#/properties/reportAssertTypeFailure", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of type mismatch detected by typing.assert_type call", - "default": "error" + "$ref": "#/definitions/reportAssertTypeFailure" }, "reportAssignmentType": { - "$id": "#/properties/reportAssignmentType", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of type incompatibilities for assignments", - "default": "error" + "$ref": "#/definitions/reportAssignmentType" }, "reportAttributeAccessIssue": { - "$id": "#/properties/reportAttributeAccessIssue", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of issues related to attribute accesses", - "default": "error" + "$ref": "#/definitions/reportAttributeAccessIssue" }, "reportCallIssue": { - "$id": "#/properties/reportCallIssue", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of issues related to call expressions and arguments", - "default": "error" + "$ref": "#/definitions/reportCallIssue" }, "reportInconsistentOverload": { - "$id": "#/properties/reportInconsistentOverload", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of inconsistencies between function overload signatures", - "default": "error" + "$ref": "#/definitions/reportInconsistentOverload" }, "reportIndexIssue": { - "$id": "#/properties/reportIndexIssue", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of issues related to index operations and expressions", - "default": "error" + "$ref": "#/definitions/reportIndexIssue" }, "reportInvalidTypeArguments": { - "$id": "#/properties/reportInvalidTypeArguments", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of invalid type argument usage", - "default": "error" + "$ref": "#/definitions/reportInvalidTypeArguments" }, "reportNoOverloadImplementation": { - "$id": "#/properties/reportNoOverloadImplementation", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of an overloaded function or method with a missing implementation", - "default": "error" + "$ref": "#/definitions/reportNoOverloadImplementation" }, "reportOperatorIssue": { - "$id": "#/properties/reportOperatorIssue", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of diagnostics related to unary and binary operators", - "default": "error" + "$ref": "#/definitions/reportOperatorIssue" }, "reportOptionalSubscript": { - "$id": "#/properties/reportOptionalSubscript", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempts to subscript (index) a variable with Optional type", - "default": "error" + "$ref": "#/definitions/reportOptionalSubscript" }, "reportOptionalMemberAccess": { - "$id": "#/properties/reportOptionalMemberAccess", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempts to access a member of a variable with Optional type", - "default": "error" + "$ref": "#/definitions/reportOptionalMemberAccess" }, "reportOptionalCall": { - "$id": "#/properties/reportOptionalCall", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempts to call a variable with Optional type", - "default": "error" + "$ref": "#/definitions/reportOptionalCall" }, "reportOptionalIterable": { - "$id": "#/properties/reportOptionalIterable", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempts to use an Optional type as an iterable value", - "default": "error" + "$ref": "#/definitions/reportOptionalIterable" }, "reportOptionalContextManager": { - "$id": "#/properties/reportOptionalContextManager", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempts to use an Optional type as a parameter to a with statement", - "default": "error" + "$ref": "#/definitions/reportOptionalContextManager" }, "reportOptionalOperand": { - "$id": "#/properties/reportOptionalOperand", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempts to use an Optional type as an operand for a binary or unary operator", - "default": "error" + "$ref": "#/definitions/reportOptionalOperand" }, "reportRedeclaration": { - "$id": "#/properties/reportRedeclaration", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempts to declare the type of a symbol multiple times", - "default": "error" + "$ref": "#/definitions/reportRedeclaration" }, "reportReturnType": { - "$id": "#/properties/reportReturnType", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of function return type incompatibility", - "default": "error" + "$ref": "#/definitions/reportReturnType" }, "reportTypedDictNotRequiredAccess": { - "$id": "#/properties/reportTypedDictNotRequiredAccess", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempts to access a non-required key in a TypedDict without a check for its presence", - "default": "error" + "$ref": "#/definitions/reportTypedDictNotRequiredAccess" }, "reportUntypedFunctionDecorator": { - "$id": "#/properties/reportUntypedFunctionDecorator", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of function decorators without type annotations, which obscure function types", - "default": "none" + "$ref": "#/definitions/reportUntypedFunctionDecorator" }, "reportUntypedClassDecorator": { - "$id": "#/properties/reportUntypedClassDecorator", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of class decorators without type annotations, which obscure class types", - "default": "none" + "$ref": "#/definitions/reportUntypedClassDecorator" }, "reportUntypedBaseClass": { - "$id": "#/properties/reportUntypedBaseClass", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of a base class of an unknown type, which obscures most type checking for the class", - "default": "none" + "$ref": "#/definitions/reportUntypedBaseClass" }, "reportUntypedNamedTuple": { - "$id": "#/properties/reportUntypedNamedTuple", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of a named tuple definition that does not contain type information", - "default": "none" + "$ref": "#/definitions/reportUntypedNamedTuple" }, "reportPrivateUsage": { - "$id": "#/properties/reportPrivateUsage", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of private variables and functions used outside of the owning class or module and usage of protected members outside of subclasses", - "default": "none" + "$ref": "#/definitions/reportPrivateUsage" }, "reportTypeCommentUsage": { - "$id": "#/properties/reportTypeCommentUsage", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of deprecated type comment usage", - "default": "none" + "$ref": "#/definitions/reportTypeCommentUsage" }, "reportPrivateImportUsage": { - "$id": "#/properties/reportPrivateImportUsage", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of improper usage of symbol imported from a \"py.typed\" module that is not re-exported from that module", - "default": "error" + "$ref": "#/definitions/reportPrivateImportUsage" }, "reportConstantRedefinition": { - "$id": "#/properties/reportConstantRedefinition", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempts to redefine variables that are in all-caps", - "default": "none" + "$ref": "#/definitions/reportConstantRedefinition" }, "reportDeprecated": { - "$id": "#/properties/reportDeprecated", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of use of deprecated class or function", - "default": "none" + "$ref": "#/definitions/reportDeprecated" }, "reportIncompatibleMethodOverride": { - "$id": "#/properties/reportIncompatibleMethodOverride", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of method overrides in subclasses that redefine the method in an incompatible way", - "default": "error" + "$ref": "#/definitions/reportIncompatibleMethodOverride" }, "reportIncompatibleVariableOverride": { - "$id": "#/properties/reportIncompatibleVariableOverride", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of overrides in subclasses that redefine a variable in an incompatible way", - "default": "error" + "$ref": "#/definitions/reportIncompatibleVariableOverride" }, "reportInconsistentConstructor": { - "$id": "#/properties/reportInconsistentConstructor", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of __init__ and __new__ methods whose signatures are inconsistent", - "default": "none" + "$ref": "#/definitions/reportInconsistentConstructor" }, "reportOverlappingOverload": { - "$id": "#/properties/reportOverlappingOverload", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of function overloads that overlap in signature and obscure each other or do not agree on return type", - "default": "error" + "$ref": "#/definitions/reportOverlappingOverload" }, "reportPossiblyUnboundVariable": { - "$id": "#/properties/reportPossiblyUnboundVariable", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempts to use variable that is possibly unbound on some code paths", - "default": "error" + "$ref": "#/definitions/reportPossiblyUnboundVariable" }, "reportMissingSuperCall": { - "$id": "#/properties/reportMissingSuperCall", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of missing call to parent class for inherited `__init__` methods", - "default": "none" + "$ref": "#/definitions/reportMissingSuperCall" }, "reportUninitializedInstanceVariable": { - "$id": "#/properties/reportUninitializedInstanceVariable", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of instance variables that are not initialized in the constructor", - "default": "none" + "$ref": "#/definitions/reportUninitializedInstanceVariable" }, "reportInvalidStringEscapeSequence": { - "$id": "#/properties/reportInvalidStringEscapeSequence", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of invalid escape sequences used within string literals", - "default": "warning" + "$ref": "#/definitions/reportInvalidStringEscapeSequence" }, "reportUnknownParameterType": { - "$id": "#/properties/reportUnknownParameterType", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting input and return parameters whose types are unknown", - "default": "none" + "$ref": "#/definitions/reportUnknownParameterType" }, "reportUnknownArgumentType": { - "$id": "#/properties/reportUnknownArgumentType", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting argument expressions whose types are unknown", - "default": "none" + "$ref": "#/definitions/reportUnknownArgumentType" }, "reportUnknownLambdaType": { - "$id": "#/properties/reportUnknownLambdaType", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting input and return parameters for lambdas whose types are unknown", - "default": "none" + "$ref": "#/definitions/reportUnknownLambdaType" }, "reportUnknownVariableType": { - "$id": "#/properties/reportUnknownVariableType", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting local variables whose types are unknown", - "default": "none" + "$ref": "#/definitions/reportUnknownVariableType" }, "reportUnknownMemberType": { - "$id": "#/properties/reportUnknownMemberType", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting class and instance variables whose types are unknown", - "default": "none" + "$ref": "#/definitions/reportUnknownMemberType" }, "reportMissingParameterType": { - "$id": "#/properties/reportMissingParameterType", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting input parameters that are missing a type annotation", - "default": "none" + "$ref": "#/definitions/reportMissingParameterType" }, "reportMissingTypeArgument": { - "$id": "#/properties/reportMissingTypeArgument", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting generic class reference with missing type arguments", - "default": "none" + "$ref": "#/definitions/reportMissingTypeArgument" }, "reportInvalidTypeVarUse": { - "$id": "#/properties/reportInvalidTypeVarUse", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting improper use of type variables within function signatures", - "default": "warning" + "$ref": "#/definitions/reportInvalidTypeVarUse" }, "reportCallInDefaultInitializer": { - "$id": "#/properties/reportCallInDefaultInitializer", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting usage of function calls within a default value initializer expression", - "default": "none" + "$ref": "#/definitions/reportCallInDefaultInitializer" }, "reportUnnecessaryIsInstance": { - "$id": "#/properties/reportUnnecessaryIsInstance", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting calls to 'isinstance' or 'issubclass' where the result is statically determined to be always true", - "default": "none" + "$ref": "#/definitions/reportUnnecessaryIsInstance" }, "reportUnnecessaryCast": { - "$id": "#/properties/reportUnnecessaryCast", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting calls to 'cast' that are unnecessary", - "default": "none" + "$ref": "#/definitions/reportUnnecessaryCast" }, "reportUnnecessaryComparison": { - "$id": "#/properties/reportUnnecessaryComparison", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting the use of '==' or '!=' comparisons that are unnecessary", - "default": "none" + "$ref": "#/definitions/reportUnnecessaryComparison" }, "reportUnnecessaryContains": { - "$id": "#/properties/reportUnnecessaryContains", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting the use of 'in' operations that are unnecessary", - "default": "none" + "$ref": "#/definitions/reportUnnecessaryContains" }, "reportAssertAlwaysTrue": { - "$id": "#/properties/reportAssertAlwaysTrue", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting assert expressions that will always evaluate to true", - "default": "warning" + "$ref": "#/definitions/reportAssertAlwaysTrue" }, "reportSelfClsParameterName": { - "$id": "#/properties/reportSelfClsParameterName", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting missing or misnamed self parameters", - "default": "warning" + "$ref": "#/definitions/reportSelfClsParameterName" }, "reportImplicitStringConcatenation": { - "$id": "#/properties/reportImplicitStringConcatenation", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting usage of implicit concatenation of string literals", - "default": "none" + "$ref": "#/definitions/reportImplicitStringConcatenation" }, "reportUnboundVariable": { - "$id": "#/properties/reportUnboundVariable", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempts to use an unbound variable", - "default": "error" + "$ref": "#/definitions/reportUnboundVariable" }, "reportUnhashable": { - "$id": "#/properties/reportUnhashable", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of unhashable object in container that requires hashability", - "default": "error" + "$ref": "#/definitions/reportUnhashable" }, "reportUndefinedVariable": { - "$id": "#/properties/reportUndefinedVariable", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of attempts to use an undefined variable", - "default": "error" + "$ref": "#/definitions/reportUndefinedVariable" }, "reportInvalidStubStatement": { - "$id": "#/properties/reportInvalidStubStatement", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of type stub statements that do not conform to PEP 484", - "default": "none" + "$ref": "#/definitions/reportInvalidStubStatement" }, "reportIncompleteStub": { - "$id": "#/properties/reportIncompleteStub", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of incomplete type stubs that declare a module-level __getattr__ function", - "default": "none" + "$ref": "#/definitions/reportIncompleteStub" }, "reportUnsupportedDunderAll": { - "$id": "#/properties/reportUnsupportedDunderAll", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of unsupported operations performed on __all__", - "default": "warning" + "$ref": "#/definitions/reportUnsupportedDunderAll" }, "reportUnusedCallResult": { - "$id": "#/properties/reportUnusedCallResult", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of call expressions whose results are not consumed", - "default": "none" + "$ref": "#/definitions/reportUnusedCallResult" }, "reportUnusedCoroutine": { - "$id": "#/properties/reportUnusedCoroutine", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of call expressions that returns Coroutine whose results are not consumed", - "default": "error" + "$ref": "#/definitions/reportUnusedCoroutine" }, "reportUnusedExcept": { - "$id": "#/properties/reportUnusedExcept", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of unreachable except clauses", - "default": "error" + "$ref": "#/definitions/reportUnusedExcept" }, "reportUnusedExpression": { - "$id": "#/properties/reportUnusedExpression", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of simple expressions whose value is not used in any way", - "default": "warning" + "$ref": "#/definitions/reportUnusedExpression" }, "reportUnnecessaryTypeIgnoreComment": { - "$id": "#/properties/reportUnnecessaryTypeIgnoreComment", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of '# type: ignore' comments that have no effect'", - "default": "none" + "$ref": "#/definitions/reportUnnecessaryTypeIgnoreComment" }, "reportMatchNotExhaustive": { - "$id": "#/properties/reportMatchNotExhaustive", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of 'match' statements that do not exhaustively match all possible values", - "default": "none" + "$ref": "#/definitions/reportMatchNotExhaustive" }, "reportShadowedImports": { - "$id": "#/properties/reportShadowedImports", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting of shadowed imports of stdlib modules", - "default": "none" + "$ref": "#/definitions/reportShadowedImports" }, "reportImplicitOverride": { - "$id": "#/properties/reportImplicitOverride", - "$ref": "#/definitions/diagnostic", - "title": "Controls reporting overridden methods that are missing an `@override` decorator", - "default": "none" + "$ref": "#/definitions/reportImplicitOverride" }, "extraPaths": { - "$id": "#/properties/extraPaths", - "type": "array", - "title": "Additional import search resolution paths", - "items": { - "$id": "#/properties/extraPaths/items", - "type": "string", - "title": "Additional import search resolution path", - "default": "", - "pattern": "^(.*)$" - } + "$ref": "#/definitions/extraPaths" }, "pythonVersion": { - "$id": "#/properties/pythonVersion", - "type": "string", - "title": "Python version to assume during type analysis", - "default": "", - "examples": [ - "3.7" - ], - "pattern": "^3\\.[0-9]+$" + "$ref": "#/definitions/pythonVersion" }, "pythonPlatform": { - "$id": "#/properties/pythonPlatform", - "type": "string", - "title": "Python platform to assume during type analysis", - "default": "", - "examples": [ - "Linux" - ], - "pattern": "^(Linux|Windows|Darwin|All)$" + "$ref": "#/definitions/pythonPlatform" }, "venvPath": { - "$id": "#/properties/venvPath", "type": "string", "title": "Path to directory containing a folder of virtual environments", "default": "", "pattern": "^(.*)$" }, "venv": { - "$id": "#/properties/venv", "type": "string", "title": "Name of virtual environment subdirectory within venvPath", "default": "", @@ -709,17 +878,14 @@ "pattern": "^(.*)$" }, "verboseOutput": { - "$id": "#/properties/verboseOutput", "type": "boolean", "title": "Output verbose logging", "default": false }, "executionEnvironments": { - "$id": "#/properties/executionEnvironments", "type": "array", "title": "Analysis settings to use for specified subdirectories of code", "items": { - "$id": "#/properties/executionEnvironments/items", "type": "object", "title": "Analysis settings to use for specified subdirectories of code", "required": [ @@ -727,43 +893,19 @@ ], "properties": { "root": { - "$id": "#/properties/executionEnvironments/items/properties/root", "type": "string", "title": "Path to code subdirectory to which these settings apply", "default": "", "pattern": "^(.*)$" }, "extraPaths": { - "$id": "#/properties/executionEnvironments/items/properties/extraPaths", - "type": "array", - "title": "Additional import search resolution paths", - "items": { - "$id": "#/properties/executionEnvironments/items/properties/extraPaths/items", - "type": "string", - "title": "Additional import search resolution path", - "default": "", - "pattern": "^(.*)$" - } + "$ref": "#/definitions/extraPaths" }, "pythonVersion": { - "$id": "#/properties/executionEnvironments/items/properties/pythonVersion", - "type": "string", - "title": "Python version to assume during type analysis", - "default": "", - "examples": [ - "3.7" - ], - "pattern": "^3\\.[0-9]+$" + "$ref": "#/definitions/pythonVersion" }, "pythonPlatform": { - "$id": "#/properties/executionEnvironments/items/properties/pythonPlatform", - "type": "string", - "title": "Python platform to assume during type analysis", - "default": "", - "examples": [ - "Linux" - ], - "pattern": "^(Linux|Windows|Darwin|All)$" + "$ref": "#/definitions/pythonPlatform" } } }