Getting error importing coverage file from sfdx force:source:deploy into SonarCloud

Hey there.

SonarCloud is expecting a report like this:

[
    {
      "id": "01q3E0000007bgVQAQ",
      "name": "AccountDeletion",
      "totalLines": 4,
      "lines": {
        "4": 1,
        "6": 1,
        "7": 1,
        "8": 1
      },
      "totalCovered": 4,
      "coveredPercent": 100
    },
    {
        "id": "01p3E000001QAadQAG",
        "name": "ClassB",
        "totalLines": 12,
        "lines": {
            "1": 1,
            "2": 1,
            "3": 3,
            "4": 1,
            "5": 0,
            "6": 0,
            "10": 5,
            "11": 1,
            "14": 1,
            "15": 1,
            "16": 0,
            "18": 1
        },
        "totalCovered": 9,
        "coveredPercent": 75
    }
]

So I’m not sure… what your coverage report is made up of. As the docs mention:

sonar.apex.coverage.reportPath

Path to the test-result-codecoverage.json report file generated by the apex:test:run command of the Salesforce CLI. Note, you must have a Salesforce DX project set up and linked to your organization.

You might try this guide here (which uses sdfx force:apex:test:run rather than sfdx force:source:deploy.