Skip to content

Commit c5e3065

Browse files
committed
Renaming variable and inlining result
1 parent a16d26b commit c5e3065

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/utils.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const repolinter = require('repolinter') /*project which this is build upon */
1010

1111
const chalk = require('chalk')
1212

13-
const formatedDate = new Date().toISOString().substring(0, 13) /*transforms Date() into shorter string*/
13+
const formattedDate = new Date().toISOString().substring(0, 13) /*transforms Date() into shorter string*/
1414

1515
/* Separate negative and positive results and prints nicely in terminal */
1616
const printResults = function (data, results, log = console.log) {
@@ -41,21 +41,17 @@ const printResults = function (data, results, log = console.log) {
4141

4242
/* Filter positive results and make it available to filter data */
4343
const positiveResults = function (results) {
44-
const posResults = results /* filter messages for what didn't passed */
44+
return results /* filter messages for what didn't passed */
4545
.filter(r => r.lintResult && r.lintResult.passed)
4646
.map(r => repolinter.runRuleset && r.ruleInfo.name)
47-
48-
return posResults
4947
}
5048

5149
/* Filter negative results and make it available to filter data */
5250
const negativeResults = function (results) {
53-
const negResults = results
51+
return results
5452
.filter(r => r.lintResult && !r.lintResult.passed)
5553
.map(r => repolinter.runRuleset && r.ruleInfo.name)
5654

57-
return negResults
58-
5955
/* In case someone needs an output with ratio */
6056
/*
6157
return {
@@ -98,7 +94,7 @@ const createJsonFile = async function (repository, input, results) {
9894
}
9995

10096
await fs.promises.writeFile(
101-
path.resolve(directory, `${formatedDate}-${repository}.json`),
97+
path.resolve(directory, `${formattedDate}-${repository}.json`),
10298
JSON.stringify(JSON.parse(print), null, 2)
10399
)
104100
}
@@ -111,7 +107,7 @@ const createJsonDashboardFile = async function (output) {
111107
}
112108

113109
module.exports = {
114-
formatedDate,
110+
formattedDate,
115111
printResults,
116112
positiveResults,
117113
negativeResults,

0 commit comments

Comments
 (0)