* Filters out files using the exclude-list command line option. * @param files {Array} the list of files to check for exclusions * @param options {Object} the CLI options * @return {Array} A list of files
(files, options)
| 91 | * @return {Array} A list of files |
| 92 | */ |
| 93 | function filterFiles(files, options) { |
| 94 | var excludeList = options["exclude-list"], |
| 95 | excludeFiles = [], |
| 96 | filesToLint = files.map(api.getFullPath), |
| 97 | fullPath; |
| 98 | |
| 99 | |
| 100 | if (excludeList) { |
| 101 | // Build up the exclude list, expanding any directory exclusions that were passed in |
| 102 | excludeList.split(",").forEach(function(value) { |
| 103 | if (api.isDirectory(value)) { |
| 104 | excludeFiles = excludeFiles.concat(api.getFiles(value)); |
| 105 | } else { |
| 106 | excludeFiles.push(value); |
| 107 | } |
| 108 | }); |
| 109 | |
| 110 | // Remove the excluded files from the list of files to lint |
| 111 | excludeFiles.forEach(function(value) { |
| 112 | fullPath = api.getFullPath(value); |
| 113 | if (filesToLint.indexOf(fullPath) > -1) { |
| 114 | filesToLint.splice(filesToLint.indexOf(fullPath), 1); |
| 115 | } |
| 116 | }); |
| 117 | } |
| 118 | |
| 119 | return filesToLint; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * Outputs all available rules to the CLI. |
no outgoing calls
no test coverage detected
searching dependent graphs…