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

Feature Request: Consume SimpleCov and Use Results to Weigh Metrics #245

Closed
TreyE opened this issue Jul 26, 2017 · 6 comments
Closed

Feature Request: Consume SimpleCov and Use Results to Weigh Metrics #245

TreyE opened this issue Jul 26, 2017 · 6 comments

Comments

@TreyE
Copy link

TreyE commented Jul 26, 2017

It would be great if I could somehow also import simplecov results into rubycritic - and then as a result use those coverage values to help 'weigh' my metrics. Basically I want lack of test coverage to act as something that magnifies how 'bad' I consider the code to be.

A simple case would be:

  1. Prior to the application of the coverage metric, both classes A and B receive a the same rubycritic score
  2. Class A has full test coverage
  3. Class B has no test coverage
  4. Class A should either receive an improved rating or keep it's current rating.
  5. Class B should receive a far worse rating that it would have prior to the code coverage metric being factored.
@TreyE TreyE changed the title Consume SimpleCov and use results to weigh metrics Feature Request: Consume SimpleCov and Use Results to Weigh Metrics Jul 26, 2017
@nunosilva800
Copy link
Collaborator

@TreyE alright so the flow would be:

  • run your test suite(s) with codecov
  • run rubycritic passing in the codecov .resultset.json
    • for each examined file, look up the code coverage results for that file
    • assign a score based on it, which will affect the final rating

Although I don't think we should mix code quality with test coverage, perhaps this is useful for somebody.
Want to get started with a PR? :D

@gonzaloaune
Copy link

👍

@joshsaintjacque
Copy link
Contributor

@TreyE Is this something you're working on? If not, I'd love to make a PR.

@TreyE
Copy link
Author

TreyE commented Apr 18, 2018

Nope, nothing I've been working on - just something I hope somebody picks up.

etagwerker added a commit to fastruby/rubycritic that referenced this issue Oct 10, 2019
Analyser::Coverage will analyse test coverage based on a .resultset.json file.

We can assume that projects which are using SimpleCov will have a coverage folder with results. RubyCritic can use the results from that folder to provide a coverage section.

This will help us solve the problem described in whitesmith#245.

It also addresses an item in the ROADMAP.md file:

```
 Integrate other gems, like:

- Simplecov to provide code coverage
```

Analyser won't do anything if a .resultset.json is not present in the caller's coverage directory.
etagwerker added a commit to fastruby/rubycritic that referenced this issue Oct 10, 2019
It adds a new section to the HTML report: Coverage.

In that section RubyCritic will now list all the application files along with its test coverage information.

This change will be necessary to display the results calculated by Analyser::Coverage and it will help improve the situation for this issue: whitesmith#245
@etagwerker
Copy link
Collaborator

@Onumis @TreyE @joshsaintjacque I really like this idea. I like it so much that I submitted a PR for it: #319

I'd really like to know your feedback about those changes.

Coverage and quality data are not mixed nor combined. Coverage data now shows up in a new section.

There is no need to pass in the coverage folder or .resultset.json, the changes I propose use SimpleCov's configuration to find that file. 😸

etagwerker added a commit to fastruby/rubycritic that referenced this issue Oct 13, 2019
Analyser::Coverage will analyse test coverage based on a .resultset.json file.

We can assume that projects which are using SimpleCov will have a coverage folder with results. RubyCritic can use the results from that folder to provide a coverage section.

This will help us solve the problem described in whitesmith#245.

It also addresses an item in the ROADMAP.md file:

```
 Integrate other gems, like:

- Simplecov to provide code coverage
```

Analyser won't do anything if a .resultset.json is not present in the caller's coverage directory.
etagwerker added a commit to fastruby/rubycritic that referenced this issue Oct 13, 2019
It adds a new section to the HTML report: Coverage.

In that section RubyCritic will now list all the application files along with its test coverage information.

This change will be necessary to display the results calculated by Analyser::Coverage and it will help improve the situation for this issue: whitesmith#245
nunosilva800 pushed a commit that referenced this issue Oct 21, 2019
Analyser::Coverage will analyse test coverage based on a .resultset.json file.

We can assume that projects which are using SimpleCov will have a coverage folder with results. RubyCritic can use the results from that folder to provide a coverage section.

This will help us solve the problem described in #245.

It also addresses an item in the ROADMAP.md file:

```
 Integrate other gems, like:

- Simplecov to provide code coverage
```

Analyser won't do anything if a .resultset.json is not present in the caller's coverage directory.
nunosilva800 pushed a commit that referenced this issue Oct 21, 2019
It adds a new section to the HTML report: Coverage.

In that section RubyCritic will now list all the application files along with its test coverage information.

This change will be necessary to display the results calculated by Analyser::Coverage and it will help improve the situation for this issue: #245
@etagwerker
Copy link
Collaborator

In case you are interested in this feature, I recently release skunk which uses rubycritic and simplecov to calculate one metric called the "StinkScore"

I wrote a blog post about this: https://www.fastruby.io/blog/code-quality/intruducing-skunk-stink-score-calculator.html 😃

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

No branches or pull requests

5 participants