Files
wehub-resource-sync a06f331eb8
install-script / powershell-syntax (push) Waiting to run
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
install-script / install (macos-14) (push) Waiting to run
install-script / install (ubuntu-latest) (push) Waiting to run
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:33:42 +08:00

37 lines
1.0 KiB
Go

package indexer
import (
"github.com/zzet/gortex/internal/graph"
"github.com/zzet/gortex/internal/parser"
)
// stampParseErrors checks the parse tree on result for ERROR/MISSING
// nodes and stamps the count plus a boolean flag onto the file node.
//
// Surfacing this on KindFile lets index_health rank files by parse
// failure and lets agents skip badly-broken sources without re-doing
// the parse. Files whose extractor doesn't keep result.Tree (rare;
// mostly "skip-grammar" stubs that emit a file node and call it
// done) get no stamp — absence of the meta key means "unknown", not
// "clean".
func stampParseErrors(result *parser.ExtractionResult) {
if result == nil || result.Tree == nil {
return
}
if !result.Tree.HasParseErrors() {
return
}
count := result.Tree.CountParseErrors()
for _, n := range result.Nodes {
if n.Kind != graph.KindFile {
continue
}
if n.Meta == nil {
n.Meta = map[string]any{}
}
n.Meta["parse_errors"] = count
n.Meta["has_parse_errors"] = true
break
}
}