-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathutils.js
More file actions
33 lines (26 loc) · 778 Bytes
/
utils.js
File metadata and controls
33 lines (26 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';
const minimatch = require('minimatch');
module.exports = {
isError (severity) {
return severity === 'error';
},
isExcluded (config, checkPath) {
const excludedFiles = config && config.excludedFiles || [];
return excludedFiles.some((pattern) => {
return minimatch(checkPath, pattern, {
matchBase: true,
});
});
},
isWarning (severity) {
return severity === 'warning';
},
pluralize (singular, count) {
return count === 1 ? singular : `${ singular }s`;
},
severityCount (results, isSeverityFn) {
return results.reduce((sum, result) => {
return sum + (isSeverityFn(result.severity) ? 1 : 0);
}, 0);
},
};