From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id K0onHc/IVGpMEQYAWB0awg (envelope-from ) for ; Mon, 13 Jul 2026 07:15:27 -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=ArlupLp8; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=geHBfcxU; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=xELAVLZk; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=dJawhtRD; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6885A1E033; Mon, 13 Jul 2026 07:15:27 -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 [38.145.34.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 531361E033 for ; Mon, 13 Jul 2026 07:15:26 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D677E4BA2E3A for ; Mon, 13 Jul 2026 11:15:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D677E4BA2E3A 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=ArlupLp8; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=geHBfcxU; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=xELAVLZk; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=dJawhtRD Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 6BDFC4BA2E19 for ; Mon, 13 Jul 2026 11:15:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6BDFC4BA2E19 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 6BDFC4BA2E19 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783941300; cv=none; b=G0i30f13zVpg6pDA8RRLVf6eplVZLrikWhADMRcFJ8TI600pCQF+h6AMdlPjtGy6XSU4Ui3lNTf68qUNjgku0WcA/YKyCpwnzUneGBtnTQNJEVjNRzENVFbEljt8ygAFQY5U1lZ0iKrxP1qj/UpKRzfjshxA18s/Jd+amucuRrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783941300; c=relaxed/simple; bh=z7RsLRIX7TfGXWfAfb3VB4/D3wOaX7EGdkXSd4CLIoo=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:From:To; b=v9m5ibpTCBtJ8vtyjFSJcjSllOIQUTnFZCHgA7sSRpznPX7tGgi3DYowOHWVz9YekUN7nMAjAPZJMZH+7R7IUC1RexnDsWEq5bJO8U7RYFP1Vn5VLJlJS3jQL1vKKkjzIJMV5K1JS3nEdA/tc8azQ0a4L8qh5NKfft6J65frv1w= 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=ArlupLp8; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=geHBfcxU; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=xELAVLZk; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=dJawhtRD DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BDFC4BA2E19 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 E50B77784B for ; Mon, 13 Jul 2026 11:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1783941299; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=52S5//i83kU1B3NVeb5hzfzgzd5HluYbiCt94d1+cJ0=; b=ArlupLp8E0HtlB4o2wLRRs/tzkN2KzztSbh2ht3xem7qK/95x7IfnciEZKkKFoim328qEo gFTuNH16E7MpLZIfHkfI7G+YT+eGHeVcDhmUI4qZqhu2hw547HAZKQ69q8eH/8puaQ4Ai2 qfTL9WGgqVJ9CZRLD7Uoquno8KrQisY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1783941299; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=52S5//i83kU1B3NVeb5hzfzgzd5HluYbiCt94d1+cJ0=; b=geHBfcxUpC8uVN/XEt5WXm9JaQuA92pCZHtFqEYxjWAowDzU4DTZXVj/GZ3c3ysmNbqB13 NoAxoj+bzDRjxIBA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=xELAVLZk; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=dJawhtRD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1783941298; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=52S5//i83kU1B3NVeb5hzfzgzd5HluYbiCt94d1+cJ0=; b=xELAVLZkQ0HrzluyaQVX5NlPOr6rLA6chth9O6h9KEjGUYS8JcJ0HSRcHECJCerxJ8Bh7g uzkjjSkVK8JyKTzM1ugYNCGYtlu2XBA5zyEMjW0lWqiU6CC+T3oY9v2cTrCHAlwiY8lmyH T+Vq11av/Lw/AUXCCGKM1s/W4ckaFz4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1783941298; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=52S5//i83kU1B3NVeb5hzfzgzd5HluYbiCt94d1+cJ0=; b=dJawhtRDpScC+YkBpzYqknF4UbnfCtDWj8MXwObdLHpW4cDvNqAZ55JHBezns3qepLkAO+ iH3MVqxKyNL37ICw== 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 B9503779AE for ; Mon, 13 Jul 2026 11:14:58 +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 gCP+K7LIVGqNZAAAD6G6ig (envelope-from ) for ; Mon, 13 Jul 2026 11:14:58 +0000 Message-ID: <50d9ac70-c824-4fd3-ba80-f9a16c40e919@suse.de> Date: Mon, 13 Jul 2026 13:14:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [pre-commit] Remove duplication in config file From: Tom de Vries To: gdb-patches@sourceware.org References: <20260618074712.32860-1-tdevries@suse.de> Content-Language: en-US In-Reply-To: <20260618074712.32860-1-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Action: no action X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_ONE(0.00)[1]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:mid,suse.de:dkim,sourceware.org:url]; RCVD_TLS_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: E50B77784B 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 On 6/18/26 9:47 AM, Tom de Vries wrote: > 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. > I've pushed this. Thanks, - Tom > 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