Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove module lines in "text" and "parseable" reporter #5362

Closed
cykerway opened this issue Nov 22, 2021 · 8 comments · Fixed by #7869
Closed

Remove module lines in "text" and "parseable" reporter #5362

cykerway opened this issue Nov 22, 2021 · 8 comments · Fixed by #7869
Labels
Command line Related to command line interface Configuration Related to configuration Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors Hacktoberfest Help wanted 🙏 Outside help would be appreciated, good for new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@cykerway
Copy link

cykerway commented Nov 22, 2021

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

@cykerway cykerway changed the title Remove module lines in text reporter Remove module lines in "text" reporter Nov 22, 2021
@cykerway cykerway changed the title Remove module lines in "text" reporter Remove module lines in "text" and "parseable" reporter Nov 22, 2021
@Pierre-Sassoulas
Copy link
Member

There are multiple easily parseable outputs , we're not going to make a breaking change to the output without a really good reason.

@Pierre-Sassoulas Pierre-Sassoulas added the Invalid Not a bug, already exists or already fixed label Nov 22, 2021
@cykerway
Copy link
Author

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?

@Pierre-Sassoulas
Copy link
Member

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

@cykerway
Copy link
Author

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 Pierre-Sassoulas added Enhancement ✨ Improvement to a component Command line Related to command line interface Configuration Related to configuration and removed Invalid Not a bug, already exists or already fixed labels Nov 22, 2021
@Pierre-Sassoulas Pierre-Sassoulas added Help wanted 🙏 Outside help would be appreciated, good for new contributors Good first issue Friendly and approachable by new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation labels Jul 4, 2022
@clavedeluna
Copy link
Contributor

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

@Pierre-Sassoulas
Copy link
Member

I think it's possible to add an option to remove the intraline without touching the default and witohut breaking changes.

@clavedeluna
Copy link
Contributor

clavedeluna commented Nov 24, 2022

@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}")

@Pierre-Sassoulas
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command line Related to command line interface Configuration Related to configuration Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors Hacktoberfest Help wanted 🙏 Outside help would be appreciated, good for new contributors Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants