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 504004a commit a9ba903
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ async function runEslint () {

core.debug(`Raw report from eslint: ${JSON.stringify(report, null, 2)}`)

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

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

Expand All @@ -144,6 +146,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 a9ba903

Please sign in to comment.