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

Multiple output-format support #4492

Merged
merged 14 commits into from
May 24, 2021
Merged

Multiple output-format support #4492

merged 14 commits into from
May 24, 2021

Conversation

RuRo
Copy link
Contributor

@RuRo RuRo commented May 23, 2021

Steps

  • Add yourself to CONTRIBUTORS if you are a new contributor.
  • Add a ChangeLog entry describing what your PR does.
  • If it's a new feature or an important bug fix, add a What's New entry in doc/whatsnew/<current release.rst>.
  • Write a good description on what the PR does.

Description

This PR allows users to specify more than one output format by passing a comma-separated list output-format like this:

--output-format=text,json

You can also set the output file for each output format by specifying it after a colon like this:

--output-format=text:path/to/pylint-report.txt,json:different/path/to/pylint-report.json

Without the :path part, the default is to output to stdout.

Type of Changes

Type
✨ New feature

Related Issue

Closes #1798

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this merge request. I made some comment to address before merging but I also think we'll need more tests than that, I did not check in detail but I don't think a lot of test cases are tested right now.

pylint/lint/pylinter.py Outdated Show resolved Hide resolved
tests/unittest_reporting.py Outdated Show resolved Hide resolved
tests/unittest_reporting.py Outdated Show resolved Hide resolved
tests/unittest_reporting.py Outdated Show resolved Hide resolved
@Pierre-Sassoulas Pierre-Sassoulas added the Enhancement ✨ Improvement to a component label May 23, 2021
@coveralls
Copy link

coveralls commented May 23, 2021

Coverage Status

Coverage increased (+0.08%) to 91.803% when pulling 399d0d3 on RuRo:feature/multi-output-formats into 5ebbc30 on PyCQA:master.

@RuRo
Copy link
Contributor Author

RuRo commented May 23, 2021

@Pierre-Sassoulas done, I think. Regarding type hints, I've tried my best, but I may need some help with the following:

  • I can't annotate the linter property on MultiReporter, because attempting to import pylint/lint/pylinter.py in pylint/reporters/multi_reporter.py leads to circular import errors. I've annotated it with PyLinter = Any for now.
  • I don't know the properly parametrized types of stats and previous_stats arguments of MultiReporter.on_close. They seem to be dicts of some kind, so I've annotated them as Mapping[Any, Any] for now.

@RuRo
Copy link
Contributor Author

RuRo commented May 23, 2021

I also think we'll need more tests than that, I did not check in detail but I don't think a lot of test cases are tested right now.

Well, there weren't a lot of tests for output-format in the first place.
Feel free to suggest any additional tests that you would like me to write.

@RuRo
Copy link
Contributor Author

RuRo commented May 24, 2021

@Pierre-Sassoulas I think I've addressed all the requested changes and all the checks pass now.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this new option and for adding tests in what was not previously covered. Congratulation on becoming a pylint contributor :)

@RuRo
Copy link
Contributor Author

RuRo commented May 24, 2021

Btw, while I have your attention. Do you know, what will the next pylint version be (2.9 or 3.0) and when can we expect its release? The ChangeLogs say 2.9, but PyPI already has some alpha 3.0.0 releases.

@Pierre-Sassoulas
Copy link
Member

Pylint 2.9.0 will release very soon (after astroid 2.5.7), pylint 3.0.0alpha is a version including breaking changes (See #3504) that is not going out of alpha before a long time, 3.0.0a4 will release at the same time than 2.9.0.

@Pierre-Sassoulas Pierre-Sassoulas merged commit 18669a4 into pylint-dev:master May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow parseable output in parallel of human-readable output
3 participants