diff --git a/packages/pyright-internal/src/analyzer/analysis.ts b/packages/pyright-internal/src/analyzer/analysis.ts index a4d3a0996..ce99e64b2 100644 --- a/packages/pyright-internal/src/analyzer/analysis.ts +++ b/packages/pyright-internal/src/analyzer/analysis.ts @@ -26,7 +26,6 @@ export interface AnalysisResults { checkingOnlyOpenFiles: boolean; requiringAnalysisCount: RequiringAnalysisCount; fatalErrorOccurred: boolean; - configParseErrorOccurred: boolean; elapsedTime: number; error?: Error | undefined; reason: 'analysis' | 'tracking'; @@ -75,7 +74,6 @@ export function analyzeProgram( requiringAnalysisCount: requiringAnalysisCount, checkingOnlyOpenFiles: program.isCheckingOnlyOpenFiles(), fatalErrorOccurred: false, - configParseErrorOccurred: false, elapsedTime, reason: 'analysis', }); @@ -94,7 +92,6 @@ export function analyzeProgram( requiringAnalysisCount: { files: 0, cells: 0 }, checkingOnlyOpenFiles: true, fatalErrorOccurred: true, - configParseErrorOccurred: false, elapsedTime: 0, error: debug.getSerializableError(e), reason: 'analysis', diff --git a/packages/pyright-internal/src/analyzer/backgroundAnalysisProgram.ts b/packages/pyright-internal/src/analyzer/backgroundAnalysisProgram.ts index 0a9b261ea..066081456 100644 --- a/packages/pyright-internal/src/analyzer/backgroundAnalysisProgram.ts +++ b/packages/pyright-internal/src/analyzer/backgroundAnalysisProgram.ts @@ -273,7 +273,6 @@ export class BackgroundAnalysisProgram { requiringAnalysisCount: this._program.getFilesToAnalyzeCount(), checkingOnlyOpenFiles: this._program.isCheckingOnlyOpenFiles(), fatalErrorOccurred: false, - configParseErrorOccurred: false, elapsedTime: 0, reason: 'tracking', }); diff --git a/packages/pyright-internal/src/analyzer/service.ts b/packages/pyright-internal/src/analyzer/service.ts index 6edbf740a..6a1a6a47e 100644 --- a/packages/pyright-internal/src/analyzer/service.ts +++ b/packages/pyright-internal/src/analyzer/service.ts @@ -1178,7 +1178,6 @@ export class AnalyzerService { fileContents = this.fs.readFileSync(fileUri, 'utf8'); } catch { this._console.error(`Config file "${fileUri.toUserVisibleString()}" could not be read.`); - this._reportConfigParseError(); return undefined; } @@ -1201,7 +1200,6 @@ export class AnalyzerService { this._console.error( `Config file "${fileUri.toUserVisibleString()}" could not be parsed. Verify that format is correct.` ); - this._reportConfigParseError(); return undefined; } } @@ -1920,19 +1918,4 @@ export class AnalyzerService { this.runAnalysis(this._backgroundAnalysisCancellationSource.token); }, timeUntilNextAnalysisInMs); } - - private _reportConfigParseError() { - if (this._onCompletionCallback) { - this._onCompletionCallback({ - diagnostics: [], - filesInProgram: 0, - requiringAnalysisCount: { files: 0, cells: 0 }, - checkingOnlyOpenFiles: true, - fatalErrorOccurred: false, - configParseErrorOccurred: true, - elapsedTime: 0, - reason: 'analysis', - }); - } - } } diff --git a/packages/pyright-internal/src/backgroundAnalysisBase.ts b/packages/pyright-internal/src/backgroundAnalysisBase.ts index abba67732..d56211900 100644 --- a/packages/pyright-internal/src/backgroundAnalysisBase.ts +++ b/packages/pyright-internal/src/backgroundAnalysisBase.ts @@ -560,7 +560,6 @@ export abstract class BackgroundAnalysisRunnerBase extends BackgroundThreadBase requiringAnalysisCount: requiringAnalysisCount, checkingOnlyOpenFiles: this.program.isCheckingOnlyOpenFiles(), fatalErrorOccurred: false, - configParseErrorOccurred: false, elapsedTime: 0, reason: 'analysis', }); @@ -763,7 +762,6 @@ export abstract class BackgroundAnalysisRunnerBase extends BackgroundThreadBase requiringAnalysisCount: requiringAnalysisCount, checkingOnlyOpenFiles: this.program.isCheckingOnlyOpenFiles(), fatalErrorOccurred: false, - configParseErrorOccurred: false, elapsedTime, reason: 'tracking', }); diff --git a/packages/pyright-internal/src/pyright.ts b/packages/pyright-internal/src/pyright.ts index 6a43e89d0..229c68ad0 100644 --- a/packages/pyright-internal/src/pyright.ts +++ b/packages/pyright-internal/src/pyright.ts @@ -543,23 +543,11 @@ const outputResults = ( * checks for errors parsing config files and / or the baseline file and exits with a non-zero exit code * if there were any */ -const checkForErrors = ( - exitStatus: Deferred, - configParseErrorOccurred: boolean, - console: ConsoleInterface -): boolean => { +const checkForErrors = (exitStatus: Deferred, console: ConsoleInterface) => { if (console instanceof StandardConsole && console.errorWasLogged) { console.errorWasLogged = false; exitStatus.resolve(ExitStatus.ConfigFileParseError); - return true; - } - // in basedpyright configParseErrorOccurred is redundant since we track the errors in the StandardConsole - // but we keep it just in case an upstream change relies on it without also calling console.error - if (configParseErrorOccurred) { - exitStatus.resolve(ExitStatus.ConfigFileParseError); - return true; } - return false; }; async function runSingleThreaded( @@ -579,9 +567,7 @@ async function runSingleThreaded( return; } - if (checkForErrors(exitStatus, results.configParseErrorOccurred, output)) { - return; - } + checkForErrors(exitStatus, output); const errorCount = args.createstub || args.verifytypes @@ -774,9 +760,7 @@ async function runMultiThreaded( return; } - if (checkForErrors(exitStatus, results.configParseErrorOccurred, console)) { - return; - } + checkForErrors(exitStatus, console); for (const fileDiag of results.diagnostics) { fileDiagnostics.push(FileDiagnostics.fromJsonObj(fileDiag)); diff --git a/packages/pyright-internal/src/tests/config.test.ts b/packages/pyright-internal/src/tests/config.test.ts index d193304f7..c5f30719d 100644 --- a/packages/pyright-internal/src/tests/config.test.ts +++ b/packages/pyright-internal/src/tests/config.test.ts @@ -398,8 +398,7 @@ test('both pyright and basedpyright in pyproject.toml', () => { 'src/tests/samples/project_with_both_config_sections_in_pyproject_toml' ); assert.strictEqual(configOptions.defaultPythonVersion!, undefined); - assert(analysisResult?.configParseErrorOccurred); - assert(!analysisResult.fatalErrorOccurred); + assert(!analysisResult?.fatalErrorOccurred); }); test('invalid option value in pyproject.toml', () => {