mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-28 07:16:53 +05:00
feat: add severity-based sorting and filtering for violations (v0.5.2)
- Add CRITICAL/HIGH/MEDIUM/LOW severity levels to all violations - Sort violations by severity automatically (most critical first) - Add CLI flags: --min-severity and --only-critical - Group violations by severity in CLI output with color-coded headers - Update all violation interfaces to include severity field - Maintain 90%+ test coverage with all tests passing - Update CHANGELOG.md, ROADMAP.md, and package version to 0.5.2
This commit is contained in:
@@ -64,9 +64,36 @@ export const PLACEHOLDERS = {
|
||||
* Violation severity levels
|
||||
*/
|
||||
export const SEVERITY_LEVELS = {
|
||||
ERROR: "error",
|
||||
WARNING: "warning",
|
||||
INFO: "info",
|
||||
CRITICAL: "critical",
|
||||
HIGH: "high",
|
||||
MEDIUM: "medium",
|
||||
LOW: "low",
|
||||
} as const
|
||||
|
||||
export type SeverityLevel = (typeof SEVERITY_LEVELS)[keyof typeof SEVERITY_LEVELS]
|
||||
|
||||
/**
|
||||
* Severity order for sorting (lower number = more critical)
|
||||
*/
|
||||
export const SEVERITY_ORDER: Record<SeverityLevel, number> = {
|
||||
[SEVERITY_LEVELS.CRITICAL]: 0,
|
||||
[SEVERITY_LEVELS.HIGH]: 1,
|
||||
[SEVERITY_LEVELS.MEDIUM]: 2,
|
||||
[SEVERITY_LEVELS.LOW]: 3,
|
||||
} as const
|
||||
|
||||
/**
|
||||
* Violation type to severity mapping
|
||||
*/
|
||||
export const VIOLATION_SEVERITY_MAP = {
|
||||
CIRCULAR_DEPENDENCY: SEVERITY_LEVELS.CRITICAL,
|
||||
REPOSITORY_PATTERN: SEVERITY_LEVELS.CRITICAL,
|
||||
DEPENDENCY_DIRECTION: SEVERITY_LEVELS.HIGH,
|
||||
FRAMEWORK_LEAK: SEVERITY_LEVELS.HIGH,
|
||||
ENTITY_EXPOSURE: SEVERITY_LEVELS.HIGH,
|
||||
NAMING_CONVENTION: SEVERITY_LEVELS.MEDIUM,
|
||||
ARCHITECTURE: SEVERITY_LEVELS.MEDIUM,
|
||||
HARDCODE: SEVERITY_LEVELS.LOW,
|
||||
} as const
|
||||
|
||||
export * from "./rules"
|
||||
|
||||
Reference in New Issue
Block a user