feat(HIS): add COMF his metric - #77
Conversation
be420a9 to
c3679fc
Compare
c1452fe to
4a2edbb
Compare
Signed-off-by: Afonso Santos <afomms@gmail.com>
Signed-off-by: Afonso Santos <afomms@gmail.com>
da904be to
93d77c1
Compare
Signed-off-by: Afonso Santos <afomms@gmail.com>
93d77c1 to
6a8f110
Compare
|
Updated with the modifications introduced in #68 and changed the output format. @miguelafsilva5 @josecm |
|
I don't know if I'm doing anyhing wrong, but this checker seems to be ignoring inline comments. For example: |
That's actually a good point that I didn't take into account. From my analysis, neither pygount, slocount, cloc, tokei, analyzo, or cocnt count inline comments, which is a problem. They consider those lines as a source code line. |
This PR introduces the feature of checking the comment density within a file.
A file must have a minimum comment density of 0.2.
Two tools are used in this checker. The
pmccabecounts the number of statements and thepygountcounts the number of comments.According to the HIS metrics, the comment density is given by the relationship between the number of comments (outside of and within functions) to the number of statements.
So the density is calculated by dividing the total comments (in the file) by the total number of statements (in the file).
As the comments tool also counts the license comments, I have created a variable
license_comment_sizeto remove these comments from the density metric.Edited by @danielRep :
To test with https://github.com/bao-project/bao-his-tests just run the command
make ci METRIC=comf.Checklist: