jordemort / action-pyright

A GitHub Action to run pyright
MIT License
12 stars 5 forks source link

Comments are off by 1 line #25

Closed gersmann closed 2 years ago

gersmann commented 2 years ago

It seems like comments are generally off by 1 line, e.g.

image

This affects all test comments I have generated.

jordemort commented 2 years ago

I think @Chadsr ran into this too - maybe we just need to add in an offset in pyright_to_rdjson.py?

gersmann commented 2 years ago

I think @Chadsr ran into this too - maybe we just need to add in an offset in pyright_to_rdjson.py?

Yeah, linenumber + 1 it seems?

gersmann commented 2 years ago

@jordemort not sure where this action is used, would it be safe to hardcode the offset (does it affect other projects as well) or should we make it configurable?

jordemort commented 2 years ago

@gersmann I think it's probably a bug that's affecting everyone that uses it. I want to play around with it a bit to confirm, but I'm on the road this week - I might not get time to mess with it until next week. PRs are always welcome, of course ;)

chadsr commented 2 years ago

I had intended to extend the unit test to catch this, but I did not fully get around to confirming it. (and i'm also a bit too busy right now)

Ideally the unit test should have an example output from Pyright to check against the generated rdjson output. If the test still passes, then somehow the line numbers must be getting jumbled further on in the pipeline?

Edit: I've also mostly forgot how the unit test looks, so some of this may actually be done already.

gersmann commented 2 years ago

https://github.com/microsoft/pyright/issues/3238

gersmann commented 2 years ago

So the pyright team confirmed, their offsets are 'zero-based', which means that we should be able to safely increase those by offset 1.

jordemort commented 2 years ago

Fixed in https://github.com/jordemort/action-pyright/pull/26