aboutsummaryrefslogtreecommitdiff
path: root/cmd/krino/render.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-17 12:11:42 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-17 12:11:42 +0200
commitbddbd74e4a73e8e32bcf648efd1cac5655f6d0cd (patch)
tree187e6a1fb722d9ab97d2076f69f997f5d371e943 /cmd/krino/render.go
parentcd7425b81f963a948f0abe7df3f9e58e190c2b78 (diff)
downloadkrino-bddbd74e4a73e8e32bcf648efd1cac5655f6d0cd.tar.gz
krino-bddbd74e4a73e8e32bcf648efd1cac5655f6d0cd.zip
comments that explain the code, not how it was written
About 340 comments cited the development process: task and plan numbers, fix waves, rulings, reviewers, and the author in the third person with a date. None of that exists outside the work itself, so to a reader it pointed at nothing. Each one now states the engineering reason it was standing in front of; where a comment was provenance and nothing else, it is gone. References to docs/design.md and docs/gui-design.md by section stay: both ship with the repository. The design documents lose their amendment diaries - CHANGELOG.md is that record - and the GUI's says plainly that the window has gone further than the document. Only comments changed. Every .go file was parsed and its code printed with comments stripped, before and after: the two hashes are identical across all 175 files.
Diffstat (limited to 'cmd/krino/render.go')
-rw-r--r--cmd/krino/render.go52
1 files changed, 26 insertions, 26 deletions
diff --git a/cmd/krino/render.go b/cmd/krino/render.go
index 5b75df3..ca7dad7 100644
--- a/cmd/krino/render.go
+++ b/cmd/krino/render.go
@@ -35,17 +35,17 @@ const minWrap = 10
// never wraps, which keeps a plan piped to a file one field per line.
func printPlan(w io.Writer, dp *engine.DirPlan, verbose bool, p palette, width int) {
r := dp.Result
- // C1 (plan 2): scanned counts matched, unmatched and skipped alike, not
- // just matched plus unmatched - spec §8.2's worked example is "266
- // scanned" against "41 to act on" and "not acted on: 3 busy · 12
- // ignored · 210 unmatched", and 41+3+12+210 = 266.
+ // scanned counts matched, unmatched and skipped alike, not just matched
+ // plus unmatched - spec §8.2's worked example is "266 scanned" against
+ // "41 to act on" and "not acted on: 3 busy · 12 ignored · 210
+ // unmatched", and 41+3+12+210 = 266.
scanned := len(r.Matched) + len(r.Unmatched) + len(r.Skipped)
- // B2: warning lines come from both the match itself (fm.Warnings) and
- // the chains plan.Build produced (Chain.Warnings, e.g. "moved more than
+ // warning lines come from both the match itself (fm.Warnings) and the
+ // chains plan.Build produced (Chain.Warnings, e.g. "moved more than
// once") - both computed once here so the count and the section below
// agree on the exact same list.
lines := collectWarnings(r, dp.Chains)
- // D12: dp.Elapsed spans Match plus Build, unlike r.Elapsed, which stops
+ // dp.Elapsed spans Match plus Build, unlike r.Elapsed, which stops
// before Build ever runs - the label says "planning", so the number
// must cover all of it.
counts := fmt.Sprintf("%d scanned · %d to act on · %d warnings · %.2fs", scanned, countActing(dp.Chains), warnedCount(lines), dp.Elapsed.Seconds())
@@ -131,14 +131,14 @@ func excludedLines(r *engine.Result, chains []plan.Chain) []string {
// chainActing reports whether c has at least one step that will actually
// run - the single definition of "actionable" that countActing,
-// actionableChains (sort.go) and chainOutcomes (sort.go) all share (fix
-// wave item 4 / Minor 5). Before this fix, countActing and actionableChains
-// each kept their own copy of this question and disagreed: countActing
-// excluded an all-skipped chain (len(Steps) > 0, but every step's Skip is
-// set) while actionableChains's own len(Steps) > 0 check included it, so a
-// directory could print "N scanned · 0 to act on" and then still ask the
-// user to approve a file it had just said there were none of - and on
-// approval, log a run-start/run-end pair holding only "skipped" entries.
+// actionableChains (sort.go) and chainOutcomes (sort.go) all share.
+// countActing and actionableChains used to each keep their own copy of
+// this question and disagree: countActing excluded an all-skipped chain
+// (len(Steps) > 0, but every step's Skip is set) while actionableChains's
+// own len(Steps) > 0 check included it, so a directory could print "N
+// scanned · 0 to act on" and then still ask the user to approve a file it
+// had just said there were none of - and on approval, log a
+// run-start/run-end pair holding only "skipped" entries.
func chainActing(c plan.Chain) bool {
for _, s := range c.Steps {
if s.Skip == "" {
@@ -149,9 +149,9 @@ func chainActing(c plan.Chain) bool {
}
// countActing reports how many chains have at least one step that will
-// actually run. C1/ruling 2026-09-12: a rule with no actions is an
-// exclusion, and a chain every one of whose steps is skipped is not about
-// to do anything either - neither must inflate "to act on".
+// actually run. A rule with no actions is an exclusion, and a chain every
+// one of whose steps is skipped is not about to do anything either -
+// neither must inflate "to act on".
func countActing(chains []plan.Chain) int {
n := 0
for _, c := range chains {
@@ -186,7 +186,7 @@ func printBlocks(w io.Writer, chains []plan.Chain, root string, p palette, width
fmt.Fprintln(w)
head := " " + padLeft(strconv.Itoa(i), numW) + " "
// A long name continues at the value column, never at the label
- // column, so its text cannot pass for a step line (triage 28l).
+ // column, so its text cannot pass for a step line.
for _, l := range wrapped(head, display(c.File.Rel), indent+labelWidth+1, width, plainText) {
fmt.Fprintln(w, l)
}
@@ -328,8 +328,8 @@ func wrapText(s string, max int) []string {
// character (CJK), none for a combining mark, one for the rest - format
// characters included: a terminal may draw one (a soft hyphen), and
// counting a column too many only wraps early, while one too few runs past
-// the edge (triage 28j, plan 11 review L4). A terminal can still draw some
-// characters wider (emoji, ambiguous-width letters); see KNOWN LIMITATIONS.
+// the edge. A terminal can still draw some characters wider (emoji,
+// ambiguous-width letters); see KNOWN LIMITATIONS.
func cols(s string) int {
n := 0
for _, r := range s {
@@ -362,9 +362,9 @@ func destText(s plan.Step, root string) string {
dir := filepath.Dir(s.Dst)
if rel, ok := relToRoot(root, dir); ok {
if rel == "" {
- // D10: rel is "" exactly when dir is root itself (relToRoot's
- // own case below); rendering that as bare rel+"/" would print
- // "/", which reads as the filesystem root rather than "this
+ // rel is "" exactly when dir is root itself (relToRoot's own
+ // case below); rendering that as bare rel+"/" would print "/",
+ // which reads as the filesystem root rather than "this
// directory".
return "./"
}
@@ -376,7 +376,7 @@ func destText(s plan.Step, root string) string {
// relToRoot returns dir relative to root (slash-separated) when dir is
// root itself or lies inside it; ok is false when dir lies outside root,
// including when the two cannot be related at all (e.g. one relative, one
-// absolute). C3: root itself counts as "inside" here (rel is "", ok true) -
+// absolute). root itself counts as "inside" here (rel is "", ok true) -
// unlike internal/engine/match.go's excludeDirs, which asks a different
// question (what may a rule exclude from the walk) and treats root as
// outside it; do not "unify" the two.
@@ -405,7 +405,7 @@ func padLeft(s string, w int) string {
// colWidth returns the widest string in ss, in runes, capped at max when
// max is positive; 0 leaves it uncapped. Shares relWidth's rune-counting
-// rule (C4): a name carrying diacritics must not misalign its column.
+// rule: a name carrying diacritics must not misalign its column.
func colWidth(ss []string, max int) int {
w := 0
for _, s := range ss {