Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH 3/5] [pre-commit] Run flake8 for gdb/gdb-gdb.py.in
Date: Wed, 12 Aug 2026 14:15:22 -0400	[thread overview]
Message-ID: <d03da34a-ed91-4ccd-b77d-199eb126e8d1@simark.ca> (raw)
In-Reply-To: <20260720125056.1373177-4-tdevries@suse.de>

On 7/20/26 8:50 AM, Tom de Vries wrote:
> When running the pre-commit hooks for gdb/gdb-gdb.py.in:
> ...
> $ pre-commit run --files gdb/gdb-gdb.py.in
> black...................................................................Passed
> flake8..............................................(no files to check)Skipped
> isort...................................................................Passed
> codespell...............................................................Passed
> tclint..............................................(no files to check)Skipped
> check-include-guards................................(no files to check)Skipped
> check-gnu-style.....................................(no files to check)Skipped
> - hook id: check-gnu-style
> check-whitespace........................................................Passed
> pre-commit-setup........................................................Passed
> check-file-mode.........................................................Passed
> ...
> we see that flake8 is skipped.
> 
> The hook setup has a types_or workaround that's supposed to prevent this:
> ...
>     - id: flake8
>       types_or: *gdb_python_types
>       files: *gdb_python_files
>       args: [--config, gdb/setup.cfg]
> ...
> but that doesn't work because flake8's .pre-commit-hooks.yaml doesn't set
> types_or, but types:
> ...
>     types: [python]
> ...
> 
> So we end up with an effective setting of both types and types_or:
> ...
>     types: [python]
>     types_or: [file]
> ...
> which both have to be matched, and because gdb/gdb-gdb.py.in doesn't match
> python:
> ...
> $ identify-cli gdb/gdb-gdb.py.in
> ["file", "non-executable", "text"]
> ...
> the file is skipped.
> 
> This could be fixed by:
> ...
> -    types_or: [file]
> +    types: [file]
> ...
> but an isort update setting types_or could reintroduce the same problem.
> 
> For robustness, fix this by setting both types and types_or for each python
> hook.
> 
> Using the same value for both settings would work:
> ...
>     types: [file]
>     types_or: [file]
> ...
> because types and types_or have the same effect for list lengths 0 and 1.
> 
> But I think it's better to have different anchors to avoid any confusion about
> the and/or behavior, in which case it's more natural to use the actual default
> [] for types_or, and to update the anchor names to reflect that these are the
> default values:
> ...
>     types: &types_default [file]
>     types_or: &types_or_default []
> ...

Are we doing all this just for gdb-gdb.py.in?  Because it might not need
to be a ".in" file, I don't see any substitution in it (unlike
gdb-gdb.gdb.in).  Could we rename it to gdb-gdb.py and use
AC_CONFIG_LINKS on it?  Would that simplify things?

Simon

  reply	other threads:[~2026-08-12 18:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 12:50 [PATCH 0/5] [pre-commit] Some pre-commit improvements Tom de Vries
2026-07-20 12:50 ` [PATCH 1/5] [gdb] Fix bare except in gdb/gdb-gdb.py.in Tom de Vries
2026-07-20 12:50 ` [PATCH 2/5] [gdb] Remove superfluous global " Tom de Vries
2026-07-20 12:50 ` [PATCH 3/5] [pre-commit] Run flake8 for gdb/gdb-gdb.py.in Tom de Vries
2026-08-12 18:15   ` Simon Marchi [this message]
2026-08-13  5:19     ` Tom de Vries
2026-07-20 12:50 ` [PATCH 4/5] [pre-commit] Don't require text type for check-whitespace hook Tom de Vries
2026-07-20 12:50 ` [PATCH 5/5] [pre-commit] Don't require text type for codespell hook Tom de Vries
2026-08-03 12:25 ` [PING][PATCH 0/5] [pre-commit] Some pre-commit improvements Tom de Vries
2026-08-12 18:16 ` [PATCH " Simon Marchi
2026-08-13  5:26   ` Tom de Vries
2026-08-25 12:52     ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d03da34a-ed91-4ccd-b77d-199eb126e8d1@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox