pylint
pylint copied to clipboard
Remove module lines in "text" and "parseable" reporter
Any chance we can have an option to remove these module lines from "text" reporter? They are annoying when parsing the messages and require an extra step of filtering. This is also true for the "parseable" reporter. At least make this option available in the "parseable" reporter?
https://github.com/PyCQA/pylint/blob/d29bcf68393b6a1654aa6cd3d5351ed63edb42ad/pylint/reporters/text.py#L198
There are multiple easily parseable outputs , we're not going to make a breaking change to the output without a really good reason.
There aren't "multiple" easily parseable outputs. The only one I've found easily parseable is the json
reporter, which still isn't very easily with command line tools.
However, I found the "parseable" format is going to be deprecated:
https://github.com/PyCQA/pylint/blob/d29bcf68393b6a1654aa6cd3d5351ed63edb42ad/pylint/reporters/text.py#L222
It'd be very easy to keep it useful by overwriting handle_message
like:
def handle_message(self, msg: Message) -> None:
"""manage message of different type and in the context of path"""
self.write_message(msg)
Is that by intention that pylint output is going be parsed in json anyway?
Is that by intention that pylint output is going be parsed in json anyway?
pylint is already very configurable. Did you try to specify the output you want with --msg-template
?
--msg-template=<template>
Template used to display messages. This is a python
new-style format string used to format the message
information. See doc for all details.
https://pylint.pycqa.org/en/latest/user_guide/output.html#custom-message-formats
Yes, I know this intra-line formatting is very configurable (and works great), but what I'm asking here is about inter-line formatting. Those extra *************
markers are annoying when parsing pylint output using line-based command line tools. So what I'm doing now is writing:
pylint ... | grep -v '\*\*\*\*\*\*\*\*\*\*\*\*\*'
As you can see this is awkward. If you omit those markers we can save the grep
. Given that you are deprecating parseable
, maybe keeping it for such use is a better idea.
@Pierre-Sassoulas is this a very breakable change that we want to wait for 3.0 or are we good to do it now / anytime?
I think it's possible to add an option to remove the intraline without touching the default and witohut breaking changes.
@Pierre-Sassoulas what's the right way to add a new configuration options, such as --no-header
? I'm looking thru the code and it's confusing, probably because it's streamlined. Is it to add this option to base_options.py? Somewhere else?
Basically so I can do
if not self.linter.config.no_header:
self.writeln(f"************* Module {msg.module}")
You can check _make_run_options
in pylint.lint.base_options.py
, there's pre-processing of some options elsewhere, but I don't think we need pre-processing for this one.