Custom Pylint Message Template
See original GitHub issueBackground
I came across this stackoverflow question concluding that vs-code overwrites the pylint message format. It opened #382. #382 wondered why this is and it’s because vs-code needs a specific format in order to parse information from pylint. This was addressed in #495 when the pylint message was changed to show the human-friendly version of the E/F/W/C/R code. While a discussion was held and a feature almost implemented allowing for a custom message format, the feature was never merged and, in the end, outdated and closed.
Feature
In the discussion, the general opinion came to be that an option for a custom message should be available to allow for more flexible workflow (/ compatible with already established workflows):
"python.linting.pylintMsgTemplate": {
"type": "string",
"description": "Controls the message template for linting results, as a new-style python format string. The provided value will be appended to '{line},{column},{category},', which is required by VSCode. The previous message format, using numeric message codes, can be restored by setting this to '{msg_id}:{msg}'. Available fields are described at https://pylint.readthedocs.io/en/latest/user_guide/output.html.",
"default": "{msg} ({symbol})",
"scope": "resource"
},
Where the message could then be customized ny the user in the settings.json like:
"python.linting.pylintMsgTemplate": "[{msg_id}] {msg} ({symbol})", // just an example...
The custom message (default: “{msg} ({symbol})”) would then be concatenated after the message required for vs-code to parse the pylint message, and the user would be happy to have more control over.
Discussion
While this is a minor feature, I believe it is in the spirit of vs-code being flexible and customizable. I was shocked when I found out a custom pylint-message was not already supported since I took it for granted already being implemented. I think the solution to this problem would be general enough to maybe allow for custom message-templates for the other linters as well. Any thoughts? 😃
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:8 (3 by maintainers)
Top GitHub Comments
Thank you for the suggestion! We have marked this issue as “needs decision” to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes your idea gets to help us make our decision.
Thanks @EriKWDev! I lost 6 hours to finally understand that “custom pylint-message was not already supported in vscode”. vscode is so close to perfection…
I am fighting against this one:
Module name "Checkin_Main" doesn't conform to snake_case naming style
and I can’t find the reason for it… unfortunately here no luck to find that “snake” message.I also tried this in setting.jason:
"python.linting.pylintArgs": ["--extension-pkg-whitelist=wx", "--msg-template={path}:{line}: [{msg_id}({symbol}), {obj} {msg}"]
but it does not work.So much was already done here, I hope they will work on this feature soon. thanks to all vs code developers, you guys rocks!