Re: b4 type checking

Tamir Duberstein <[email protected]>
Newsgroups org.kernel.linux.tools
Message-ID <CAJ-ks9mZc=Q-KVnF0K=0HVW+rLxVa4beOqRFWs-N5qKKCW=9Lw@mail.gmail.com>
On Thu, Apr 2, 2026 at 3:46 PM Konstantin Ryabitsev
<[email protected]> wrote:
>
> On Thu, Apr 02, 2026 at 03:28:55PM -0400, Konstantin Ryabitsev wrote:
> > On Thu, Apr 02, 2026 at 01:15:51PM -0400, Tamir Duberstein wrote:
> > > I sent some typing improvements back in June 2025 and I see you've
> > > been steadily pushing things forward since then. However, when I try
> > > to run `uv tool run mypy .` on b4 I get just over 350 errors. Is there
> > > an invocation that's expected to be green?
> >
> > For the most part, "mypy --strict src/b4" gets only a few errors. The ones
> > you're seeing are mostly tests, I think. I see that uv reports more -- I'll
> > take a look at them.
> >
>
> There were just 3 that I found. The report is green now:
>
> $ uv tool run mypy --strict --python-executable "$(which python3)" src/b4/
> Success: no issues found in 28 source files

Thanks. I think part of the problem is that you're using `uv tool run`
rather than `uv run`; this uses your global mypy instead of the
versioned one in pyproject.toml. Here's what I see now, after your
fixes:

% uv run mypy src/b4
src/b4/__init__.py:1784: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/__init__.py:1794: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/__init__.py:1797: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/__init__.py:1804: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/__init__.py:1807: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/__init__.py:3177: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/__init__.py:3180: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/__init__.py:4637: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/__init__.py:4638: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/__init__.py:4643: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/kr.py:66: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/ez.py:193: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/ez.py:195: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/ez.py:202: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/ez.py:283: error: Unused "type: ignore" comment  [unused-ignore]
src/b4/ez.py:284: error: Unused "type: ignore" comment  [unused-ignore]
Found 16 errors in 3 files (checked 28 source files)

>
> There are a few more in src/tests, but I don't care about them as much.

There are 48 more in tests. Personally I think tests are just as
important because they might expose typing bugs, but that's just my
opinion.

Cheers.
Tamir
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.