Skip to content

Commit

Permalink
Update the help text for the Pylint descriptor
Browse files Browse the repository at this point in the history
The `msg-template` setting only works in the pylintrc configuration file
if it is under the `[REPORTS]` section header [0]. Otherwise the setting
gets ignored:
```
$ cat ./pylintrc
msg-template={path}:{module}:{line}: [{msg_id}({symbol}), {obj}] {msg}
$ pylint --rcfile=./pylintrc test.py
************* Module pylintrc
pylintrc:1:0: F0011: error while parsing the configuration: File contains no section headers.
file: 'pylintrc', line: 1
'msg-template={path}:{module}:{line}: [{msg_id}({symbol}), {obj}] {msg}\n' (config-parse-error)
[...]
```

Using the `--msg-template` CLI option is more convenient for the usage
inside Jenkins pipelines.

[0]: https://github.com/pylint-dev/pylint/blob/v2.17.4/examples/pylintrc#L481
  • Loading branch information
primeos-work committed Jul 20, 2023
1 parent ede6ea0 commit 666a98a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions SUPPORTED-FORMATS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--- DO NOT EDIT -- Generated at 2023-05-05T12:05:52.316441 - Run the `main` method of `ParserRegistry` to regenerate after changing parsers -- DO NOT EDIT --->
<!--- DO NOT EDIT -- Generated at 2023-07-20T18:42:19.715720048 - Run the `main` method of `ParserRegistry` to regenerate after changing parsers -- DO NOT EDIT --->
# Supported Report Formats

The static analysis model supports the following report formats.
Expand Down Expand Up @@ -1665,7 +1665,7 @@ analyze - iccxxxxcompiler_opts cstat2.c</pre></code>For details check the IAR C-
</tr>
<tr>
<td colspan="4">
:bulb: <p>Create a./pylintrc that contains:<p><code>msg-template={path}:{module}:{line}: [{msg_id}({symbol}), {obj}] {msg}</code></p></p><p>Start pylint using the command:<p><code>pylint --rcfile=./pylintrc CODE > pylint.log</code></p></p>
:bulb: <p>Start Pylint using this custom message template (can also be configured via a pylintrc configuration file):<p><code>pylint --msg-template='{path}:{line}: [{msg_id}, {obj}] {msg} ({symbol})' modules_or_packages > pylint.log</code></p></p>
</td>
</tr>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ public IssueParser createParser(final Option... options) {

@Override
public String getHelp() {
return "<p>Create a ./pylintrc that contains:"
+ "<p><code>msg-template={path}:{module}:{line}: [{msg_id}({symbol}), {obj}] {msg}</code></p>"
+ "</p>"
+ "<p>Start pylint using the command:"
+ "<p><code>pylint --rcfile=./pylintrc CODE > pylint.log</code></p>"
return "<p>Start Pylint using this custom message template (can also be configured via a pylintrc configuration file):"
+ "<p><code>pylint --msg-template='{path}:{line}: [{msg_id}, {obj}] {msg} ({symbol})' modules_or_packages > pylint.log</code></p>"
+ "</p>";
}

Expand Down

0 comments on commit 666a98a

Please sign in to comment.