awelzel / flake8-gl-codeclimate

Flake8 formatter producing Gitlab Code Quality artifacts.
MIT License
25 stars 12 forks source link

Wrong json output format #21

Open mathieugouin opened 1 week ago

mathieugouin commented 1 week ago

Hello, thanks for this great addon!

I have seen a json report being generated as:

[
    {"type": "issue", "check_name": "unknown", "description": "camelcase 'xml.etree.ElementTree' imported as acronym 'ET' [N817]", "categories": ["Bug Risk"], "location": {"path": ".\\parsing.py", "lines": {"begin": 3, "end": 3}}, "fingerprint": "099bd931a790b68fc57194c5c1317675236110a9", "severity": "minor"},
    {"type": "issue", "check_name": "mccabe", "description": "'plot_schedule' is too complex (11) [C901]", "categories": ["Complexity"], "location": {"path": ".\\plot.py", "lines": {"begin": 128, "end": 128}}, "fingerprint": "7e22d50c6c523762291546de15d31129c29e7788", "severity": "minor"},
    {"type": "issue", "check_name": "pycodestyle", "description": "the backslash is redundant between brackets [E502]", "categories": ["Style"], "location": {"path": ".\\schedule_generator.py", "lines": {"begin": 120, "end": 120}}, "fingerprint": "e636c594a4485ded7f11ee33ced9131d2a25d262", "severity": "major"},
    {"type": "issue", "check_name": "pycodestyle", "description": "the backslash is redundant between brackets [E502]", "categories": ["Style"], "location": {"path": ".\\validation.py", "lines": {"begin": 18, "end": 18}}, "fingerprint": "937b28b08d5b2f77b5596167dbca83d937d8ba12", "severity": "major"}1     C901 'plot_schedule' is too complex (11)
2     E502 the backslash is redundant between brackets
1     N817 camelcase 'xml.etree.ElementTree' imported as acronym 'ET'

]

The command I use in my gitlab pipeline is:

python -m pip install --upgrade flake8 flake8-gl-codeclimate
python -m flake8 . --select=E9,F63,F7,F82
python -m flake8 . --exit-zero --format=gl-codeclimate --output-file=flake8-report.json

If it can influence, I have a .flake8 file as:

# Ref: https://flake8.pycqa.org/en/latest/user/configuration.html
#      https://flake8.pycqa.org/en/latest/user/options.html
[flake8]

max-complexity = 10
max-line-length = 120

exclude =
    .git
    example
    .ipynb_checkpoints
    .pytest_cache

statistics = True
count = True
show-source = True
mathieugouin commented 1 week ago

It turns out by removing:

statistics = True
count = True
show-source = True

in my .flake8, the report is now OK. Not sure which one caused it, but I'm ok without these settings. They were mostly useful for plain text output.

mathieugouin commented 1 day ago

I'll keep the issue open in case you want to investigate.