jordemort / action-pyright

A GitHub Action to run pyright
MIT License
11 stars 6 forks source link

Adds offset '1', because pyrights offsets are zero-based (issue #25) #26

Closed gersmann closed 2 years ago

jordemort commented 2 years ago

Thanks for the fix! I checked out this branch and poked at it a bit. Based on pyright's output, and on the response to the issue you linked in the pyright repo, I think the column numbers are 0-based as well, and we need to bump those also.

Here's a raw diagnostic from pyright running on bad.py:

        {
            "file": "/home/jordan/Source/action-pyright/pyright_to_rdjson/tests/files/bad.py",
            "severity": "error",
            "message": "Operator \"+\" not supported for types \"str\" and \"int\"\n  Operator \"+\" not supported for types \"str\" and \"int\"",
            "range": {
                "start": {
                    "line": 1,
                    "character": 11
                },
                "end": {
                    "line": 1,
                    "character": 20
                }
            },
            "rule": "reportGeneralTypeIssues"
        },

Here's the line it's referring to:

    return one + two + three

If you assume character is zero-based, then the string it calls out is one + two.

If you assume character is one-based, then the string it calls out is one + tw.

According to the Reviewdog JSON Schema, their positions are one-based: https://github.com/reviewdog/reviewdog/blob/master/proto/rdf/jsonschema/Position.jsonschema

gersmann commented 2 years ago

makes sense, thanks for checking this out

jordemort commented 2 years ago

Merged, thanks!

github-actions[bot] commented 2 years ago

🚀 [bumpr] Bumped! New version:v1.6.0 Changes:v1.5.0...v1.6.0