feat(11.1-02): check module identifiers in docs and READMEs
- go/parser index of every modules/ package and sub-package, with methods, fields, interface methods and promoted members - code spans in docs pages, module READMEs and the root README fail Check and docs:build when the named identifier does not exist - scripts/check-phase11.1.sh with preconditions, deps, docs, forbidden, go and a self-test that plants one violation per rule
This commit is contained in:
@@ -229,6 +229,21 @@ func writeOutputs(out string, files map[string][]byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// checkContent runs the accuracy checkers over every page and the root
|
||||
// README.md: module identifiers named in code spans.
|
||||
func (s *site) checkContent() ([]Problem, error) {
|
||||
docs, err := s.parseDocs()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
idx, problems, err := buildIdentIndex(s.opts.Root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
problems = append(problems, s.checkIdentifiers(idx, docs)...)
|
||||
return problems, nil
|
||||
}
|
||||
|
||||
func sortProblems(problems []Problem) {
|
||||
slices.SortStableFunc(problems, func(a, b Problem) int {
|
||||
return cmp.Or(strings.Compare(a.File, b.File), cmp.Compare(a.Line, b.Line))
|
||||
|
||||
Reference in New Issue
Block a user