From 912645145f0672a3fa90a1e871809ee99ac3e20d Mon Sep 17 00:00:00 2001 From: detachhead Date: Sun, 13 Oct 2024 13:22:05 +1000 Subject: [PATCH] remove note in the docs about diagnostic severity overrides not being able to reduce severity level. as far as i can tell this isn't true even in upstream pyright, and i see no reason to impose such a restriction --- docs/configuration.md | 2 +- packages/pyright-internal/src/common/configOptions.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 4cc386aed..896c33d41 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -383,7 +383,7 @@ executionEnvironments = [ ## Diagnostic Settings Defaults -Each diagnostic setting has a default that is dictated by the specified type checking mode. The default for each rule can be overridden in the configuration file or settings. In strict type checking mode, overrides may only increase the strictness (e.g. increase the severity level from `"warning"` to `"error"`). +Each diagnostic setting has a default that is dictated by the specified type checking mode. The default for each rule can be overridden in the configuration file or settings. Some rules have an additional severity level such as `"unused"`, `"deprecated"` or `"unreachable"`. These are only used by the language server so that your editor can grey out or add a strikethrough to the symbol, which you can disable by setting it to `"off"`. it does not effect the outcome when running basedpyright via the CLI, so in that context these severity levels essentially mean the same thing as `"off"`. diff --git a/packages/pyright-internal/src/common/configOptions.ts b/packages/pyright-internal/src/common/configOptions.ts index ba0b1f8a3..f34b9aa9d 100644 --- a/packages/pyright-internal/src/common/configOptions.ts +++ b/packages/pyright-internal/src/common/configOptions.ts @@ -453,8 +453,7 @@ export function getBooleanDiagnosticRules(includeNonOverridable = false) { if (includeNonOverridable) { // Do not include these because we don't - // want to override it in strict mode or support - // it within pyright comments. + // want to support it within pyright comments. boolRules.push(DiagnosticRule.enableTypeIgnoreComments); boolRules.push(DiagnosticRule.enableReachabilityAnalysis); boolRules.push(DiagnosticRule.failOnWarnings); @@ -592,6 +591,9 @@ export const extraOptionDiagnosticRules = [ deprecatedDiagnosticRules, ]; +// TODO: should this be removed? there was documentation stating that when typeCheckingMode is "strict" +// diagnostics can't be overridden with a less strict level. as far as i can tell this isn't the case +// so i think this function is useless export function getStrictModeNotOverriddenRules() { // In strict mode, the value in the user config file should be honored and // not overwritten by the value from the strict rule set.