Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET, Cobertura, Code Climate generates invalid results #458

Open
zedseven opened this issue Feb 6, 2021 · 2 comments
Open

.NET, Cobertura, Code Climate generates invalid results #458

zedseven opened this issue Feb 6, 2021 · 2 comments

Comments

@zedseven
Copy link

zedseven commented Feb 6, 2021

Hi, I recently decided to set up Code Climate for my repository, but I've been having a lot of issues.

I generate coverage reports with Coverlet, using the following command:

dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura RomanizationTests/RomanizationTests.csproj

This creates RomanizationTests/coverage.cobertura.xml. As far as I can tell this file is without issue, and correct.
I then process it with the following:

./cc-test-reporter format-coverage --input-type cobertura --output RomanizationTests/codeclimate.json RomanizationTests/coverage.cobertura.xml
./cc-test-reporter upload-coverage --input RomanizationTests/codeclimate.json

The file is successfully uploaded to Code Climate, but I get the following error:
image
With the full error:

{
  "message": "Invalid path part \"/\"",
  "file_document": "{
    \"_id\"=>BSON::ObjectId('601f0378f8aa324544001911'),
    \"type\"=>\"test_file_reports\",
    \"blob_id\"=>\"ef8306fb90e8f744279ee7f4df8eece02ff9d4d5\",
    \"coverage\"=>\"[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,3,3,null,null,null,null,3,3,67749,79047,3,null,null,null,null,null,null,null,null,null,null,null,0,0,null,null,null,null,null,null,null,null,null,null,16,56,null,null,null,null,null,null,null,null,null,null,null,2,2,2,2,null,null,null,null,null,null,null,null,null,null,null,19,19,53,53,19,53,136,53,119,19,53,53,19,null,null,null,null,null,null,null,null,null,null,19]\",
    \"covered_percent\"=>90,
    \"covered_strength\"=>4919.266666666666,
    \"line_counts\"=>{
      \"missed\"=>3,
      \"covered\"=>27,
      \"total\"=>30
    },
    \"path\"=>\"Romanization//Languages/Japanese/KanjiReadings.cs\",
    \"test_report_id\"=>BSON::ObjectId('601f0378c4082a440f001a32')
  }"
}

The issue is clearly with the double / in the path, but it makes no sense. Romanization/Languages/Japanese/KanjiReadings.cs is about halfway through the file list, and there are way more files than just it in the repo.

Am I missing something obvious, or is this a known issue?

For reference

@zedseven
Copy link
Author

zedseven commented Feb 7, 2021

I just tried it using the lcov format instead of cobertura, and the test seems to be valid.
This seems to be an issue with the Cobertura format in some regard.

@filipesperandio
Copy link
Contributor

@efueger Is this on our radar already?

@filipesperandio filipesperandio removed their assignment Apr 30, 2021
nachtjasmin added a commit to anexia/dotnet-e5e that referenced this issue Mar 14, 2024
Even though the Code Coverage report is correct and other platforms like
GitLab do not have a problem understanding it, the CodeClimate reporter
struggles with double slashes that seem to be introduced by itself.

This is also tracked in an issue, which is open since three years with
no intent of fixing it. Therefore, I assume this is not going to be
closed soon.

codeclimate/test-reporter#458

As a workaround, we're now using the lcov format.
nachtjasmin added a commit to anexia/dotnet-e5e that referenced this issue Mar 14, 2024
Even though the Code Coverage report is correct and other platforms like
GitLab do not have a problem understanding it, the CodeClimate reporter
struggles with double slashes that seem to be introduced by itself.

This is also tracked in an issue, which is open since three years with
no intent of fixing it. Therefore, I assume this is not going to be
closed soon.

codeclimate/test-reporter#458

As a workaround, we're now using the lcov format.
beachmachine pushed a commit to anexia/dotnet-e5e that referenced this issue Mar 14, 2024
Even though the Code Coverage report is correct and other platforms like
GitLab do not have a problem understanding it, the CodeClimate reporter
struggles with double slashes that seem to be introduced by itself.

This is also tracked in an issue, which is open since three years with
no intent of fixing it. Therefore, I assume this is not going to be
closed soon.

codeclimate/test-reporter#458

As a workaround, we're now using the lcov format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants