From 15ea57abd898e8a1dbaad7f3ff6bbe6b4fc1d552 Mon Sep 17 00:00:00 2001 From: Lucas Pires Date: Tue, 24 Jul 2018 01:18:43 -0300 Subject: [PATCH] lint-diff: fix error count --- src/lint-diff.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lint-diff.js b/src/lint-diff.js index 8763e0b..57a1212 100644 --- a/src/lint-diff.js +++ b/src/lint-diff.js @@ -74,6 +74,7 @@ const filterLinterMessages = changedFileLineMap => (linterOutput) => { ) const countWarningMessages = countBySeverity(1) + const countErrorMessages = countBySeverity(2) const warningCount = (result) => { const transform = { @@ -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)