mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-18 18:04:17 +00:00
fix(audit): show actual active analyzers in status --json output
When no explicit analyzer filter was configured, status --json reported an empty analyzers array. Now ResolvePolicy backfills the full list of built-in analyzer IDs so the JSON output reflects what actually runs. Add Registry.IDs() helper with deduplication (markdownLinkAnalyzer and staticAnalyzer share the "static" ID).
This commit is contained in:
@@ -57,6 +57,19 @@ func (r *Registry) BundleAnalyzers() []Analyzer {
|
||||
return r.byScope(ScopeBundle)
|
||||
}
|
||||
|
||||
// IDs returns the unique IDs of all analyzers in the registry.
|
||||
func (r *Registry) IDs() []string {
|
||||
seen := make(map[string]bool, len(r.analyzers))
|
||||
var ids []string
|
||||
for _, a := range r.analyzers {
|
||||
if !seen[a.ID()] {
|
||||
seen[a.ID()] = true
|
||||
ids = append(ids, a.ID())
|
||||
}
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
// Has returns true if an analyzer with the given ID is in the registry.
|
||||
func (r *Registry) Has(id string) bool {
|
||||
for _, a := range r.analyzers {
|
||||
|
||||
@@ -66,6 +66,11 @@ func ResolvePolicy(in PolicyInputs) Policy {
|
||||
if len(analyzers) == 0 {
|
||||
analyzers = in.ConfigAnalyzers
|
||||
}
|
||||
// When no explicit filter is set, report all built-in analyzers
|
||||
// so callers (e.g. status --json) see the actual active set.
|
||||
if len(analyzers) == 0 {
|
||||
analyzers = DefaultRegistry().IDs()
|
||||
}
|
||||
|
||||
return Policy{
|
||||
Profile: profile,
|
||||
|
||||
Reference in New Issue
Block a user