Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 15 additions & 0 deletions go/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@ let
# gofumpt/gotools are the same igloo `pkgs` builds the dev-shell carries,
# so the Go output matches the dev-loop formatter. null on the non-flake
# `import ./go/default.nix` path (treelint absent).
# tommy's conformist codegen linter driver ([linter.tommy-codegen]), owned by
# the tommy flake so the pinned tommy input resolves which tommy backs it (no
# per-repo driver duplication). It bakes that tommy in and skips when go is
# absent. Regenerates the *_tommy.go companions so they land in the
# `conformist --commit` chore; `just build-go-generate` remains the
# NATO-ordered regen path.
tommyCodegen = tommy.packages.${system}.conformist-tommy-codegen;

treelint-fmt =
if treelint == null then
null
Expand All @@ -275,6 +283,13 @@ let
pkgs.nixfmt
pkgs.shfmt
pkgs.shellcheck
# tommy (TOML formatter, [formatter.tommy]) + go + the codegen driver
# ([linter.tommy-codegen]), so the wrapper resolves the formatter and
# the codegen repair regen. go is needed by `tommy generate`'s
# go/packages analysis in repair mode.
tommy.packages.${system}.default
pkgs.go_1_26
tommyCodegen
];
text = ''exec conformist "$@"'';
};
Expand Down
23 changes: 23 additions & 0 deletions treelint.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ command = "shfmt"
options = ["-w", "-i", "2", "-s", "-ci"]
includes = ["*.sh", "*.bash"]

# TOML via tommy's CST-preserving formatter (`tommy fmt`). treelint.toml itself
# is excluded above (intentional layout).
[formatter.tommy]
command = "tommy"
options = ["fmt"]
includes = ["*.toml"]

# Linter: shellcheck runs read-only in `treelint check` (no repair-command, so
# it is a no-op in repair mode). Catches shell bugs the formatters miss.
[linter.shellcheck]
Expand All @@ -61,3 +68,19 @@ includes = ["*.sh", "*.bash"]
# go/vimdiff.bash is the vendored upstream git-vimdiff mergetool test harness;
# it carries ~40 shellcheck findings we don't own. shfmt still formats it.
excludes = ["go/vimdiff.bash"]

# tommy codegen as a REPAIR linter: `treelint` / `conformist --commit` runs
# `tommy generate` for every `//go:generate tommy generate` source file, so the
# regenerated *_tommy.go companions land in the auto-fix chore. The driver
# self-gates on tommy + go (present on the treelint-fmt wrapper PATH), so it is a
# no-op where the toolchain is absent. The CHECK command is a deliberate no-op
# (`true`) so `treelint check` never reports false codegen drift — `tommy
# generate --check` compares against tommy's raw render, which differs from the
# committed file once it is re-run through gofumpt (see `just build-go-generate`
# / `codemod-go-fmt`); true staleness stays gated by that recipe.
# passes-files=false: the driver walks the tree for the directive itself.
[linter.tommy-codegen]
command = "true"
repair-command = "conformist-tommy-codegen"
includes = ["*.go", "**/*.go"]
passes-files = false
Loading