* Given an Array of filenames, print wrapping output and process them. * @param files {Array} filenames list * @param options {Object} options object * @return {Number} exit code
(fileArray, options)
| 213 | * @return {Number} exit code |
| 214 | */ |
| 215 | function processFiles(fileArray, options) { |
| 216 | var exitCode = 0, |
| 217 | formatId = options.format || "text", |
| 218 | formatter, |
| 219 | files = filterFiles(fileArray, options), |
| 220 | output; |
| 221 | |
| 222 | if (!files.length) { |
| 223 | api.print("csslint: No files specified."); |
| 224 | exitCode = 1; |
| 225 | } else { |
| 226 | if (!CSSLint.hasFormat(formatId)) { |
| 227 | api.print("csslint: Unknown format '" + formatId + "'. Cannot proceed."); |
| 228 | exitCode = 1; |
| 229 | } else { |
| 230 | formatter = CSSLint.getFormatter(formatId); |
| 231 | |
| 232 | output = formatter.startFormat(); |
| 233 | if (output) { |
| 234 | api.print(output); |
| 235 | } |
| 236 | |
| 237 | |
| 238 | files.forEach(function(file) { |
| 239 | if (exitCode === 0) { |
| 240 | exitCode = processFile(file, options); |
| 241 | } else { |
| 242 | processFile(file, options); |
| 243 | } |
| 244 | }); |
| 245 | |
| 246 | output = formatter.endFormat(); |
| 247 | if (output) { |
| 248 | api.print(output); |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | return exitCode; |
| 253 | } |
| 254 | |
| 255 | |
| 256 | function processArguments(args, extend) { |
no test coverage detected
searching dependent graphs…