Skip to content
This repository was archived by the owner on Nov 15, 2021. It is now read-only.

CRAP score feature #620

Closed
TraGicCode opened this issue Aug 13, 2016 · 14 comments · Fixed by #625
Closed

CRAP score feature #620

TraGicCode opened this issue Aug 13, 2016 · 14 comments · Fixed by #625

Comments

@TraGicCode
Copy link
Contributor

Any thoughts on implementing the calculation of CRAP (Change Risk Anti-Patterns) metric? I think this would be helpful especially since the data needed for this calculation is already provided by Open Cover.

@sawilde
Copy link
Member

sawilde commented Aug 14, 2016

Are you on about this metric?

crap(m) = comp(m)^2 * (1-cov(m)/100)^3 + comp(m)

Never thought of it; the comp(m) shown by OpenCover is actually at the IL level not source code.

What is it's value?

@TraGicCode
Copy link
Contributor Author

The CRAP metric is a great metric to be used along with code coverage since.

Generally speaking, Crappy methods exhibit the following characteristics
1.) High Cyclomatic complexity
2.) Low code coverage

Its usually challenging to write tests for complex code. Therefore code without tests are signs of crappy code ( hence lack of code coverage ). Having some code coverage indicates some degree of thought about testability and implementation.

The value of this metric is to help mitigate/reduce risk by uncovering the possible presence of crappy code. The code can
1.) Have Tests added
2.) Be refactored ( preferable )

The common practices is a CRAP score of 30 or less is considered acceptable and generally anything higher should be looked at. This is really a team decision on this threshold.

@sawilde
Copy link
Member

sawilde commented Aug 14, 2016

The common practices is a CRAP score of 30 or less is considered acceptable and generally anything higher should be looked at. This is really a team decision on this threshold.

Okay I can see how it can be useful - once done we'll need to work with @danielpalme to see if we can get a visualisation of this data in his awesome reporting tool.

@danielpalme
Copy link
Contributor

I created an issue for ReportGenerator:
danielpalme/ReportGenerator#57

Just let me know when you are done,

@TraGicCode
Copy link
Contributor Author

@danielpalme done.

@danielpalme
Copy link
Contributor

danielpalme commented Aug 29, 2016

@TraGicCode
Great.

You could try this beta release: https://www.nuget.org/packages/ReportGenerator/2.4.6-beta4
Does it work for you?

@TraGicCode
Copy link
Contributor Author

is working for me and looks good!
👍

@TraGicCode
Copy link
Contributor Author

What are the next steps taken in order for this to make it to the next release?

@sawilde
Copy link
Member

sawilde commented Aug 30, 2016

I leave them pending so I can update the release notes

@TraGicCode
Copy link
Contributor Author

Any estimate on when the next release might be?

@sawilde
Copy link
Member

sawilde commented Dec 29, 2016

nope - sorry - still waiting on the mono.cecil dependancy.

@sawilde sawilde modified the milestones: Release (Qn 2017), Release (Qn 2016) Apr 15, 2017
@sawilde sawilde closed this as completed Apr 16, 2017
@akamud
Copy link

akamud commented Aug 17, 2017

Any update on this? I am using version OpenCover.4.6.519 but I guess this is not available yet.

@sawilde
Copy link
Member

sawilde commented Aug 19, 2017

@akamud sorry not had a lot of time of late to work on a release - I've been waiting on another package but it seems to never want to release - I may look to make a beta release that uses the beta package I am dependant on but I am reluctant to create a release as of yet.

@akamud
Copy link

akamud commented Aug 19, 2017

I understand, no need to rush, I guess.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants