feat: add --limit CLI option for output control

- Add --limit/-l option to limit detailed violation output
- Implement limit logic in displayGroupedViolations function
- Show warning when violations exceed limit
- Works with severity filters (--only-critical, --min-severity)
- Extract severity labels and headers to constants
- Improve CLI maintainability with SEVERITY_DISPLAY_LABELS and SEVERITY_SECTION_HEADERS
This commit is contained in:
imfozilbek
2025-11-24 21:27:27 +05:00
parent 88876a258b
commit 7e4de182ff
2 changed files with 181 additions and 110 deletions

View File

@@ -22,6 +22,7 @@ export const CLI_DESCRIPTIONS = {
NO_ARCHITECTURE_OPTION: "Skip architecture checks",
MIN_SEVERITY_OPTION: "Minimum severity level (critical, high, medium, low)",
ONLY_CRITICAL_OPTION: "Show only critical severity issues",
LIMIT_OPTION: "Limit detailed output to specified number of violations per category",
} as const
export const CLI_OPTIONS = {
@@ -31,6 +32,21 @@ export const CLI_OPTIONS = {
NO_ARCHITECTURE: "--no-architecture",
MIN_SEVERITY: "--min-severity <level>",
ONLY_CRITICAL: "--only-critical",
LIMIT: "-l, --limit <number>",
} as const
export const SEVERITY_DISPLAY_LABELS = {
CRITICAL: "🔴 CRITICAL",
HIGH: "🟠 HIGH",
MEDIUM: "🟡 MEDIUM",
LOW: "🟢 LOW",
} as const
export const SEVERITY_SECTION_HEADERS = {
CRITICAL: "\n═══════════════════════════════════════════\n🔴 CRITICAL SEVERITY\n═══════════════════════════════════════════",
HIGH: "\n═══════════════════════════════════════════\n🟠 HIGH SEVERITY\n═══════════════════════════════════════════",
MEDIUM: "\n═══════════════════════════════════════════\n🟡 MEDIUM SEVERITY\n═══════════════════════════════════════════",
LOW: "\n═══════════════════════════════════════════\n🟢 LOW SEVERITY\n═══════════════════════════════════════════",
} as const
export const CLI_ARGUMENTS = {