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

Per function metrics in detailed report shown as infinity #13

Closed
p2k-ko opened this issue Apr 3, 2017 · 1 comment
Closed

Per function metrics in detailed report shown as infinity #13

p2k-ko opened this issue Apr 3, 2017 · 1 comment

Comments

@p2k-ko
Copy link

p2k-ko commented Apr 3, 2017

The per function metrics in the detailed report of a module are shown as infinity.

cccc_htm_patch_01

This is due to the initialization of nof to zero in the cccc_html.cc file.

--- old/cccc_htm.cc	2017-04-03 09:16:56.993686941 +0200
+++ new/cccc_htm.cc	2017-04-03 09:56:09.030666528 +0200
@@ -1221,7 +1221,6 @@
 {
   // calculate the counts on which all displayed data will be based
   // int nof=module_ptr->member_table.records(); // Number of functions
-  int nof=0;
   int loc=module_ptr->get_count("LOC");  // lines of code
   int mvg=module_ptr->get_count("MVG");  // McCabes cyclomatic complexity
   int com=module_ptr->get_count("COM");  // lines of comment
@@ -1237,6 +1236,10 @@
   int noc=module_ptr->get_count("NOC");   // number of children
   int cbo=module_ptr->get_count("CBO");   // coupling between objects
 
+  // To calculate the per function metrics in the detailed report the
+  // number of functions is set to the weighted methods 
+  int nof=wmc1;
+
   fstr << "<TABLE BORDER WIDTH=100%>" << endl
        << "<TR>" << endl;
   Put_Header_Cell("Metric",70);

After applying the patch the values per function are calculated as expected:

cccc_htm_patch_02

@sarnold
Copy link
Owner

sarnold commented Apr 5, 2017

PR merged into master, closing.

@p2k-ko p2k-ko closed this as completed Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants