1.8 KiB
1.8 KiB
Custom Risk Loading Guide
When .brooks-lint.yaml contains a custom_risks map, this guide governs how those
risks are loaded and scanned. Custom risks use Cx codes (C1, C2, …) — no conflict with
the standard R1–R6 and T1–T6 namespaces.
Loading
-
For each entry in
custom_risks, validate that it has:name— non-empty stringquestion— the diagnostic question to asksymptoms— non-empty list of symptom patternsseverity— map with at least one of:critical,warning,suggestion
-
Register each valid entry as a
Cxcode alongside R1–R6 / T1–T6. Once loaded,Cxcodes become valid targets fordisable,focus, andseverityfields in the same config file. -
Report any validation errors as config warnings (do not abort the review):
- Missing required field:
"Config warning: C1 missing 'symptoms'" - Invalid code format (must be
Cfollowed by digits): skip, note error - Code conflicts with R/T namespace: skip, note error
- Missing required field:
Scanning
During the analysis, treat each custom risk as an additional step after the standard process:
- Use
questionas the diagnostic question - Use
symptomsas the symptom lookup list - Use the
severitymap for tier classification - Apply the Iron Law:
Sourcefield should be"[Project-defined risk] — <risk name>" - Include custom risk findings in the Health Score (same deduction rules as R/T codes)
- In the report, custom findings appear after standard findings under a ### Project-Specific Risks sub-heading
Config Validation additions
The following codes are valid in disable, focus, and severity:
- Standard:
R1–R6,T1–T6 - Custom: any
Cxcode defined incustom_risks - Any other code: skip it and emit
"Config warning: X is not a valid risk code"