From 618a640d4a7abee05fc031f1ccc888901094edac Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 29 Oct 2026 12:29:08 +0100 Subject: [PATCH] fix(lint): make mbake format the Makefile the same on every machine The repository installs mbake unpinned and shipped no .bake.toml, so the Makefile's final newline depended on the mbake version: - mbake 1.4.6 (e.g. the pkgmgr venv that wins on a host PATH) defaults to ensure_final_newline = false: `mbake format` strips the newline and `mbake format --check` accepts the stripped file. - mbake 1.5.0 (what pip installs today) rejects the same file with "Missing final newline", which is what CI reported on PR #1255. So a local `make autoformat` could strip the newline, the local lint-makefile stayed green, and CI failed; 6f653ce633 and #1262 had to restore the newline by hand. The tracked .bake.toml sets only ensure_final_newline = true, so every other formatter rule keeps its default. autoformat.sh and makefile.sh pass it with --config, so the result no longer depends on the version or on the directory mbake runs from. Checked with both versions: main's Makefile passes `--check --config .bake.toml`, and a copy without the final newline fails it with "Missing final newline". Co-Authored-By: Claude Opus 5.5 --- .bake.toml | 2 ++ scripts/lint/autoformat.sh | 4 ++-- scripts/lint/makefile.sh | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 .bake.toml diff --git a/.bake.toml b/.bake.toml new file mode 100644 index 0000000000..2adc00dfd2 --- /dev/null +++ b/.bake.toml @@ -0,0 +1,2 @@ +[formatter] +ensure_final_newline = true diff --git a/scripts/lint/autoformat.sh b/scripts/lint/autoformat.sh index 907e51eaee..1a4fa210a3 100755 --- a/scripts/lint/autoformat.sh +++ b/scripts/lint/autoformat.sh @@ -139,8 +139,8 @@ run_mbake() { return 0 fi local rc=0 - mbake format Makefile >/dev/null 2>&1 || rc=$? - [[ $rc -eq 0 ]] && { mbake format Makefile >/dev/null 2>&1 || rc=$?; } + mbake format --config .bake.toml Makefile >/dev/null 2>&1 || rc=$? + [[ $rc -eq 0 ]] && { mbake format --config .bake.toml Makefile >/dev/null 2>&1 || rc=$?; } if [[ $rc -eq 0 ]]; then write_status mbake OK else diff --git a/scripts/lint/makefile.sh b/scripts/lint/makefile.sh index 84e3b27f7e..07819375df 100755 --- a/scripts/lint/makefile.sh +++ b/scripts/lint/makefile.sh @@ -17,4 +17,4 @@ if ! command -v mbake >/dev/null 2>&1; then exit 127 fi -mbake format --check Makefile +mbake format --check --config .bake.toml Makefile