Skip to content

Improve JSON output format with score #4741

@angristan

Description

@angristan

Is your feature request related to a problem? Please describe

I want to consume this programmatically, but the format make it difficult since the JSON array will contain different types of objects:

[
    {
        "type": "convention",
        "module": "fib",
        "obj": "",
        "line": 1,
        "column": 0,
        "path": "fib.py",
        "symbol": "missing-module-docstring",
        "message": "Missing module docstring",
        "message-id": "C0114"
    },
    {
        "score": "Your code has been rated at 3.33/10"
    }
]

Describe the solution you'd like

Something like this would be better:

{
    "score": 0.333,
    "violations": [
        {
            "type": "convention",
            "module": "fib",
            "obj": "",
            "line": 1,
            "column": 0,
            "path": "fib.py",
            "symbol": "missing-module-docstring",
            "message": "Missing module docstring",
            "message-id": "C0114"
        }
    ]
}

Additional context

The score in the JSON output was added in #3514 for version 3.0.0a0.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions