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

Measure the density of violations by dividing the number of violations by the size of the code base #5128

Open
Tracked by #4959
fniessink opened this issue Dec 28, 2022 · 2 comments
Labels
Metric(s) New, enhanced, or removed metric

Comments

@fniessink
Copy link
Member

fniessink commented Dec 28, 2022

For example, 100 violations / 100.000 LOC = 1 violation / KLOC.

Limit this to SonarQube as source. The tool "Cloc" is out of scope.

Add a density scale to the violations metric: "Density ({metric.entities} per 1000 lines of code)"

Copy the "lines to count" parameter from Size metric to the violations metric so the user can use the same line count for both the size and the violation density.

Tasks:

  • Update meta model by adding a density scale
  • Update data model
  • Update collector to deal with the new parameter
  • Update changelog
  • Add a note to the documentation to warn the user that violations can happen in comments too (most notably commented-out code). If the user picks "lines with code" for the "lines to count" parameter this means the numerator of the metric may contain violations present in comments while the de monitor only counts lines without comments.
@fniessink fniessink changed the title Measure the density of violations by dividing the number of violations by the size of the code base. For example, 100 violations / 100.000 LOC = 1 violation / KLOC. Measure the density of violations by dividing the number of violations by the size of the code base Dec 28, 2022
@fniessink fniessink added the Metric(s) New, enhanced, or removed metric label Dec 28, 2022
@wkoot wkoot self-assigned this Apr 13, 2023
@wkoot
Copy link
Contributor

wkoot commented Apr 14, 2023

Implementing this as refined does not seem to be compatible with the current concept of measurements.
We run into the problem that the metric measurement "violation density" is not actually the same as "violations".
Currently there is also no proper way to add a descriptive label such as "Violation per kLOC" to the graph area.

Conceptually, we want to know something about violations only (not LOC). Just in a relative sense instead of absolute.
It might be a solution to implement a unit switch, in a similar manner as switching between scales.
Alternatively, the best way to implement this at the moment would be as a new "violation density" metric.
Or... reconsider implementing the compound metrics :-)

@wkoot wkoot removed their assignment Apr 19, 2023
@fniessink
Copy link
Member Author

fniessink commented Jul 6, 2023

Implementing this as refined does not seem to be compatible with the current concept of measurements. We run into the problem that the metric measurement "violation density" is not actually the same as "violations". Currently there is also no proper way to add a descriptive label such as "Violation per kLOC" to the graph area.

Conceptually, we want to know something about violations only (not LOC). Just in a relative sense instead of absolute. It might be a solution to implement a unit switch, in a similar manner as switching between scales. Alternatively, the best way to implement this at the moment would be as a new "violation density" metric. Or... reconsider implementing the compound metrics :-)

Adding a "density" scale should address these concerns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Metric(s) New, enhanced, or removed metric
Projects
Status: Ready
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants