question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Pylint Message Template

See original GitHub issue

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? 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
brettcannoncommented, Jul 31, 2019

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.

2reactions
Zuckmecommented, Jul 29, 2020

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pylint output - Pylint 2.16.0-dev documentation
Custom message formats#. You can customize the exact way information are displayed using the --msg-template=<format string> option. The format string ...
Read more >
How to change pylint message template in VS Code linter?
My goal is to change the pylint message template for the linter messages in VS Code. I'm using the standard "Python" extension for...
Read more >
Running Pylint — Pylint 1.5.0 documentation
Select output format (text, html, custom). --msg-template= <template>. Modifiy text output message template. --list-msgs, Generate pylint's messages.
Read more >
Using Pylint to Improve the Quality of Your Code - TurboGears
A working example of a model.py file that has been run through pylint, refactored and fitted with pylint special comments supressing messages that...
Read more >
External tools | PyCharm Documentation - JetBrains
For example, your workflow may require running a specific script, ... to the files with errors into the pylint output, so you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found