carlos / todomvc-bakeoff Public
fix: count Nim sources; recount code; re-score Nim readability
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 files changed,
+53
−16
harness/codestats.go+1 −1harness/harness_test.go+2 −2harness/testdata/codetree/src/app.nim+2 −0results/go-rastrillo.json+5 −0results/go.json+5 −0results/haskell.json+5 −0results/nim.json+6 −6results/ocaml.json+5 −0results/rust.json+5 −0results/spinel.json+7 −7results/swift.json+5 −0results/zig.json+5 −0
diff --git a/harness/codestats.go b/harness/codestats.go| index 38f77e3..c154760 100644 |
| --- a/harness/codestats.go |
| +++ b/harness/codestats.go |
| @@ -16,7 +16,7 @@ type CodeStats struct{ Server, Templates, JS, Tests, Deps int } |
| var ( |
| skipDirs = map[string]bool{"dist": true, "vendor": true, ".cache": true, "node_modules": true, ".git": true, "_build": true, "dist-newstyle": true, "target": true, "zig-out": true, ".zig-cache": true, ".build": true} |
| skipExts = map[string]bool{".css": true, ".md": true, ".sum": true, ".lock": true, ".json": true, ".db": true, ".png": true, ".ico": true, ".svg": true} |
| - sourceExts = map[string]bool{".go": true, ".rs": true, ".zig": true, ".ml": true, ".mli": true, ".hs": true, ".swift": true, ".mojo": true, ".🔥": true, ".rb": true, ".c": true, ".h": true, ".js": true, ".mjs": true, ".html": true, ".tmpl": true, ".erb": true, ".mustache": true, ".eex": true, ".sql": true} |
| + sourceExts = map[string]bool{".go": true, ".rs": true, ".zig": true, ".ml": true, ".mli": true, ".hs": true, ".swift": true, ".mojo": true, ".🔥": true, ".rb": true, ".nim": true, ".nims": true, ".c": true, ".h": true, ".js": true, ".mjs": true, ".html": true, ".tmpl": true, ".erb": true, ".mustache": true, ".eex": true, ".sql": true} |
| templateExt = map[string]bool{".html": true, ".tmpl": true, ".erb": true, ".mustache": true, ".eex": true} |
| testName = regexp.MustCompile(`(_test\.|\.test\.|_spec\.|Spec\.hs$|Test\.hs$|Tests\.swift$)`) |
| vanName = regexp.MustCompile(`^van[-.]`) |
diff --git a/harness/harness_test.go b/harness/harness_test.go| index a9f2f7a..09a6288 100644 |
| --- a/harness/harness_test.go |
| +++ b/harness/harness_test.go |
| @@ -110,7 +110,7 @@ func TestCountCode(t *testing.T) { |
| if err != nil { |
| t.Fatal(err) |
| } |
| - want := CodeStats{Server: 3, Templates: 2, JS: 4, Tests: 2, Deps: 2} |
| + want := CodeStats{Server: 5, Templates: 2, JS: 4, Tests: 2, Deps: 2} |
| if c != want { |
| t.Fatalf("got %+v, want %+v", c, want) |
| } |
| @@ -230,7 +230,7 @@ func TestSourceFiles(t *testing.T) { |
| if err != nil { |
| t.Fatal(err) |
| } |
| - want := []string{"main.go", "static/app.js", "views/index.html"} |
| + want := []string{"main.go", "src/app.nim", "static/app.js", "views/index.html"} |
| if strings.Join(got, ",") != strings.Join(want, ",") { |
| t.Fatalf("got %v, want %v", got, want) |
| } |
diff --git a/harness/testdata/codetree/src/app.nim b/harness/testdata/codetree/src/app.nim| new file mode 100644 |
| index 0000000..c433ef1 |
| --- /dev/null |
| +++ b/harness/testdata/codetree/src/app.nim |
| @@ -0,0 +1,2 @@ |
| +proc main() = |
| + echo "ok" |
diff --git a/results/go-rastrillo.json b/results/go-rastrillo.json| index 1e0ee27..f7b6357 100644 |
| --- a/results/go-rastrillo.json |
| +++ b/results/go-rastrillo.json |
| @@ -295,6 +295,11 @@ |
| "HTMLBytes": 43128, |
| "JSBytes": 3325 |
| }, |
| + "Memory": { |
| + "IdleKB": 0, |
| + "PeakKB": 0, |
| + "AfterKB": 0 |
| + }, |
| "Code": { |
| "Server": 614, |
| "Templates": 102, |
diff --git a/results/go.json b/results/go.json| index 19c4726..c2a5c96 100644 |
| --- a/results/go.json |
| +++ b/results/go.json |
| @@ -284,6 +284,11 @@ |
| "HTMLBytes": 46619, |
| "JSBytes": 4689 |
| }, |
| + "Memory": { |
| + "IdleKB": 0, |
| + "PeakKB": 0, |
| + "AfterKB": 0 |
| + }, |
| "Code": { |
| "Server": 665, |
| "Templates": 83, |
diff --git a/results/haskell.json b/results/haskell.json| index efabb54..4e5fc84 100644 |
| --- a/results/haskell.json |
| +++ b/results/haskell.json |
| @@ -296,6 +296,11 @@ |
| "HTMLBytes": 36847, |
| "JSBytes": 4183 |
| }, |
| + "Memory": { |
| + "IdleKB": 0, |
| + "PeakKB": 0, |
| + "AfterKB": 0 |
| + }, |
| "Code": { |
| "Server": 685, |
| "Templates": 0, |
diff --git a/results/nim.json b/results/nim.json| index ae63dc6..7f64280 100644 |
| --- a/results/nim.json |
| +++ b/results/nim.json |
| @@ -350,10 +350,10 @@ |
| "AfterKB": 0 |
| }, |
| "Code": { |
| - "Server": 0, |
| + "Server": 819, |
| "Templates": 0, |
| "JS": 112, |
| - "Tests": 0, |
| + "Tests": 177, |
| "Deps": 2 |
| }, |
| "Build": { |
| @@ -404,11 +404,11 @@ |
| "Readability": { |
| "Naming": 4, |
| "Structure": 4, |
| - "Traceability": 3, |
| - "Errors": 2, |
| + "Traceability": 4, |
| + "Errors": 4, |
| "Comments": 5, |
| - "Overall": 6, |
| - "Notes": "Only static/app.js was supplied; no Nim server source, routes, templates or database code were included, so server-side traceability could not be judged and these scores cover the client only. Strongest: comments explain intent precisely (fragment protocol, serial queue, preserving an in-progress edit across re-renders, the rendering flag guarding focusout), and names like post, render, finishEditing, itemOf read cleanly. Weakest: error handling. Any non-OK response triggers a full reload under the assumption the item vanished, hiding server errors; a fetch rejection is caught only by the queue's then(run, run) and otherwise surfaces as an unhandled rejection. Minor: render() assumes the fragment always contains .main and .footer." |
| + "Overall": 8, |
| + "Notes": "Strongest: comments explain intent (titleSpaces, maxBody sizing, the chunked-body patch, trimTitle's defect risk) and nothing else; a request is easy to follow from route through action into a single prepared statement in store.nim and back via renderMain. Clear module split with the vendored httpserver marked and its one change flagged. Weakest: action parses paths by splitting and indexing with a `found` flag and a `-1` id sentinel, which is denser than the rest; one-letter names (r, k, st, h) and the Reply-threading through `listFor` take a moment; several SQLite return codes are discarded without a word; page.nimf is included rather than imported, so view rendering is hidden from this file layout." |
| }, |
| "ReviewFindings": [ |
| "[correctness] `apps/nim/src/store.nim:181` — `$column_text(st, 1)` reads a NUL-terminated C string, although titles are stored with an explicit byte length. Posting `title=before%00after` therefore displays only `before`; saving that edit permanently loses the suffix. Read the value using `column_bytes` so accepted Unicode titles survive retrieval intact." |
diff --git a/results/ocaml.json b/results/ocaml.json| index a5ccccb..c8a026e 100644 |
| --- a/results/ocaml.json |
| +++ b/results/ocaml.json |
| @@ -346,6 +346,11 @@ |
| "HTMLBytes": 42587, |
| "JSBytes": 3685 |
| }, |
| + "Memory": { |
| + "IdleKB": 0, |
| + "PeakKB": 0, |
| + "AfterKB": 0 |
| + }, |
| "Code": { |
| "Server": 597, |
| "Templates": 0, |
diff --git a/results/rust.json b/results/rust.json| index 755ff49..a01d29f 100644 |
| --- a/results/rust.json |
| +++ b/results/rust.json |
| @@ -357,6 +357,11 @@ |
| "HTMLBytes": 36699, |
| "JSBytes": 4596 |
| }, |
| + "Memory": { |
| + "IdleKB": 0, |
| + "PeakKB": 0, |
| + "AfterKB": 0 |
| + }, |
| "Code": { |
| "Server": 702, |
| "Templates": 0, |
diff --git a/results/spinel.json b/results/spinel.json| index 09516ae..148aee2 100644 |
| --- a/results/spinel.json |
| +++ b/results/spinel.json |
| @@ -368,13 +368,13 @@ |
| "Deps": 2 |
| }, |
| "Build": { |
| - "ColdSeconds": 0, |
| - "WarmSeconds": 0, |
| - "EditSeconds": 0, |
| - "Bytes": 0, |
| - "Host": "", |
| - "ColdRuns": 0, |
| - "Runs": 0 |
| + "ColdSeconds": 287.12381672, |
| + "WarmSeconds": 101.340795406, |
| + "EditSeconds": 103.978456017, |
| + "Bytes": 8749592, |
| + "Host": "DOCS-T1", |
| + "ColdRuns": 1, |
| + "Runs": 3 |
| }, |
| "TokensBuild": { |
| "Input": 258, |
diff --git a/results/swift.json b/results/swift.json| index 593ecfb..d79afb9 100644 |
| --- a/results/swift.json |
| +++ b/results/swift.json |
| @@ -368,6 +368,11 @@ |
| "HTMLBytes": 41189, |
| "JSBytes": 3110 |
| }, |
| + "Memory": { |
| + "IdleKB": 0, |
| + "PeakKB": 0, |
| + "AfterKB": 0 |
| + }, |
| "Code": { |
| "Server": 1251, |
| "Templates": 0, |
diff --git a/results/zig.json b/results/zig.json| index e085f16..959533e 100644 |
| --- a/results/zig.json |
| +++ b/results/zig.json |
| @@ -343,6 +343,11 @@ |
| "HTMLBytes": 35808, |
| "JSBytes": 3854 |
| }, |
| + "Memory": { |
| + "IdleKB": 0, |
| + "PeakKB": 0, |
| + "AfterKB": 0 |
| + }, |
| "Code": { |
| "Server": 964, |
| "Templates": 0, |