From: Nicki Křížek Date: Tue, 28 Jul 2026 17:51:44 +0000 (+0000) Subject: Add meson lint check enforcing tab indentation in test configs X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6d343883bcc8deb563383c5c78fe1ff0c615fd70;p=thirdparty%2Fbind9.git Add meson lint check enforcing tab indentation in test configs 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 --- diff --git a/.editorconfig b/.editorconfig index 87bec2c9823..446d239ca85 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/meson.build b/meson.build index 0ffc1b8162e..7d3e358b667 100644 --- a/meson.build +++ b/meson.build @@ -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 index 00000000000..a31a3201725 --- /dev/null +++ b/util/check-conf-indentation.sh @@ -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