Skip to content

Commit

Permalink
fix issue where an empty baseline file was being automatically create…
Browse files Browse the repository at this point in the history
…d when running basedpyright from the CLI
  • Loading branch information
DetachHead committed Sep 30, 2024
1 parent b4e6171 commit c94fc68
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/pyright-internal/src/pyright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,11 @@ const outputResults = (
!filteredDiagnostics.map((fileWithDiagnostics) => fileWithDiagnostics.diagnostics.length).reduce(add, 0)
) {
const previousBaseline = getBaselinedErrors(service.fs, rootDir);
const newBaseline = writeDiagnosticsToBaselineFile(service.fs, rootDir, results.diagnostics, false);
console.info(getBaselineSummaryMessage(rootDir, previousBaseline, newBaseline));
// don't write the baseline file if there wasn't one there already unless the user explicitly asked for it
if (args.writebaseline || Object.keys(previousBaseline.files).length) {
const newBaseline = writeDiagnosticsToBaselineFile(service.fs, rootDir, results.diagnostics, false);
console.info(getBaselineSummaryMessage(rootDir, previousBaseline, newBaseline));
}
}

const treatWarningsAsErrors = !!args.warnings;
Expand Down

0 comments on commit c94fc68

Please sign in to comment.