mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-18 18:04:17 +00:00
Labels use dim style while values use bold semantic colors, making counts visually prominent. Threat category breakdown now colors each category independently (injection=red, exfiltration=orange, etc.) instead of uniform yellow, so users can distinguish threat types at a glance.
28 lines
1.0 KiB
Go
28 lines
1.0 KiB
Go
package audit
|
|
|
|
// staticAnalyzer wraps regex-based rule scanning for both content and markdown links.
|
|
type staticAnalyzer struct{}
|
|
|
|
func (a *staticAnalyzer) ID() string { return AnalyzerStatic }
|
|
func (a *staticAnalyzer) Scope() AnalyzerScope { return ScopeFile }
|
|
|
|
func (a *staticAnalyzer) Analyze(ctx *AnalyzeContext) ([]Finding, error) {
|
|
if ctx.IsMarkdown {
|
|
return ScanMarkdownContentWithRules(ctx.Content, ctx.FileName, ctx.MDContentRules), nil
|
|
}
|
|
return ScanContentWithRules(ctx.Content, ctx.FileName, ctx.Rules), nil
|
|
}
|
|
|
|
// markdownLinkAnalyzer runs markdown link rule checks (skill scope — needs all MD files).
|
|
type markdownLinkAnalyzer struct{}
|
|
|
|
func (a *markdownLinkAnalyzer) ID() string { return AnalyzerStatic }
|
|
func (a *markdownLinkAnalyzer) Scope() AnalyzerScope { return ScopeSkill }
|
|
|
|
func (a *markdownLinkAnalyzer) Analyze(ctx *AnalyzeContext) ([]Finding, error) {
|
|
if len(ctx.MDFiles) == 0 || len(ctx.MDLinkRules) == 0 {
|
|
return nil, nil
|
|
}
|
|
return checkMarkdownLinkRules(ctx.MDFiles, ctx.MDLinks, ctx.MDLinkRules), nil
|
|
}
|