Skip to content

Commit

Permalink
remove note in the docs about diagnostic severity overrides not being…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
DetachHead committed Oct 16, 2024
1 parent 0cea1bd commit 9126451
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"`.

Expand Down
6 changes: 4 additions & 2 deletions packages/pyright-internal/src/common/configOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 9126451

Please sign in to comment.