Skip to content

Custom Pylint Message Template #6761

@EriKWDev

Description

@EriKWDev

Background

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? :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions