]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add meson lint check enforcing tab indentation in test configs
authorNicki Křížek <nicki@isc.org>
Tue, 28 Jul 2026 17:51:44 +0000 (17:51 +0000)
committerNicki Křížek <nicki@isc.org>
Thu, 6 Aug 2026 11:50:09 +0000 (13:50 +0200)
Ensure the named.conf.j2 templates in system test stay consistent in the
future by adding a lint check that runs in CI.

Assisted-by: Claude:claude-fable-5
.editorconfig
meson.build
util/check-conf-indentation.sh [new file with mode: 0755]

index 87bec2c98234b82f05a7ea48c036e5cfaf596412..446d239ca85f1ed490b1f1fb1ab63cf0e5229bc6 100644 (file)
@@ -7,3 +7,6 @@ switch_case_indent = true
 [{meson.build, meson_options.txt}]
 indent_style = space
 indent_size = 4
+
+[*.conf{,.j2,.in}]
+indent_style = tab
index 0ffc1b8162e1aa30e00406e9c9689d13b2fd24f1..7d3e358b6670c519d20b869f59d4c7b6ebca150f 100644 (file)
@@ -2202,6 +2202,15 @@ if git.found()
         workdir: meson.project_source_root(),
     )
 
+    test(
+        'conf-indentation',
+        sh,
+        suite: 'lint',
+        args: ['util/check-conf-indentation.sh'],
+        verbose: true,
+        workdir: meson.project_source_root(),
+    )
+
     if grep.found() and xargs.found()
         test(
             'checklibs',
diff --git a/util/check-conf-indentation.sh b/util/check-conf-indentation.sh
new file mode 100755 (executable)
index 0000000..a31a320
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+#
+# SPDX-License-Identifier: MPL-2.0
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0.  If a copy of the MPL was not distributed with this
+# file, you can obtain one at https://mozilla.org/MPL/2.0/.
+#
+# See the COPYRIGHT file distributed with this work for additional
+# information regarding copyright ownership.
+
+# Ensure named configuration files in system tests are indented with tabs.
+# The only leading space allowed is for a block comment continuation line.
+space_indentation="$(git grep -nE '^ [^*]' -- 'bin/tests/system/*.conf' 'bin/tests/system/*.conf.*')"
+
+if [ -n "${space_indentation}" ]; then
+  echo "The following lines use spaces for indentation:"
+  echo
+  echo "${space_indentation}"
+  echo
+  echo "Please indent named configuration files with tabs."
+  exit 1
+fi