mirror of
https://github.com/microsoft/pyright.git
synced 2024-08-16 11:20:22 +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="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="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"`.
|
<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" |
|
| reportTypedDictNotRequiredAccess | "none" | "error" | "error" | "error" |
|
||||||
| reportPrivateImportUsage | "none" | "error" | "error" | "error" |
|
| reportPrivateImportUsage | "none" | "error" | "error" | "error" |
|
||||||
| reportUnboundVariable | "none" | "error" | "error" | "error" |
|
| reportUnboundVariable | "none" | "error" | "error" | "error" |
|
||||||
|
| reportUnhashable | "none" | "error" | "error" | "error" |
|
||||||
| reportUnusedCoroutine | "none" | "error" | "error" | "error" |
|
| reportUnusedCoroutine | "none" | "error" | "error" | "error" |
|
||||||
| reportUnusedExcept | "none" | "error" | "error" | "error" |
|
| reportUnusedExcept | "none" | "error" | "error" | "error" |
|
||||||
| reportFunctionMemberAccess | "none" | "none" | "error" | "error" |
|
| reportFunctionMemberAccess | "none" | "none" | "error" | "error" |
|
||||||
|
@ -13789,7 +13789,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
|
|||||||
|
|
||||||
const message = isDictKey ? LocMessage.unhashableDictKey() : LocMessage.unhashableSetEntry();
|
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.
|
// Report usage of unbound variables.
|
||||||
reportUnboundVariable: DiagnosticLevel;
|
reportUnboundVariable: DiagnosticLevel;
|
||||||
|
|
||||||
|
// Report use of unhashable type in a dictionary.
|
||||||
|
reportUnhashable: DiagnosticLevel;
|
||||||
|
|
||||||
// Report statements that are syntactically correct but
|
// Report statements that are syntactically correct but
|
||||||
// have no semantic meaning within a type stub file.
|
// have no semantic meaning within a type stub file.
|
||||||
reportInvalidStubStatement: DiagnosticLevel;
|
reportInvalidStubStatement: DiagnosticLevel;
|
||||||
@ -474,6 +477,7 @@ export function getDiagLevelDiagnosticRules() {
|
|||||||
DiagnosticRule.reportSelfClsParameterName,
|
DiagnosticRule.reportSelfClsParameterName,
|
||||||
DiagnosticRule.reportImplicitStringConcatenation,
|
DiagnosticRule.reportImplicitStringConcatenation,
|
||||||
DiagnosticRule.reportUndefinedVariable,
|
DiagnosticRule.reportUndefinedVariable,
|
||||||
|
DiagnosticRule.reportUnhashable,
|
||||||
DiagnosticRule.reportUnboundVariable,
|
DiagnosticRule.reportUnboundVariable,
|
||||||
DiagnosticRule.reportInvalidStubStatement,
|
DiagnosticRule.reportInvalidStubStatement,
|
||||||
DiagnosticRule.reportIncompleteStub,
|
DiagnosticRule.reportIncompleteStub,
|
||||||
@ -579,6 +583,7 @@ export function getOffDiagnosticRuleSet(): DiagnosticRuleSet {
|
|||||||
reportSelfClsParameterName: 'none',
|
reportSelfClsParameterName: 'none',
|
||||||
reportImplicitStringConcatenation: 'none',
|
reportImplicitStringConcatenation: 'none',
|
||||||
reportUnboundVariable: 'none',
|
reportUnboundVariable: 'none',
|
||||||
|
reportUnhashable: 'none',
|
||||||
reportUndefinedVariable: 'warning',
|
reportUndefinedVariable: 'warning',
|
||||||
reportInvalidStubStatement: 'none',
|
reportInvalidStubStatement: 'none',
|
||||||
reportIncompleteStub: 'none',
|
reportIncompleteStub: 'none',
|
||||||
@ -680,6 +685,7 @@ export function getBasicDiagnosticRuleSet(): DiagnosticRuleSet {
|
|||||||
reportSelfClsParameterName: 'warning',
|
reportSelfClsParameterName: 'warning',
|
||||||
reportImplicitStringConcatenation: 'none',
|
reportImplicitStringConcatenation: 'none',
|
||||||
reportUnboundVariable: 'error',
|
reportUnboundVariable: 'error',
|
||||||
|
reportUnhashable: 'error',
|
||||||
reportUndefinedVariable: 'error',
|
reportUndefinedVariable: 'error',
|
||||||
reportInvalidStubStatement: 'none',
|
reportInvalidStubStatement: 'none',
|
||||||
reportIncompleteStub: 'none',
|
reportIncompleteStub: 'none',
|
||||||
@ -781,6 +787,7 @@ export function getStandardDiagnosticRuleSet(): DiagnosticRuleSet {
|
|||||||
reportSelfClsParameterName: 'warning',
|
reportSelfClsParameterName: 'warning',
|
||||||
reportImplicitStringConcatenation: 'none',
|
reportImplicitStringConcatenation: 'none',
|
||||||
reportUnboundVariable: 'error',
|
reportUnboundVariable: 'error',
|
||||||
|
reportUnhashable: 'error',
|
||||||
reportUndefinedVariable: 'error',
|
reportUndefinedVariable: 'error',
|
||||||
reportInvalidStubStatement: 'none',
|
reportInvalidStubStatement: 'none',
|
||||||
reportIncompleteStub: 'none',
|
reportIncompleteStub: 'none',
|
||||||
@ -882,6 +889,7 @@ export function getStrictDiagnosticRuleSet(): DiagnosticRuleSet {
|
|||||||
reportSelfClsParameterName: 'error',
|
reportSelfClsParameterName: 'error',
|
||||||
reportImplicitStringConcatenation: 'none',
|
reportImplicitStringConcatenation: 'none',
|
||||||
reportUnboundVariable: 'error',
|
reportUnboundVariable: 'error',
|
||||||
|
reportUnhashable: 'error',
|
||||||
reportUndefinedVariable: 'error',
|
reportUndefinedVariable: 'error',
|
||||||
reportInvalidStubStatement: 'error',
|
reportInvalidStubStatement: 'error',
|
||||||
reportIncompleteStub: 'error',
|
reportIncompleteStub: 'error',
|
||||||
|
@ -90,6 +90,7 @@ export enum DiagnosticRule {
|
|||||||
reportImplicitStringConcatenation = 'reportImplicitStringConcatenation',
|
reportImplicitStringConcatenation = 'reportImplicitStringConcatenation',
|
||||||
reportUndefinedVariable = 'reportUndefinedVariable',
|
reportUndefinedVariable = 'reportUndefinedVariable',
|
||||||
reportUnboundVariable = 'reportUnboundVariable',
|
reportUnboundVariable = 'reportUnboundVariable',
|
||||||
|
reportUnhashable = 'reportUnhashable',
|
||||||
reportInvalidStubStatement = 'reportInvalidStubStatement',
|
reportInvalidStubStatement = 'reportInvalidStubStatement',
|
||||||
reportIncompleteStub = 'reportIncompleteStub',
|
reportIncompleteStub = 'reportIncompleteStub',
|
||||||
reportUnsupportedDunderAll = 'reportUnsupportedDunderAll',
|
reportUnsupportedDunderAll = 'reportUnsupportedDunderAll',
|
||||||
|
@ -1327,6 +1327,22 @@
|
|||||||
false
|
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": {
|
"reportUnsupportedDunderAll": {
|
||||||
"type": [
|
"type": [
|
||||||
"string",
|
"string",
|
||||||
|
@ -575,6 +575,12 @@
|
|||||||
"title": "Controls reporting of attempts to use an unbound variable",
|
"title": "Controls reporting of attempts to use an unbound variable",
|
||||||
"default": "error"
|
"default": "error"
|
||||||
},
|
},
|
||||||
|
"reportUnhashable": {
|
||||||
|
"$id": "#/properties/reportUnhashable",
|
||||||
|
"$ref": "#/definitions/diagnostic",
|
||||||
|
"title": "Controls reporting of unhashable object in container that requires hashability",
|
||||||
|
"default": "error"
|
||||||
|
},
|
||||||
"reportUndefinedVariable": {
|
"reportUndefinedVariable": {
|
||||||
"$id": "#/properties/reportUndefinedVariable",
|
"$id": "#/properties/reportUndefinedVariable",
|
||||||
"$ref": "#/definitions/diagnostic",
|
"$ref": "#/definitions/diagnostic",
|
||||||
|
Loading…
Reference in New Issue
Block a user