(result: LintFileResult, options: LintOptions)
| 306 | } |
| 307 | |
| 308 | function outputLintResult(result: LintFileResult, options: LintOptions): void { |
| 309 | if (options.output === 'json') { |
| 310 | outputJson(result) |
| 311 | return |
| 312 | } |
| 313 | |
| 314 | const c = getChalk() |
| 315 | const configIssues = result.integrationsFile.issues |
| 316 | const hasAnyIssues = result.issues.length > 0 || configIssues.length > 0 |
| 317 | |
| 318 | // Show success message if no issues at all |
| 319 | if (!hasAnyIssues) { |
| 320 | output(c.green('✓ No issues found')) |
| 321 | return |
| 322 | } |
| 323 | |
| 324 | // Show configuration issues from integrations file |
| 325 | if (configIssues.length > 0) { |
| 326 | const relPath = relative(process.cwd(), result.integrationsFile.path) || result.integrationsFile.path |
| 327 | output(c.bold(`Configuration issues in ${c.dim(relPath)}`)) |
| 328 | output('') |
| 329 | for (const issue of configIssues) { |
| 330 | output(` ${c.red('✖')} ${c.red(issue.code)}: ${issue.message}`) |
| 331 | if (issue.path) { |
| 332 | output(` ${c.dim(`at ${issue.path}`)}`) |
| 333 | } |
| 334 | } |
| 335 | output('') |
| 336 | } |
| 337 | |
| 338 | // Show notebook issues grouped by notebook |
| 339 | if (result.issues.length > 0) { |
| 340 | const issuesByNotebook = new Map<string, LintIssue[]>() |
| 341 | for (const issue of result.issues) { |
| 342 | const existing = issuesByNotebook.get(issue.notebookName) ?? [] |
| 343 | existing.push(issue) |
| 344 | issuesByNotebook.set(issue.notebookName, existing) |
| 345 | } |
| 346 | |
| 347 | for (const [notebookName, issues] of issuesByNotebook) { |
| 348 | output(c.bold(notebookName)) |
| 349 | output('') |
| 350 | for (const issue of issues) { |
| 351 | const icon = issue.severity === 'error' ? c.red('✖') : c.yellow('⚠') |
| 352 | const color = issue.severity === 'error' ? c.red : c.yellow |
| 353 | output(` ${icon} ${color(issue.code)}: ${issue.message}`) |
| 354 | output(` ${c.dim(`in ${issue.blockLabel}`)}`) |
| 355 | } |
| 356 | output('') |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | // Summary. `issueCount.errors` includes configuration issues (they are hard errors), but the text |
| 361 | // summary reports them separately as "configuration error(s)", so subtract them from the notebook |
| 362 | // "error(s)" part to avoid double-counting. |
| 363 | const parts: string[] = [] |
| 364 | const notebookErrors = result.issueCount.errors - configIssues.length |
| 365 | if (notebookErrors > 0) { |
no test coverage detected