-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Include end column / range in message output #5336
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
Comments
/CC: @Pierre-Sassoulas @DanielNoord This has come up recently with the last |
Can we use I'm not sure what |
That's what I was thinking |
I would say only one char as it minimize visual disturbance when we don't know exactly ? There will be a lot of case where a full line would make more sense but it's hard to guess. We'd have to think about it for each message, right ? |
@cdce8p Are you working on this? If not I can start the process of adding |
@DanielNoord I've started working on the astroid side. Hope to have a first draft ready tomorrow. Would you like to take a look at the pylint side? Expect |
Opened pylint-dev/astroid#1258. In theory that should already work for most nodes. Haven't tested it yet. The change got a bit larger than I expected initially. I somehow though that |
Depends on the number of issue we face when integrating. How doable is this before vscode pylint releases ? Also, is the vscode team ready to integrate pylint 2.12 at the last minute ? If there's little chance to make it in vscode in time then I'd say we push it to 2.13. The decision will probably be easier to take once pylint-dev/astroid#1258 is pylint tested (or pylint failed). |
I willl start looking into it today! |
@Pierre-Sassoulas did you, by any chance, ever figure out how to update all functional test with the Edit: Found it! If we want, it is available on |
😱 You never used that before ? Did you upgrade everything by hand ? (I figured it existed before doing #4004) |
Luckily I used it before, but some |
Ho, I understand now. I would have removed all the |
I think we should do that anyway. As far as I know it is not a breaking change as this is only part of our own test validation. |
Not exactly as testutil could be used by pylint plugin developers. But it's a small breaking change as the fix is easy : You only have to update the expected output with the update command . Thoughts ?
I think it make more sense to change everything at once as we need to upgrade for the column anyway to minimize conflicts when rebasing . We'll have to enforce rebasing after that change before merging to master or it will break master. One conflict vs 2 will save a lot of time when factoring all the branches and all the contributors. (It would also have been automatic as the output would not be correct anymore, but you already did the research and the work to upgrade without changes :) |
Yeah, personally I think this can go in a minor release.
The thing is that the validator is currently not completely straightforward, as it needs to allow both |
I agree, could we do both change in a single MR in order to be able to squash later and have only one actual conflict during rebase later ? (I mean we can review each commits during the MR review) |
Just out of curiosity: would we ever consider making this a breaking change and go to We could sort out a number of issues:
Furthermore we could implement this more easily and with more consistency:
It would also make the final product offered to I know we tend to not do major versions too often, but I think the improved consistency in output returned to IDEs might be something worth considering. |
Disclaimer: I haven't followed the recent discussion closely. IMO it's better to return Form what I've seen while working on my PR, every node that doesn't have it's |
Now that you say it it seems like if we do not make a major for adding line end / column end to the output we would hardly ever do a major. This change the way pylint's output will be consumed (unless I'm mistaken ?). There's a lot of thing to consider if we must release 3.0 in particular there's some other blocker on the json output and a lot of project management to update and keep consistent. Then integrator needs to update the way they use pylint (clearly it indicate a breaking change unless we add an option do get the new output). Even without taking into account the change to end line end column itself, I don't think we can do that in time for a vscode integration this week end. |
I've only taken a very quick look at the regex @cdce8p mentioned for I believe it is: I think we can't avoid to make them (or us with a PR) change how they interpret the output. To me it makes no sense to put They are making this regex themselves btw a couple lines below with:
Based on this pattern we would be fine if we would use My suggestion would be to leave |
My proposal was only to allow the output of
A new release is usually in the first week of a month. So 1,5 - 2 weeks from now. If we manage to get a new release out before then, I think I would be able to update
Yeah, the
That might work. |
Making To something like: def write_message(self, msg: Message) -> None:
"""Convenience method to write a formatted message with class default template"""
self_dict = msg._asdict()
for key, value in self_dict.items():
if value is None:
self_dict[key] = ""
self.writeln(self._template.format(**self_dict)) |
My PR for vscode-python has been merged yesterday. Unfortunately, we just missed the release this month and due to the holidays there won't be one in January 😞 If someone would like to try it earlier though, it is included in the latest insider release. Just add this to your VS Code config "python.insidersChannel": "daily" |
Ho, that's too bad ! It's still merged though which is very good. By the way I did not know you were also fluent in typescript, impressive ! 😄 |
With #5383 I think we have finished all that needs to be done for this issue on our side? |
The next step would probably to check existing messages, but that can be a gradual process. There is also #5466 which ultimately needs some astroid love. Although a temporary fix in pylint is probably better for the moment. I've change the milestone to |
Current problem
At the moment,
pylint
only include a column offset in the output. That works find for command line or CI uses but doesn't work too well in IDEs. They depend on us to output an error range so they can effectively highlight the issue.microsoft/vscode-python#18027
Desired solution
We already have node information for most / all (?) errors. Those include end column information. It should be fairly strait forward to add a new formatting option to the pylint output.
A Todo list:
end_line
andend_column
#5372end_line
andend_column
#5372node
location attributes in unittests #5383node
location attributes in unittests #5383node
location attributes in unittests #5383end_line
andend_column
#5372Additional context
Maybe we can release a
beta
version first. With that IDEs and extensions could be updated and then it's up to us.For that first version we wouldn't need to update the existing tests. It should be enough to enable the output.
--
Side note: IMO, this should be completely optional. It doesn't make much sense to update the default output.
The text was updated successfully, but these errors were encountered: