Documentation
¶
Overview ¶
Package universe reads the universe register of spec 18.3 and counts the outcomes of each scope.
The universe is the set of all source items of programming knowledge. Each card of cards/ and each node of nodes/ is a universe item with the outcome card or node, so the register does not repeat them. The files registers/universe/<source>.jsonl hold the other rows: the items that are aliases, sections, merged, on another site, out of scope, not an item, or still pending.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Levels = []string{"C0", "C1", "C2"}
Levels are the coverage levels of spec 18.2 that prog coverage measures now. C0 is an item with a node or a card. C1 is a card that passes the R rules. C2 is a node at W2. The G ladder is not built yet, so C2 does not check G1, and the levels C3 to C6 are not measured yet.
var Outcomes = []string{"node", "card", "alias", "section", "merged", "disambiguation", "elsewhere:algorithm", "elsewhere:math2", "out-of-scope", "not-an-item", "pending"}
Outcomes are the outcomes of spec 18.3. The outcomes node and card come from nodes and cards, but a row may also use them to record a source name that maps to a node or card with another id.
var Reasons = []string{"not-programming", "product-marketing", "personal", "too-small"}
Reasons are the reason codes of the outcome out-of-scope.
var Scopes = []string{"languages", "releases", "concepts", "features", "api", "diagnostics", "proposals", "tasks", "patterns", "weaknesses", "tools", "libraries", "formats", "licences", "people", "terms"}
Scopes are the scopes of spec 18.4.
Functions ¶
func CardGate ¶ added in v0.0.24
CardGate tells if every card of each scope is at C1 or above, the exit criterion of M1 (spec 21). It returns the scopes that fail.
func Gate ¶
Gate tells if the counts meet the exit criteria of M1 (spec 21): less than max of all items pending, and no pending item in the strict scopes. It returns the reasons when they are not met.
func ScopeOfKind ¶
ScopeOfKind returns the scope of the nodes and cards of a kind, or "" for a kind that is not a universe item, such as area.
Types ¶
type Count ¶
type Count struct {
Scope string `json:"scope"`
Total int `json:"total"`
Pending int `json:"pending"`
ByOutcome map[string]int `json:"by_outcome"`
}
Count holds the outcomes of one scope.
type Level ¶ added in v0.0.24
type Level struct {
Scope string `json:"scope"`
// Cards and Nodes are the counts of cards and nodes of the scope.
Cards int `json:"cards"`
Nodes int `json:"nodes"`
// CardsBelow is the number of cards that do not pass the R rules, so they are at C0.
CardsBelow int `json:"cards_below_c1"`
// ByLevel counts the items at each level. An item counts at its highest level only.
ByLevel map[string]int `json:"by_level"`
// Failing lists the first cards of the scope that do not pass the R rules, as file:line.
Failing []string `json:"failing,omitempty"`
}
Level holds the coverage levels of the nodes and cards of one scope.
type Problem ¶
Problem is one problem of a row, with the check rule that finds it.
type Row ¶
type Row struct {
// Source is the id of the source, such as pldb or cwe. An empty source takes the name of the file.
Source string `json:"source,omitempty"`
// ID is the id of the item in the source, and Name is the name that the source gives it.
ID string `json:"id"`
Name string `json:"name,omitempty"`
// Scope is one of Scopes.
Scope string `json:"scope"`
// Outcome is one of Outcomes.
Outcome string `json:"outcome"`
// Target is the slug of the node or card that the row points to, or the tag on the other site for elsewhere outcomes.
Target string `json:"target,omitempty"`
// Reason says why the row has its outcome. Out of scope needs a reason code.
Reason string `json:"reason,omitempty"`
// Rule is the id of the rule of registers/scope-rules.yaml for the reason too-small.
Rule string `json:"rule,omitempty"`
File string `json:"-"`
Line int `json:"-"`
}
Row is one row of registers/universe/<source>.jsonl.