From af96ef21c9303a1b61858f5ea013bfb3028570e8 Mon Sep 17 00:00:00 2001 From: Paul Meyer Date: Fri, 21 Mar 2025 13:28:15 +0100 Subject: [PATCH] feat(depotfmt): enforce editorconfig Change-Id: Id2c1e5e8f26d7022978e3b0053394d7edc423875 Reviewed-on: https://cl.snix.dev/c/snix/+/30233 Autosubmit: Paul Meyer Tested-by: besadii Reviewed-by: Florian Klink Reviewed-by: Paul Meyer --- tools/depotfmt.nix | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tools/depotfmt.nix b/tools/depotfmt.nix index d62461a58..44cad1cfa 100644 --- a/tools/depotfmt.nix +++ b/tools/depotfmt.nix @@ -20,6 +20,44 @@ let command = "${pkgs.rustfmt}/bin/rustfmt" options = ["--edition", "2021"] includes = [ "*.rs" ] + + [formatter.editorconfig] + command = "${pkgs.editorconfig-checker}/bin/editorconfig-checker" + includes = [ + "*.c", + "*.conf", + "*.css", + "*.exp", + "*.go", + "*.h", + "*.hcl", + "*.html", + "*.java", + "*.jq", + "*.js", + "*.json", + "*.md", + "*.nix", + "*.proto", + "*.py", + "*.rs", + "*.scm", + "*.scss", + "*.sh", + "*.tf", + "*.toml", + "*.txt", + "*.xml", + "*.yaml", + "*.yml" + ] + excludes = [ + "snix/eval/src/tests/nix_tests/*", + + # contains "References: ", which has trailing whitespace + # FUTUREWORK: move into separate fixture and read from here + "snix/nix-compat/src/narinfo/mod.rs" + ] ''; # helper tool for formatting the depot interactively