From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 3+uAHaGiM2o5CA0AWB0awg (envelope-from ) for ; Thu, 18 Jun 2026 03:47:45 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=bY+JQ8TK; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Db6npvW/; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=uwY0acbf; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=JPHJAj5e; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 565B61E024; Thu, 18 Jun 2026 03:47:45 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4D8111E024 for ; Thu, 18 Jun 2026 03:47:43 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 57EE24BA23C3 for ; Thu, 18 Jun 2026 07:47:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 57EE24BA23C3 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=bY+JQ8TK; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Db6npvW/; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=uwY0acbf; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=JPHJAj5e Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 1670E4BA2E13 for ; Thu, 18 Jun 2026 07:47:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1670E4BA2E13 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1670E4BA2E13 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781768834; cv=none; b=oEEGmRpA8UvJbPE4L1zFLMUi/HP7QOUEKbbNtXgjNbqnoAGhu7R+PLxDNElsLmD8lckMrPpivxgRNkidp6Ve7fcpMRjLV/aQ8UEj+EyhawWxv28xrIRyPWKAskNxuz7oKYv0sSksNdwRhL4Ge6oy+vjkkhLKPFOPQyQH5wTyV2s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781768834; c=relaxed/simple; bh=clpwbTf7uZk6+I4iDikTuxISk1l226TdBpomw/nc8GQ=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=wu1v2bd94isCsx90guy660/5NwghrHQ3POyJvHodI1GH+XBuaNoe5ArjrdoWPbFnYi+aq6Zu3JWX7H0j9Gm2PKBvk9dXO6QpRYZLy4MGJin5Zd3CfLJTPHIL4GwfBwQg6bn+q+Pof8Pe4OPIk2E5Gzr3V6PasnijzbPv1Lc0oX4= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=bY+JQ8TK; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Db6npvW/; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=uwY0acbf; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=JPHJAj5e DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1670E4BA2E13 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DCF796D1D4 for ; Thu, 18 Jun 2026 07:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1781768833; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=N2XL+qNHAN/0/G8HYxCxX2+Jm6lpfs2ulb4dVt7IV+8=; b=bY+JQ8TKFAXjJA7facMthVkhAtHXVVa7hhxk1nXUxT3IdEzwX07VOACYO6hImPG+HWEYaC 71fqv3TbfA2omN6gdlyzgyc8fp1UbhLt7H/jJZNBQJocLu0KNrrFJp6rcsUEQlTV57jdt8 SYnCyWp/LPf97gYtV/Pbj39V4Xw3L0k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1781768833; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=N2XL+qNHAN/0/G8HYxCxX2+Jm6lpfs2ulb4dVt7IV+8=; b=Db6npvW/xNUNX/dqObtx3EqsaLx7x5ndn38/YwcIsvXHEpQM6KF0W+hvVRoS0mBpo0UYkO 6nHSWHD4i+xsIpAg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1781768832; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=N2XL+qNHAN/0/G8HYxCxX2+Jm6lpfs2ulb4dVt7IV+8=; b=uwY0acbfcQkfZkjFIfwbEnKn9mZGEgLQXYHcjfE70Z5hGBIk+pKWYwDzh6a9OgmNoec+XU y3i3AnzCN2Gg0dBrJQh8j3I4rYemevqF0mSUQAoJySuIXvujsvvFd7FgBrIvqdfxXst16E +Y6fmHMQZnBOy+TSfJ0zfPduEpFjDio= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1781768832; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=N2XL+qNHAN/0/G8HYxCxX2+Jm6lpfs2ulb4dVt7IV+8=; b=JPHJAj5eVyTQaqkiTstmhFZvB5ao24efyVYOfIf8Pb8YMyQ9hD/PVNg4+l46hb8eOAstJv vc7BeoE2urSewEBA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C4DD9779A8 for ; Thu, 18 Jun 2026 07:47:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id vBhjLoCiM2r7BwAAD6G6ig (envelope-from ) for ; Thu, 18 Jun 2026 07:47:12 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH] [pre-commit] Remove duplication in config file Date: Thu, 18 Jun 2026 09:47:12 +0200 Message-ID: <20260618074712.32860-1-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-2.79 / 50.00]; BAYES_HAM(-2.99)[99.94%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, sourceware.org:url, suse.de:mid] X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org In a recent commit, I introduced anchor/alias pairs in .pre-commit-config.yaml, with short non-descriptive names for local use: ... - - id: check-include-guards - name: check-include-guards + - id: &id0 check-include-guards + name: *id0 ... Use anchor and aliases a bit more to remove duplication, now using more descriptive names for non-local uses. Yaml also supports defining an anchor for more than one field, which result in cleaner code: ... +python-files: &python-files + types_or: [file] + files: '^gdb/.*\.py(\.in)?$' + ... - id: black - types_or: [file] - files: '^gdb/.*\.py(\.in)?$' + <<: *python-files ... but unfortunately pre-commit generates a warning "[WARNING] Unexpected key(s) present at root: python-files" for this [1]. Also add a default files setting. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34295 [1] https://github.com/pre-commit/pre-commit/issues/1481 --- .pre-commit-config.yaml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 141451501ed..c15a1c64690 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,6 +40,7 @@ minimum_pre_commit_version: 4.5.1 default_install_hook_types: [pre-commit, commit-msg] default_stages: [pre-commit] +files: '^(gdb|gdbserver|gdbsupport)/' repos: # Python hooks. Run these for (in glob notation): @@ -56,33 +57,32 @@ repos: rev: 26.5.1 hooks: - id: black - types_or: [file] - files: '^gdb/.*\.py(\.in)?$' + types_or: &gdb_python_types [file] + files: &gdb_python_files '^gdb/.*\.py(\.in)?$' - repo: https://github.com/pycqa/flake8 rev: 7.3.0 hooks: - id: flake8 - types_or: [file] - files: '^gdb/.*\.py(\.in)?$' + types_or: *gdb_python_types + files: *gdb_python_files args: [--config, gdb/setup.cfg] - repo: https://github.com/pycqa/isort rev: 9.0.0a3 hooks: - id: isort - types_or: [file] - files: '^gdb/.*\.py(\.in)?$' + types_or: *gdb_python_types + files: *gdb_python_files # Codespell hooks. - repo: https://github.com/codespell-project/codespell rev: v2.4.2 hooks: - id: codespell - files: '^(gdb|gdbserver|gdbsupport)/' - args: [--toml, gdb/pyproject.toml] + args: &codespell_args [--toml, gdb/pyproject.toml] - id: codespell name: codespell-log entry: gdb/contrib/codespell-log.sh - args: [--toml, gdb/pyproject.toml] + args: *codespell_args verbose: true stages: [commit-msg] @@ -116,7 +116,6 @@ repos: name: *id2 language: unsupported_script entry: gdb/contrib/check-whitespace-pre-commit.py - files: '^(gdb(support|server)?)/.*$' - id: &id3 pre-commit-setup name: *id3 language: python @@ -128,4 +127,3 @@ repos: name: *id4 language: unsupported_script entry: gdb/contrib/check-file-mode.sh - files: '^(gdb|gdbserver|gdbsupport)/.*$' base-commit: 0c6ebc781ac79cd64d12d8acc1cb50fd4de2bb3a -- 2.51.0