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

coverlet-coverage give much higher Cyclomatic Complexity score for given Method then Visual Studio 2022 Code Metrics Results #1554

Open
wzaieddev opened this issue Nov 14, 2023 · 2 comments
Labels
question This issue is a question stale

Comments

@wzaieddev
Copy link

wzaieddev commented Nov 14, 2023

Hi,
I'm Trying to generate coverage report, and i get much higher Cyclomatic Complexity score then Visual Studio 2022 Code Metrics Results
Method Cyclomatic Complexity score | coverage.cobertura.report ==> 36
Method Cyclomatic Complexity score | Code Metrics Results ==> 19

what is the most reliable value that could i adopt ?

PS: I don't know if it might be relevant or not, with SonarQube i get 19, the same value as Code Metrics Results

Please find below some technical details:

Please find below some technical details:

NET 6
Xunit
coverlet.collector => 6.0.0
coverlet.msbuild => 6.0.0
coverage report format => cobertura
Attachment:
coverage.cobertura.report -> cobertura report
Method-SavePaymentNotifyAsync -> Method source code , method name: SavePaymentNotifyAsync
Code_Metrics_Results.PNG -> Visual studio screen

Code_Metrics_Results

coverage.cobertura.report.txt

Method-SavePaymentNotifyAsync.txt

@github-actions github-actions bot added the untriaged To be investigated label Nov 14, 2023
@Bertk Bertk added question This issue is a question and removed untriaged To be investigated labels Dec 5, 2023
@Bertk
Copy link
Collaborator

Bertk commented Dec 5, 2023

Hi, thank you for this information.

Could you please create a coverage report using ReportGenerator and compare the numbers.

The coverage.cobertura.report.txt has 3 elements for method Method-SavePaymentNotifyAsync and the Cyclomatic Complexity score 18 from class OrdersService is close to the screen shot .

<class name="Vittoria.PaymentGateway.Services.Orders.OrdersService/&lt;SavePaymentNotifyAsync&gt;d__10" filename="Services\PaymentGateway.Services\Orders\OrdersService.cs" line-rate="0.5555" branch-rate="0.6111" complexity="18"/>
   
<class name="Vittoria.PaymentGateway.Services.CreditCard.CreditCardService/&lt;SavePaymentNotifyAsync&gt;d__12" filename="Services\PaymentGateway.Services\CreditCard\CreditCardService.cs" line-rate="0.7719" branch-rate="0.6388" complexity="36" />

<class name="Vittoria.PaymentGateway.Services.ClepayMyBank.ClepayMyBankService/&lt;SavePaymentNotifyAsync&gt;d__13" filename="Services\PaymentGateway.Services\ClepayMyBank\ClepayMyBankService.cs" line-rate="0.6756" branch-rate="0.6666" complexity="6" />

By the way, I like the SonarQube cognitive complexity metric which is more useful than Cyclomatic Complexity see also Cyclomatic Complexity and Line Numbers.

We do not have the details for the Microsoft.CodeCoverage details but the coverlet implementation.

Please close the issue if you do not have further questions.

Copy link

This issue is stale because it has been open for 3 months with no activity.

@github-actions github-actions bot added the stale label Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This issue is a question stale
Projects
None yet
Development

No branches or pull requests

2 participants