2

Anyone know how to show pylint message code in the problem section?

python linting example

It only shows descriptions, not the codes like F821 and E0601.

MEOWWWWWWWW
  • 175
  • 2
  • 9
  • Could you give us an example to explain your needs in detail? For "pylint" in VSCode, you can refer to: [Pylint in VSCode](https://code.visualstudio.com/docs/python/linting). – Jill Cheng Oct 29 '20 at 09:32
  • @JillCheng An example is added. The webpage has no information how to print the code... I just want to see codes, not the duplicated information, for use in argument – MEOWWWWWWWW Oct 30 '20 at 02:22

3 Answers3

0

type this command in vscode terminal

pylint FILENAME

0

Unfortunately, VS Code has hardcoded the pylint --msg-template argument as:

--msg-template='{line},{column},{category},{symbol}:{msg}'

and cannot be configured. You can view the VS Code source code for this.

For more info, see How to change pylint message template in VS Code linter?

wisbucky
  • 33,218
  • 10
  • 150
  • 101
-1

Pylint is a Python static code analysis tool that can find programming errors, help implement coding standards, and provide simple refactoring suggestions.

It usually does not display the code containing the error on the terminal, but displays the type and suggestion of the error, and displays the precise location of the error code in the terminal with numbers. (For example: [49,7], line 49, 7th)

For "print(jfile)", Pylint can only recognize that "jfile" is an undefined variable. The error here is that it needs to be defined.

For "jfile = "hello" print jfile ", Pylint will recognize that "jfile" is a string. The error here is that it needs to use "print(jfile)" to output using python3: ("pylint" will give code output suggestions here)

enter image description here

Jill Cheng
  • 9,179
  • 1
  • 20
  • 25
  • The OP is referring to the Pylint message codes (msg_id), not the source code. For example, the msg_id for `syntax-error` is `E0001`. It would be nice if VS Code displayed both the msg_id and msg symbol, like `(E0001: syntax-error)` – wisbucky Sep 03 '21 at 20:21