bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnulib-tool.py: Fix an undefined function name.


From: Collin Funk
Subject: Re: gnulib-tool.py: Fix an undefined function name.
Date: Sat, 4 May 2024 05:49:59 -0700
User-agent: Mozilla Thunderbird

On 5/4/24 3:34 AM, Bruno Haible wrote:
> Yes. We cannot change the past git log, but this is one of the situations
> where changing a ChangeLog entry is adequate. Other such situations are
> obvious typos and forgotten changes.

I've pushed the attached patch adding the date to the ChangeLog entry.

>>> In this case, maybe some Python style checker would have produced a
>>> warning, right? Would it be possible to add a Makefile rule that checks
>>> for the absense of such warnings, and then use this Makefile rule in the
>>> continuous integration that runs at least once a week?
>>
>> Hmm, I like that idea. I would have to find what tool works best for
>> that.
> 
> Yes, please.

Right now I am leaning towards mypy. It seems to be the best at
detecting errors/potential errors.

For CI, I am thinking it is best to ignore the typing warnings for the
time being. Since gnulib-tool.py needs a bit more refactoring for that
to be helpful. It was written before typing was a thing. :)

mypy has the following options:

     mypy --disable-error-code NAME
     mypy --enable-error-code NAME

but there is a long list of error names and I'm not sure how
compatible they are between versions.

I'm removing the 'lines_to_multiline' import from GLImport.py. We
could have a few checks for guaranteed runtime failures like this:

      $ mypy GLImport.py | grep 'name-defined'
      GLImport.py:722: error: Name "lines_to_multiline" is not defined  
[name-defined]
      GLImport.py:736: error: Name "lines_to_multiline" is not defined  
[name-defined]
      GLImport.py:1143: error: Name "lines_to_multiline" is not defined  
[name-defined]
      GLImport.py:1326: error: Name "lines_to_multiline" is not defined  
[name-defined]
      GLImport.py:1327: error: Name "lines_to_multiline" is not defined  
[name-defined]
      GLImport.py:1328: error: Name "lines_to_multiline" is not defined  
[name-defined]

I'm not too familiar with the GitLab CI stuff. Would a Makefile in
gnulib/pygnulib with some checks work? Or did you have a different idea?

I think mypy should be packed in Debian and Fedora as 'python3-mypy'.
Another method that works for Python software is pipx [1]:

    $ pipx install mypy
    $ readlink $HOME/.local/bin/mypy
    /home/collin/.local/share/pipx/venvs/mypy/bin/mypy

Sometimes it helps for distributions with old packages. It uses a
virtual environment so you don't have to worry about breaking things
too.

[1] https://pipx.pypa.io/stable/

Collin

Attachment: 0001-Fix-ChangeLog-entry-for-previous-commit.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]