Thanks to visit codestin.com
Credit goes to github.com

Skip to content

stubtest: More information in concise errors #15011

Open
@QuLogic

Description

@QuLogic

Feature

The default error message is 5 lines:

  1. An error message
  2. Stub file/line context information
  3. Stub line contents
  4. Runtime file/line context information
  5. Runtime line contents

The concise error message is 1 line, but all it contains is the first point above.

Instead, it would be nice if it included context information, i.e., printing something like file:line:error message. Extra nice would be if it printed the message twice, once for stub and once for runtime (unless the error was that one was missing of course.)

Also, the note about unused allowlist entry includes no context information in either mode, but it would be nice if it did.

Pitch

In matplotlib/matplotlib#25586, I am trying to get stubtest errors posted to PRs. Because the concise format contains no context information, I must use the verbose messages, but as those are multiple lines, it is difficult to easily parse those. In my test PR, you can see that I am able to catch 4 out of 6 errors. I cannot catch the allowlist notes because they include no context information. I cannot catch a missing stub entry because that error message includes no line number.

As you can see, I need to create a setup for each of the 5 lines. If the concise errors included context information, I could simplify that to just %f:%l:%m or similar.

Theoretically, this could also be useful for any editor that supported vim's errorformat.

Also cc'ing @hauntsaninja from matplotlib/matplotlib#24976 (comment)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions