* Lange Striche und Attributionen im ganzen Baum, mit denselben Mustern wie das * Stil-Gate. Warum hier noch einmal gescannt wird, steht im Kopf dieser Datei.
(files)
| 332 | * Stil-Gate. Warum hier noch einmal gescannt wird, steht im Kopf dieser Datei. |
| 333 | */ |
| 334 | async function scanStyle(files) { |
| 335 | const dashHits = []; |
| 336 | const dashExceptions = []; |
| 337 | const attributionHits = []; |
| 338 | const attributionExceptions = []; |
| 339 | const patternHits = []; |
| 340 | let textFiles = 0; |
| 341 | let binaryFiles = 0; |
| 342 | |
| 343 | const quoteExempt = (path) => path.startsWith('verification/') && path.endsWith('.json'); |
| 344 | |
| 345 | for (const path of files) { |
| 346 | if (REPORTS_NOT_SCANNED.includes(path)) { |
| 347 | continue; |
| 348 | } |
| 349 | const text = await textOf(path); |
| 350 | if (text === null) { |
| 351 | binaryFiles += 1; |
| 352 | continue; |
| 353 | } |
| 354 | textFiles += 1; |
| 355 | const lines = text.split('\n'); |
| 356 | for (let index = 0; index < lines.length; index += 1) { |
| 357 | const line = lines[index]; |
| 358 | const where = { file: path, line: index + 1, text: line.trim().slice(0, 160) }; |
| 359 | |
| 360 | if (LONG_DASH.test(line)) { |
| 361 | if (quoteExempt(path)) { |
| 362 | dashExceptions.push(where); |
| 363 | } else { |
| 364 | dashHits.push(where); |
| 365 | } |
| 366 | } |
| 367 | for (const { name, pattern } of ATTRIBUTION_PATTERNS) { |
| 368 | if (pattern.test(line)) { |
| 369 | patternHits.push({ ...where, pattern: name }); |
| 370 | } |
| 371 | } |
| 372 | if (NAME_PATTERN.test(line)) { |
| 373 | const claimsAuthorship = ATTRIBUTION_PATTERNS.some((entry) => entry.pattern.test(line)); |
| 374 | const namesTheRule = RULE_SENTENCE.test(line) || RULE_FILE_PATTERN.test(line); |
| 375 | if (!claimsAuthorship && namesTheRule) { |
| 376 | attributionExceptions.push(where); |
| 377 | } else { |
| 378 | attributionHits.push(where); |
| 379 | } |
| 380 | } |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | return { |
| 385 | dashHits, |
| 386 | dashExceptions, |
| 387 | attributionHits, |
| 388 | attributionExceptions, |
| 389 | patternHits, |
| 390 | textFiles, |
| 391 | binaryFiles, |
no test coverage detected