sarifLevelForSeverity function
Maps this project's three-level LintImpact/severity scale (error,
warning, info — see saropa_lint_rule.dart) onto SARIF's level enum
(error, warning, note, none). There is no finer-grained scale in the
codebase to draw from, so this is a direct 1:1 mapping, not an invented
scale. Unrecognized values fall back to warning rather than none,
because none means "not evaluated as a problem" in the SARIF spec —
a worse default for an unknown diagnostic than surfacing it visibly.
Implementation
String sarifLevelForSeverity(String? severity) {
switch ((severity ?? '').toLowerCase()) {
case 'error':
return 'error';
case 'warning':
return 'warning';
case 'info':
return 'note';
default:
return 'warning';
}
}