Skip to content

Commit

Permalink
fix: Ignore irrelevant warnings/errors in counts
Browse files Browse the repository at this point in the history
eslint lints by files, but we only care about _specific lines_ in each
file. If you made a "clean" change in a "dirty" file, we would report
the total number of eslint errors and warnings found — even if we didn't
generate any annotations because your diff was good.

This change has us adding up errors and warning from the changes we deem
relevant to the PR instead of using the original numbers from eslint.
  • Loading branch information
sheck committed May 22, 2023
1 parent 611cd6d commit c55ea45
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ async function runEslint () {
? await gatherReportForEslintSevenOrGreater(paths)
: gatherReportForEslintSixOrLower(paths)

const { results, errorCount, warningCount } = report
const { results } = report
let errorCount = 0
let warningCount = 0

const levels = ['', 'warning', 'failure']

Expand All @@ -142,6 +144,8 @@ async function runEslint () {

if (!changeRanges.some(r => r.doesInclude(line))) continue

errorCount += msg.errorCount
warningCount += msg.warningCount
const annotationLevel = levels[severity]
annotations.push({
path,
Expand Down

0 comments on commit c55ea45

Please sign in to comment.