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
Metric HOC #188
Metric HOC #188
Conversation
Fix regex to find necessary class
@IlnurHA thanks for your contribution, looks very good! Would be great to add a unit test for this new script, similar to existing tests that we have in |
@yegor256 I created test for hoc metric; please check |
@IlnurHA looks good now, but this metric is not "hits of code". Instead, we should call it "commits per file" (CPF). |
@yegor256. I think I explained not in the proper way. Metric increases for a specific class when the class is changed in the commit. Is it not that we are looking for? |
@IlnurHA "hits of code" metric is explained here: https://www.yegor256.com/2014/11/14/hits-of-code.html It's not a counter of changes. It's a counter of lines added and deleted. |
@yegor256 I changed calculation of hoc metric and, hopefully, it reflects HOC metric from the source |
metrics/hoc.sh
Outdated
hoc=0 | ||
fi | ||
|
||
echo "hoc ${class_name}:${hoc} Hits Of Code for given class" > "${output}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IlnurHA it should print hoc 123 Hits of Code ...
(this is how all other metrics print their output, so that it's parseable by steps/measure.sh
)
@yegor256 I changed the output of HOC script. Hopefully, it meets necessary requirements |
@yegor256 This PR is also awaiting approval for the workflows. |
@IlnurHA try to merge |
@yegor256 I merged. Please check it out |
metrics/hoc.sh
Outdated
hoc=0 | ||
fi | ||
|
||
echo "hoc ${hoc} Hits Of Code for ${class_name} class" > "${output}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IlnurHA no need to mention the name of the class here, see: https://github.com/yegor256/cam/blob/master/metrics/README.md
metrics/hoc.sh
Outdated
|
||
java=$1 | ||
output=$(realpath "$2") | ||
class_name=$3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IlnurHA the name of the class is not provided to this script: https://github.com/yegor256/cam/blob/master/metrics/README.md
@IlnurHA now it's clean! However, please see two minor comments above |
@yegor256 I did as you asked. Please check it |
@IlnurHA thanks a lot for your contribution! |
Added HOC metric (Hits of Code), which is the number of commits where the code of a specific class was changed in the git history.
Closes #127