Skip to content

Add number of violations reported by Sonar to the stats output #678

@khesoem

Description

@khesoem

Currently, if Sorald does not fix any violations, we do not report the total number of violations. We can add an attribute to the json file to note how many violations are detected by Sonar.

For example, the following stats file does not show how many violations exist in the code:

{
    "repairs": [],
    "executionInfo": {
        "soraldVersion": "LOCAL",
        "javaVersion": "11.0.11",
        "originalArgs": [
            "repair",
            "--source",
            "zendesk-java-client",
            "--rule-key",
            "2272",
            "--stats-output-file",
            "output-2021-12-10-15-02-12/zendesk-java-client_2272_sorald_repair_stats.json"
        ]
    },
    "totalTimeMs": 24897,
    "repairTimeMs": 0,
    "startTimeMs": 1639149077672,
    "crashes": [],
    "endTimeMs": 1639149102569,
    "parseTimeMs": 0
}

Adding a sonarDetectedViolations at the root level should solve this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions