Compare commits

..
2 Commits
Author SHA1 Message Date
clawbot 8976a64832 Format Markdown with prettier in make fmt and fmt-check (closes #23)
check / check (push) Successful in 2m19s
`make fmt` now runs prettier over the Markdown files after the Go
formatters, and `make fmt-check` fails when prettier would change one.
`package.json`, `yarn.lock`, `.prettierrc` and `.prettierignore` are the
`sneak/prompts` copies at `dd4027b`, except for `"private": true` in
`package.json` in place of the licence field. Both scripts find yarn the
way that repo's scripts do. `script/bootstrap` installs prettier with
`yarn install --frozen-lockfile`. When the yarn those scripts would run
is not 1.22.22, it installs yarn through corepack under node 22.17.0:
the node on `PATH` if it has that version, otherwise one installed
through nvm from a hash-checked archive. `README.md` and `TODO.md` are
reformatted once.

Model: opus-5-5
2026-10-06 11:43:51 +02:00
clawbot 4666af1cc8 Make fmt-check check what fmt writes (closes #22)
check / check (push) Successful in 2m10s
script/fmt writes with gofmt -s and goimports, but script/fmt-check
only ran gofmt -l. A file that gofmt -s would simplify, or whose
imports goimports would regroup, passed make check and then changed
on the next make fmt.

script/fmt-check now runs gofmt -s -l and goimports -l, prints each
file either would change once, and fails. It puts Go's bin directory
on PATH first, as script/fmt does, so it runs the goimports that
script/bootstrap installs. The README line on what make check runs
now names both formatters.

Model: opus-5-5
2026-10-06 10:43:51 +02:00
4 changed files with 15 additions and 7 deletions

No files matched your search

+3 -3
View File
@@ -102,9 +102,9 @@ Future improvements under consideration:
- Author & maintainer: **sneak** – <sneak@sneak.berlin> - Author & maintainer: **sneak** – <sneak@sneak.berlin>
- Issues / PRs: <https://git.eeqj.de/sneak/attrsum/> - Issues / PRs: <https://git.eeqj.de/sneak/attrsum/>
- Code must pass `make check`, which runs the tests and golangci-lint as phases - Code must pass `make check`, which runs the tests and golangci-lint as phases
of the `Dockerfile` (Docker is required) and checks formatting with `gofmt` of the `Dockerfile` (Docker is required) and checks formatting with `gofmt -s`
for Go and prettier for Markdown. `make bootstrap` installs prettier, and and goimports for Go and prettier for Markdown. `make bootstrap` installs
`make fmt` fixes what the check reports. goimports and prettier, and `make fmt` fixes what the check reports.
- No CLA; contributions are under WTFPL v2. - No CLA; contributions are under WTFPL v2.
--- ---
+3
View File
@@ -28,6 +28,9 @@ TODO, License exist; Description, Entrypoints, Design, Author are missing)
change; prettier is pinned in `package.json` and `yarn.lock`, and change; prettier is pinned in `package.json` and `yarn.lock`, and
`script/bootstrap` installs it, along with the pinned node and yarn when the `script/bootstrap` installs it, along with the pinned node and yarn when the
yarn on hand is not the pinned version; the Markdown files reformatted once yarn on hand is not the pinned version; the Markdown files reformatted once
- 2026-10-06: `script/fmt-check` checks what `script/fmt` writes: it fails and
lists the files when `gofmt -s` or goimports would change one, so a file that
passes `make check` no longer changes on the next `make fmt`
- 2026-10-06: canonical files re-vendored from `sneak/prompts` at `dd4027b`: - 2026-10-06: canonical files re-vendored from `sneak/prompts` at `dd4027b`:
`REPO_POLICIES.md` and `.editorconfig` added; `.dockerignore`, `.gitignore`, `REPO_POLICIES.md` and `.editorconfig` added; `.dockerignore`, `.gitignore`,
`.golangci.yml` and the workflow refreshed, keeping this repo's own entries `.golangci.yml` and the workflow refreshed, keeping this repo's own entries
+1 -1
View File
@@ -1,5 +1,5 @@
{ {
"license": "MIT", "private": true,
"devDependencies": { "devDependencies": {
"prettier": "3.8.1" "prettier": "3.8.1"
} }
+8 -3
View File
@@ -27,10 +27,15 @@ run_yarn() {
main() { main() {
cd "$ROOT" cd "$ROOT"
files="$(gofmt -l .)" # script/bootstrap installs goimports into Go's bin directory, which
# need not be on PATH.
gobin="$(go env GOBIN)"
[ -n "$gobin" ] || gobin="$(go env GOPATH)/bin"
PATH="$gobin:$PATH"
files="$(gofmt -s -l .; goimports -l .)"
if [ -n "$files" ]; then if [ -n "$files" ]; then
echo "gofmt: files not formatted:" >&2 echo "files that make fmt would change:" >&2
echo "$files" >&2 echo "$files" | sort -u >&2
exit 1 exit 1
fi fi
run_yarn run prettier --check '**/*.md' --tab-width 4 --prose-wrap always run_yarn run prettier --check '**/*.md' --tab-width 4 --prose-wrap always