Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
7946e8d
feat(go): Go and TypeScript function metrics in code-shape-gate (RIG-…
rigel-mintaka Nov 10, 2026
d77fb4c
wip(go): T2 review abs root (RIG-8435)
rigel-mintaka Nov 10, 2026
cf0d7c4
wip(go): T2 review go scope (RIG-8435)
rigel-mintaka Nov 10, 2026
1b6e2a7
wip(go): T2 review ts scope (RIG-8435)
rigel-mintaka Nov 10, 2026
73194cb
wip(go): T2 review identity (RIG-8435)
rigel-mintaka Nov 10, 2026
41f2ee9
wip(go): T2 review package split, does not build (RIG-8435)
rigel-mintaka Nov 10, 2026
b30b84b
wip(go): T2 split cli package (RIG-8435)
rigel-mintaka Nov 10, 2026
d665098
wip(go): T2 qualify cli imports (RIG-8435)
rigel-mintaka Nov 10, 2026
49f525c
wip(go): T2 split Go collector (RIG-8435)
rigel-mintaka Nov 10, 2026
ca09622
wip(go): T2 split TypeScript collector (RIG-8435)
rigel-mintaka Nov 10, 2026
7bd8334
wip(go): T2 split config package (RIG-8435)
rigel-mintaka Nov 10, 2026
9e65ed5
wip(go): T2 lint clean after split (RIG-8435)
rigel-mintaka Nov 10, 2026
aa6467d
wip(go): T2 cognitive complexity (RIG-8435)
rigel-mintaka Nov 10, 2026
a94e38a
wip(go): T2 biome suppression findings (RIG-8435)
rigel-mintaka Nov 10, 2026
6997572
wip(go): T2 biome drift options (RIG-8435)
rigel-mintaka Nov 10, 2026
73896ac
wip(go): T2 optional function config (RIG-8435)
rigel-mintaka Nov 10, 2026
dd1002c
wip(go): T2 report unmeasured extensions (RIG-8435)
rigel-mintaka Nov 10, 2026
e1a4139
wip(go): T2 confine collector file reads (RIG-8435)
rigel-mintaka Nov 10, 2026
f38b2b8
wip(go): T2 cover skip-only modules (RIG-8435)
rigel-mintaka Nov 10, 2026
17a5130
wip(go): T2 fix suppression finding values (RIG-8435)
rigel-mintaka Nov 10, 2026
7c04f9a
wip(go): T2 document function gate (RIG-8435)
rigel-mintaka Nov 10, 2026
3402f68
wip(go): T2 fix README spacing (RIG-8435)
rigel-mintaka Nov 10, 2026
8494a40
wip(go): T2 check nested biome drift (RIG-8435)
rigel-mintaka Nov 10, 2026
c7df5c9
wip(go): T2 check linter versions (RIG-8435)
rigel-mintaka Nov 10, 2026
2f30b78
wip(go): T2 cover collector failures (RIG-8435)
rigel-mintaka Nov 10, 2026
0ce515c
wip(go): T2 validate lint issue attribution (RIG-8435)
rigel-mintaka Nov 10, 2026
0c32730
wip(go): T2 flag disabled biome rules (RIG-8435)
rigel-mintaka Nov 10, 2026
ebd2a0a
wip(go): T2 restore shape limits (RIG-8435)
rigel-mintaka Nov 10, 2026
35fd8e8
wip(go): T2 report unparseable functions (RIG-8435)
rigel-mintaka Nov 10, 2026
8646d6f
wip(go): T2 enforce Biome scope (RIG-8435)
rigel-mintaka Nov 10, 2026
46677d7
wip(go): T2 accept measured Biome errors (RIG-8435)
rigel-mintaka Nov 10, 2026
8f2c966
wip(go): T2 count Biome columns as runes (RIG-8435)
rigel-mintaka Nov 10, 2026
a70453a
wip(go): T2 strengthen collector fixtures (RIG-8435)
rigel-mintaka Nov 10, 2026
61fad5b
wip(go): T2 flag unbuilt Go functions (RIG-8435)
rigel-mintaka Nov 10, 2026
39c1121
wip(go): T2 identify Biome override drift (RIG-8435)
rigel-mintaka Nov 10, 2026
9b5b46e
wip(go): T2 simplify policy argument (RIG-8435)
rigel-mintaka Nov 10, 2026
ce98219
wip(go): T2 centralize function limits (RIG-8435)
rigel-mintaka Nov 10, 2026
dbe53e5
wip(go): T2 remove repeated class IDs (RIG-8435)
rigel-mintaka Nov 10, 2026
0969138
wip(go): T2 remove collector wrappers (RIG-8435)
rigel-mintaka Nov 10, 2026
b507695
wip(go): T2 document review fixes (RIG-8435)
rigel-mintaka Nov 10, 2026
80b34cc
wip(go): T2 consolidate release notes (RIG-8435)
rigel-mintaka Nov 10, 2026
aacda68
wip(go): T2 verify Biome scope partitions (RIG-8435)
rigel-mintaka Nov 10, 2026
d4e0d21
wip(go): T2 force Biome measurement config (RIG-8435)
rigel-mintaka Nov 10, 2026
925508d
wip(go): T2 refresh tools vendor hash (RIG-8435)
rigel-mintaka Nov 10, 2026
10c187d
wip(go): T2 report Biome parse failures (RIG-8435)
rigel-mintaka Nov 10, 2026
1496307
wip(go): T2 enforce unmeasured base ratchet (RIG-8435)
rigel-mintaka Nov 10, 2026
9ff85e2
wip(go): T2 label unmeasured findings (RIG-8435)
rigel-mintaka Nov 10, 2026
6b779d2
wip(go): T2 document forced measurement (RIG-8435)
rigel-mintaka Nov 10, 2026
1202fe2
wip(go): T2 fix Biome review mechanics (RIG-8435)
rigel-mintaka Nov 10, 2026
3ac30d0
wip(go): T2 delimit Biome path arguments (RIG-8435)
rigel-mintaka Nov 10, 2026
928bb1e
wip(go): T2 size Biome inputs safely (RIG-8435)
rigel-mintaka Nov 10, 2026
8f4d9ee
wip(go): T2 test Biome count guard (RIG-8435)
rigel-mintaka Nov 10, 2026
0f6d95c
wip(go): T2 align Biome config discovery (RIG-8435)
rigel-mintaka Nov 10, 2026
4454688
wip(go): T2 report Biome count mismatch (RIG-8435)
rigel-mintaka Nov 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ The policy is the shared `[MD0nn]` rule set from `rumdl/base.toml` in this repo.

Optional `dirLimits` maps directory globs to `{limit: 50, reason: "record decisions together"}`. Limits must exceed 10 and reasons must contain at least three words. When multiple globs match, the smallest limit wins.

The gate also measures Go cognitive complexity, function lines and statements, and TypeScript cognitive complexity and function lines. The optional `functions` field uses the fixed Go limits 20, 60 and 40, and TypeScript limits 15 and 50. Existing configurations may omit it. Function collection requires `golangci-lint` and `biome` on PATH. The gate reports counted extensions without a collector on stderr.

Function allowlist entries are keyed by metric, path and function ID. Go IDs use function and receiver names, with closure ordinals within their enclosing function. TypeScript IDs use enclosing functions, classes and test titles where available. Suppression directives and mismatched Biome rule options are findings.

The gate runs Biome with its own generated configuration and the gate's limits. It copies the root Biome configuration's `javascript.parser` options. The repository's Biome rule settings are checked for consistency, but do not control measurement. The two measured rules may use `warn` or `error` levels in the repository configuration.

Skips are printed on stderr. A Go file outside the default build that contains functions, or a file Biome cannot parse, is an unmeasured finding. If the TypeScript function collector cannot parse a file and Biome reports an over-limit function, the gate reports a file-level finding. Existing function allowlist entries for unmeasured files are preserved on `--write`. Skips that leave no functions unmeasured are notices only. Use the gate's `exclude` to opt out.

Biome does not process files under `node_modules`. Exclude tracked paths in those directories from the gate.

Findings use the format `<path> <metric> value=<value> limit=<limit> fix=<cause>`. An `unmeasured` finding uses value and limit 0; its fix describes the cause.

```cue
functions: "go-lines": "src/example.go": [{id: "Example", value: 70, reason: "split by concern"}]
```

Add `tools/code-shape-gate/allowlist.cue` with `files` and `dirs` maps. Each entry has a measured `value` and a `reason` of at least three words:

```cue
Expand Down
4 changes: 4 additions & 0 deletions go/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@

### Added

- `code-shape-gate` measures Go and TypeScript functions, reports skipped files and unmeasured extensions, and detects suppression and Biome policy drift.
- Report unmeasured functions and Biome scope drift instead of silently passing them.


- Added a Renovate hash refresh command for Go source and vendor hashes, including the Go tools package vendor hash.
- Added `code-shape-gate`, which checks file length and directory width against a per-repo allowlist with a ratchet.
- `code-shape-gate` supports per-glob directory limits and excludes matching files from directory width counts.
4 changes: 2 additions & 2 deletions go/cmd/code-shape-gate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"context"
"os"

"github.com/RigelBuild/meissa/go/internal/codeshape"
"github.com/RigelBuild/meissa/go/internal/codeshape/cli"
)

func main() {
os.Exit(codeshape.Main(context.Background(), os.Args[1:], os.Getenv, os.Stdout, os.Stderr))
os.Exit(cli.Main(context.Background(), os.Args[1:], os.Getenv, os.Stdout, os.Stderr))
}
6 changes: 0 additions & 6 deletions go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,12 @@ require (
)

require (
cuelabs.dev/go/oci/ociregistry v0.0.0-20260601085548-328ff8e2c943 // indirect
github.com/cockroachdb/apd/v3 v3.2.3 // indirect
github.com/emicklei/proto v1.14.3 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.1 // indirect
github.com/protocolbuffers/txtpbfmt v0.0.0-20260420112717-c39628bde8b5 // indirect
github.com/rogpeppe/go-internal v1.15.0 // indirect
golang.org/x/net v0.56.0 // indirect
golang.org/x/oauth2 v0.36.0 // indirect
golang.org/x/sync v0.21.0 // indirect
golang.org/x/text v0.39.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)
2 changes: 0 additions & 2 deletions go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM=
golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus=
golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM=
golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q=
Expand Down
31 changes: 31 additions & 0 deletions go/internal/codeshape/cli/biome_scope_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// SPDX-License-Identifier: MIT OR Apache-2.0

package cli

import (
"strings"
"testing"
)

func TestBiomeIgnoredCountedPath(t *testing.T) {
for _, tc := range []struct{ name, rootConfig, nested string }{
{"includes", strings.TrimSuffix(tsBiomeConfig, "}") + `,"files":{"includes":["**", "!sub/**"]}}`, ""},
{"override", strings.TrimSuffix(tsBiomeConfig, "}") +
`,"overrides":[{"includes":["sub/**"],"linter":{"enabled":false}}]}`, ""},
{"nested", tsBiomeConfig, `{"root":false,"extends":"//","linter":{"enabled":false}}`},
} {
t.Run(tc.name, func(t *testing.T) {
root := tsRepo(t, "function healthy() {}\n")
trackedFile(t, root, "biome.json", tc.rootConfig)
trackedFile(t, root, "sub/x.ts", "function large() {\n"+strings.Repeat("console.log(1);\n", 51)+"}\n")
if tc.nested != "" {
trackedFile(t, root, "sub/biome.json", tc.nested)
}
commitFiles(t, root)
code, out, stderr := runGoGate(t, root)
if code != 1 || !strings.Contains(out, "sub/x.ts") {
t.Fatalf("code=%d out=%q stderr=%q", code, out, stderr)
}
})
}
}
Loading
Loading