Skip to content

Commit

Permalink
lint-diff: fix error count
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingluscas committed Jul 24, 2018
1 parent b0f5939 commit 15ea57a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lint-diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const filterLinterMessages = changedFileLineMap => (linterOutput) => {
)

const countWarningMessages = countBySeverity(1)
const countErrorMessages = countBySeverity(2)

const warningCount = (result) => {
const transform = {
Expand All @@ -83,11 +84,20 @@ const filterLinterMessages = changedFileLineMap => (linterOutput) => {
return merge(result, transform)
}

const errorCount = (result) => {
const transform = {
errorCount: countErrorMessages(result.messages),
}

return merge(result, transform)
}

return pipe(
prop('results'),
map(pipe(
filterMessagesByFile,
warningCount
warningCount,
errorCount
)),
objOf('results')
)(linterOutput)
Expand Down

0 comments on commit 15ea57a

Please sign in to comment.