python / python/mypy

Number of source files reported can be confusing

Open
#7,518 1 comment 2 reactions 1 assignee View on GitHub

@JukkaL is already working on this.

Since Sep 16, 2019.

needs discussion priority-0-high topic-usability
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

It's possible for mypy to report fewer source files than files with errors. Example:

Found 38 errors in 8 files (checked 2 source files)

This was surprising to me. It turns out that the number of source files only includes the files passed on the command line, and it doesn't include files found by following imports. It might be better to include all found files.

There are some open questions though:

  • Should stubs be included in the count? My intuition says that they should not be, at least stubs from typeshed, since they are usually not what the user wants to be checked.
  • What about PEP 561 inline typed files? Mypy doesn't report errors in these by default, so they aren't checked, strictly speaking. I'm not sure about this.

If we'd change "checked N source files" to "processed N source files", counting all .py files would seem like the logical thing to do (including PEP 561 inline typed files). However, 'processed' doesn't sound as nice as 'checked' to me.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.