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

--quiet option conflicts with --format plugins #644

Closed
asottile opened this issue Apr 3, 2021 · 2 comments
Closed

--quiet option conflicts with --format plugins #644

asottile opened this issue Apr 3, 2021 · 2 comments

Comments

@asottile
Copy link
Member

asottile commented Apr 3, 2021

In GitLab by @lordmauve on Feb 5, 2018, 11:29

Issue

Users of flake8-html, a HTML report plugin for flake8, reported that passing the --quiet option to flake8 causes it not to generate the expected HTML output. This is flake8-html issue #9.

flake8-html is invoked as a report plugin for flake8. For example, a command-line might be

flake8 --format=html --htmldir=flake8-report/

Because this produces HTML output containing full details, it produces much more terse console output such as

./demo_game.py has issues: high: 26 medium: 1
./doc/conf.py has issues: medium: 1

Users are expecting that they can suppress this output, while receiving HTML reports, by writing command-lines such as

flake8 --format=html --htmldir=flake8-report/ --quiet

However, no HTML reports are written in this case.

Version

I confirmed this as of flake8==3.5.0.

Root cause

From investigating the source code for flake8, I believe the issue is that the --quiet option overrides the --format parameter in Application.make_formatter().

When --quiet is passed, --format is ignored.

Possible solutions

  1. It would avoid user confusion if passing both --quiet and --format parameters exited with an error. This would make it clear to users that this combination is not currently supported, but it doesn't achieve what users were trying to achieve by using --format=html with --quiet.
  2. The handling of the '--quiet'/'-q'/'-qq' etc could be delegated to the formatter. This could be done in a backwards-compatible way so that plugins that the existing behaviour is preserved for plugins that do not implement this, or in such a way that passing --quiet when the selected report plugin does not support it produces an error.
@asottile
Copy link
Member Author

asottile commented Apr 3, 2021

In GitLab by @sigmavirus24 on Oct 20, 2018, 10:13

I'd be interested to see a merge request for the second suggested solution. I think that may be the best way to handle this but I'm struggling to see a way that preserves backwards compatibility.

@asottile
Copy link
Member Author

let's continue the discussion in #1458 which covers this same situation but also with --benchmark and --statistics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant