закрыты известные остатки
- документ самоуправления объявляется ключом governance, а не угадывается по «он один и без ключей оси»: конвенция, потерявшая topic, была от него неотличима и тихо теряла все проверки об отъезде к потребителю - проверка путей канона больше не ловит README.md и READING.md — эти два имени значат что-то и на стороне потребителя - lang.Recognize требует совпадения и слов, и номера версии; директории компонентов сверяются на вложенность, а не только на равенство - у обеих проверок появился --json, а convy sync называет ссылки на темы, которых компонент не взял
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"git.vakhrushev.me/av/convy/internal/doc"
|
||||
"git.vakhrushev.me/av/convy/internal/lang"
|
||||
"git.vakhrushev.me/av/convy/internal/suite"
|
||||
)
|
||||
|
||||
// Checking a copy is not checking a suite with parts left out. A copy has no
|
||||
@@ -174,3 +175,42 @@ func Copies(docs []*doc.Document) *Report {
|
||||
}
|
||||
return rep
|
||||
}
|
||||
|
||||
// Dangling lists the references a copy makes to rules of topics the component
|
||||
// did not take. Such a reference resolves nowhere for its reader: the rule it
|
||||
// names exists, but not in this repository.
|
||||
//
|
||||
// It is not an error. META-20 allows a convention to name a rule of another
|
||||
// topic outside the norm, and a rationale that lost its addressee degrades
|
||||
// honestly — the reader loses a pointer rather than the requirement. So this is
|
||||
// something to look at, and it lives here rather than in Copy because it needs
|
||||
// the suite, which a check of copies deliberately does not reach.
|
||||
func Dangling(d *doc.Document, s *suite.Suite, subscribed func(topic string) bool) []Ref {
|
||||
own := make(map[string]bool)
|
||||
for _, r := range d.Rules {
|
||||
own[r.Prefix] = true
|
||||
}
|
||||
|
||||
var out []Ref
|
||||
seen := make(map[string]bool)
|
||||
for _, ref := range refsIn(d, d.Body, d.Len()) {
|
||||
if own[ref.Prefix] || strings.HasPrefix(ref.Prefix, "X") || seen[ref.Prefix] {
|
||||
continue
|
||||
}
|
||||
target, ok := s.ByPrefix[ref.Prefix]
|
||||
if !ok || target.Front.Topic == "" || subscribed(target.Front.Topic) {
|
||||
continue
|
||||
}
|
||||
seen[ref.Prefix] = true
|
||||
out = append(out, ref)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// TopicOf names the topic a prefix belongs to.
|
||||
func TopicOf(s *suite.Suite, prefix string) string {
|
||||
if d, ok := s.ByPrefix[prefix]; ok {
|
||||
return d.Front.Topic
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user