Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple reviews generated for multiline mypy error #38

Open
abelcheung opened this issue Apr 7, 2022 · 13 comments
Open

Multiple reviews generated for multiline mypy error #38

abelcheung opened this issue Apr 7, 2022 · 13 comments
Assignees
Labels
enhancement New feature or request

Comments

@abelcheung
Copy link

I'm using action with following step configuration:

    - name: Mypy review
      uses: tsuyoshicho/action-mypy@v3
      with:
        reporter: github-pr-review
        level: warning
        fail_on_error: true

As an example, following is a multi-line mypy error when overriding superclass property in an incompatible way:

/home/runner/.../file.pyi:28:6: error: Signature of "error_log" incompatible with supertype "_Validator"
/home/runner/.../file.pyi:28:6: note:      Superclass:
/home/runner/.../file.pyi:28:6: note:          def error_log(self) -> _ErrorLog
/home/runner/.../file.pyi:28:6: note:      Subclass:
/home/runner/.../file.pyi:28:6: note:          @overload
/home/runner/.../file.pyi:28:6: note:          def error_log(self) -> int
/home/runner/.../file.pyi:29:5: error: Return type "int" of "error_log" incompatible with return type "_ErrorLog" in supertype "_Validator"

The error came from a single diff hunk, so I was expecting a single reviewdog action. Instead, it generated 7 independent reviews on the same pull request, each containing one line, and all of them are attached to the same diff.

@tsuyoshicho
Copy link
Owner

Work in progress...

@tsuyoshicho tsuyoshicho self-assigned this Apr 7, 2022
@tsuyoshicho
Copy link
Owner

tsuyoshicho commented Apr 7, 2022

Hi @abelcheung san,

github.com/tsuyoshicho/test-action-mypy/pull/1
Simply reproduction PR

Basically, mypy report only error and work fine it.
If your project mypy.ini report note:, option mypy_flags use to suppress it.

If you have a problem that you haven't set up that way,
I want you to make a minimum reproduction PR and report it here. (like above PR)

@abelcheung
Copy link
Author

Hi,

I have added tsuyoshicho/test-action-mypy#2, but needs your approval to run CI.

For the initial sample error above, mypy can probably hide the note: lines without --show-error-context, therefore this time I created another kind of error that mypy cannot suppress.

@abelcheung
Copy link
Author

As an example, following image shows the behavior I want to see -- multiple lines which are related to the same error can be grouped together.

圖片

@tsuyoshicho
Copy link
Owner

FYI
https://github.com/jordemort/action-pyright
use rdjson format (rich error report support),
mypy json report python/mypy#10816

I will think about it.

@abelcheung
Copy link
Author

Ouch, you're right, it is not easy to handle mypy error in its current state. It is fine to put the idea on hold until mypy has done something to improve the situation.

@tsuyoshicho
Copy link
Owner

Thanks a lot. (report and PR)

@tsuyoshicho
Copy link
Owner

tsuyoshicho commented Apr 8, 2022

tsuyoshicho/action-test-repo#21

Reproduce PR create in my test repo.
This code is same as abel's test code.

@abelcheung san
Your PR are closed
Please remove forked test-action-mypy repository.
This original test-action-mypy repository are other user test repo...Sorry.
I remove my forked repository too.

@abelcheung
Copy link
Author

@tsuyoshicho OK it's done.

@tsuyoshicho tsuyoshicho added bug Something isn't working help wanted Extra attention is needed labels Apr 12, 2022
@tsuyoshicho tsuyoshicho pinned this issue Apr 12, 2022
@tsuyoshicho
Copy link
Owner

tsuyoshicho commented Apr 30, 2022

Note:
python/mypy#10816 (comment)

FYI:
Relation File Format information.
reviewdog are diagnostics parsing tool, and that support json file.
https://github.com/reviewdog/reviewdog/tree/master/proto/rdf#rdjson

action-pyright using converted rdjson from original json.

When mypy implements Pyright's format json, converting the json using already existing action-pyright's method will be solved this issue.

@tsuyoshicho tsuyoshicho added enhancement New feature or request help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Apr 30, 2022
@tsuyoshicho
Copy link
Owner

@abelcheung san

With no progress on JSON support, I've introduced a workaround.

You can ignore the notice of note.
Please try setting according to your needs.

Release 3.10.0 https://github.com/tsuyoshicho/action-mypy/releases/tag/v3.10.0
test result for ignore note: tsuyoshicho/action-test-repo#27

This issue remains open.

@tsuyoshicho tsuyoshicho removed help wanted Extra attention is needed bug Something isn't working labels Nov 1, 2022
@abelcheung
Copy link
Author

@tsuyoshicho I have tried the ignore_note setting and it works fine here. It seems mypy developers don't have interest in implementing JSON support, so your workaround is probably the best approach right now.

@tsuyoshicho
Copy link
Owner

JSON output has been merged

Development of JSON output support will begin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants