PyCQA / PyCQA/flake8

`--benchmark` / `--statistics` don't play well with custom formatters or `--quiet`

Open
#1,458 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.8k
Forks
356
PR merge metrics
No merged PRs in 30d

Description

while moving things around, I noticed that these options don't play nicely with formatters

for example:

$ flake8 --quiet --quiet t.py --statistics
1     F401 'os' imported but unused
$ flake8 --format=json --benchmark t.py; echo
{"t.py": [{"code": "F401", "filename": "t.py", "line_number": 1, "column_number": 1, "text": "'os' imported but unused", "physical_line": "import os\n"}]0.00914    seconds elapsed1          total logical lines processed109        logical lines processed per second1          total physical lines processed109        physical lines processed per second3          total tokens processed328        tokens processed per second1          total files processed109        files processed per second}

I think ideally the following happens: statistics / benchmarks are moved from the base formatter to the default formatter and are noops otherwise

perhaps even removing statistics / benchmark if they're not deemed useful enough

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two examples with --quiet, --statistics, --format=json, and --benchmark, then trace how statistics and benchmark output are handled by formatters. Done means custom formatter output remains valid, --quiet behaves consistently, and the default formatter still provides statistics and benchmark results if they are retained.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.