mirror of
https://github.com/microsoft/pyright.git
synced 2024-08-16 19:30:26 +03:00
This commit is contained in:
parent
3ccd7b87b5
commit
6a042f7b58
@ -200,6 +200,8 @@ The following settings control pyright’s diagnostic output (warnings or errors
|
||||
|
||||
<a name="reportUnboundVariable"></a> **reportUnboundVariable** [boolean or string, optional]: Generate or suppress diagnostics for unbound variables. The default value for this setting is `"error"`.
|
||||
|
||||
<a name="reportUnhashable"></a> **reportUnhashable** [boolean or string, optional]: Generate or suppress diagnostics for the use of an unhashable object in a container that requires hashability.
|
||||
|
||||
<a name="reportInvalidStubStatement"></a> **reportInvalidStubStatement** [boolean or string, optional]: Generate or suppress diagnostics for statements that are syntactically correct but have no purpose within a type stub file. The default value for this setting is `"none"`.
|
||||
|
||||
<a name="reportIncompleteStub"></a> **reportIncompleteStub** [boolean or string, optional]: Generate or suppress diagnostics for a module-level `__getattr__` call in a type stub file, indicating that it is incomplete. The default value for this setting is `"none"`.
|
||||
@ -376,6 +378,7 @@ The following table lists the default severity levels for each diagnostic rule w
|
||||
| reportTypedDictNotRequiredAccess | "none" | "error" | "error" | "error" |
|
||||
| reportPrivateImportUsage | "none" | "error" | "error" | "error" |
|
||||
| reportUnboundVariable | "none" | "error" | "error" | "error" |
|
||||
| reportUnhashable | "none" | "error" | "error" | "error" |
|
||||
| reportUnusedCoroutine | "none" | "error" | "error" | "error" |
|
||||
| reportUnusedExcept | "none" | "error" | "error" | "error" |
|
||||
| reportFunctionMemberAccess | "none" | "none" | "error" | "error" |
|
||||
|
@ -13789,7 +13789,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
|
||||
|
||||
const message = isDictKey ? LocMessage.unhashableDictKey() : LocMessage.unhashableSetEntry();
|
||||
|
||||
addDiagnostic(DiagnosticRule.reportGeneralTypeIssues, message + diag.getString(), entry);
|
||||
addDiagnostic(DiagnosticRule.reportUnhashable, message + diag.getString(), entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,6 +333,9 @@ export interface DiagnosticRuleSet {
|
||||
// Report usage of unbound variables.
|
||||
reportUnboundVariable: DiagnosticLevel;
|
||||
|
||||
// Report use of unhashable type in a dictionary.
|
||||
reportUnhashable: DiagnosticLevel;
|
||||
|
||||
// Report statements that are syntactically correct but
|
||||
// have no semantic meaning within a type stub file.
|
||||
reportInvalidStubStatement: DiagnosticLevel;
|
||||
@ -474,6 +477,7 @@ export function getDiagLevelDiagnosticRules() {
|
||||
DiagnosticRule.reportSelfClsParameterName,
|
||||
DiagnosticRule.reportImplicitStringConcatenation,
|
||||
DiagnosticRule.reportUndefinedVariable,
|
||||
DiagnosticRule.reportUnhashable,
|
||||
DiagnosticRule.reportUnboundVariable,
|
||||
DiagnosticRule.reportInvalidStubStatement,
|
||||
DiagnosticRule.reportIncompleteStub,
|
||||
@ -579,6 +583,7 @@ export function getOffDiagnosticRuleSet(): DiagnosticRuleSet {
|
||||
reportSelfClsParameterName: 'none',
|
||||
reportImplicitStringConcatenation: 'none',
|
||||
reportUnboundVariable: 'none',
|
||||
reportUnhashable: 'none',
|
||||
reportUndefinedVariable: 'warning',
|
||||
reportInvalidStubStatement: 'none',
|
||||
reportIncompleteStub: 'none',
|
||||
@ -680,6 +685,7 @@ export function getBasicDiagnosticRuleSet(): DiagnosticRuleSet {
|
||||
reportSelfClsParameterName: 'warning',
|
||||
reportImplicitStringConcatenation: 'none',
|
||||
reportUnboundVariable: 'error',
|
||||
reportUnhashable: 'error',
|
||||
reportUndefinedVariable: 'error',
|
||||
reportInvalidStubStatement: 'none',
|
||||
reportIncompleteStub: 'none',
|
||||
@ -781,6 +787,7 @@ export function getStandardDiagnosticRuleSet(): DiagnosticRuleSet {
|
||||
reportSelfClsParameterName: 'warning',
|
||||
reportImplicitStringConcatenation: 'none',
|
||||
reportUnboundVariable: 'error',
|
||||
reportUnhashable: 'error',
|
||||
reportUndefinedVariable: 'error',
|
||||
reportInvalidStubStatement: 'none',
|
||||
reportIncompleteStub: 'none',
|
||||
@ -882,6 +889,7 @@ export function getStrictDiagnosticRuleSet(): DiagnosticRuleSet {
|
||||
reportSelfClsParameterName: 'error',
|
||||
reportImplicitStringConcatenation: 'none',
|
||||
reportUnboundVariable: 'error',
|
||||
reportUnhashable: 'error',
|
||||
reportUndefinedVariable: 'error',
|
||||
reportInvalidStubStatement: 'error',
|
||||
reportIncompleteStub: 'error',
|
||||
|
@ -90,6 +90,7 @@ export enum DiagnosticRule {
|
||||
reportImplicitStringConcatenation = 'reportImplicitStringConcatenation',
|
||||
reportUndefinedVariable = 'reportUndefinedVariable',
|
||||
reportUnboundVariable = 'reportUnboundVariable',
|
||||
reportUnhashable = 'reportUnhashable',
|
||||
reportInvalidStubStatement = 'reportInvalidStubStatement',
|
||||
reportIncompleteStub = 'reportIncompleteStub',
|
||||
reportUnsupportedDunderAll = 'reportUnsupportedDunderAll',
|
||||
|
@ -1327,6 +1327,22 @@
|
||||
false
|
||||
]
|
||||
},
|
||||
"reportUnhashable": {
|
||||
"type": [
|
||||
"string",
|
||||
"boolean"
|
||||
],
|
||||
"description": "Diagnostics for the use of an unhashable object in a container that requires hashability.",
|
||||
"default": "error",
|
||||
"enum": [
|
||||
"none",
|
||||
"information",
|
||||
"warning",
|
||||
"error",
|
||||
true,
|
||||
false
|
||||
]
|
||||
},
|
||||
"reportUnsupportedDunderAll": {
|
||||
"type": [
|
||||
"string",
|
||||
|
@ -575,6 +575,12 @@
|
||||
"title": "Controls reporting of attempts to use an unbound variable",
|
||||
"default": "error"
|
||||
},
|
||||
"reportUnhashable": {
|
||||
"$id": "#/properties/reportUnhashable",
|
||||
"$ref": "#/definitions/diagnostic",
|
||||
"title": "Controls reporting of unhashable object in container that requires hashability",
|
||||
"default": "error"
|
||||
},
|
||||
"reportUndefinedVariable": {
|
||||
"$id": "#/properties/reportUndefinedVariable",
|
||||
"$ref": "#/definitions/diagnostic",
|
||||
|
Loading…
Reference in New Issue
Block a user