Re: [PATCH 3/5] [pre-commit] Run flake8 for gdb/gdb-gdb.py.in

Tom de Vries <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
On 8/12/26 8:15 PM, Simon Marchi wrote:
> 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? 

Yes.

> 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?

I've given the rename a try: ( 
https://sourceware.org/pipermail/gdb-patches/2026-August/229422.html ).

Thanks,
- Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.