Skip to content

Commit

Permalink
fix issue where an empty baseline file was being automatically created
Browse files Browse the repository at this point in the history
  • Loading branch information
DetachHead committed Sep 30, 2024
1 parent 0bc2989 commit a7b51db
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 a7b51db

Please sign in to comment.