Browse Source

fixed total lines metric

avkonst 11 years ago
parent
commit
cdea6f3935

+ 1 - 1
mainline/ext/std/code/lines.py

@@ -92,7 +92,7 @@ class Plugin(core.api.Plugin, core.api.Child, core.api.IConfigurable):
                 count += len(self.pattern_line.findall(text, start_pos, data.get_region(sub_id).get_offset_begin()))
                 start_pos = data.get_region(sub_id).get_offset_end()
             count += len(self.pattern_line.findall(text, start_pos, region.get_offset_end()))
-            region.set_data(self.get_name(), 'code', count)
+            region.set_data(self.get_name(), field_name, count)
         
     def count_in_markers(self, data, marker_type, field_name):
         text = data.get_content()

+ 6 - 6
mainline/tests/general/test_basic/test_std_general_metrics_view_nest_per_file_stdout.gold.txt

@@ -106,7 +106,7 @@ data:
 .   .   .   .   .   .   .   .   .   .   data: 
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   std.general: 
-.   .   .   proctime="0.00300002098083"
+.   .   .   proctime="0.0019998550415"
 .   .   .   size="487"
 .   subfiles:
 .   subdirs:
@@ -121,15 +121,15 @@ data:
 .   .   .   .   distribution-bars:
 .   .   .   proctime: 
 .   .   .   .   count="1"
-.   .   .   .   max="0.00300002098083"
-.   .   .   .   avg="0.00300002098083"
-.   .   .   .   total="0.00300002098083"
-.   .   .   .   min="0.00300002098083" 
+.   .   .   .   max="0.0019998550415"
+.   .   .   .   avg="0.0019998550415"
+.   .   .   .   total="0.0019998550415"
+.   .   .   .   min="0.0019998550415" 
 .   .   .   .   distribution-bars:
 .   .   .   .   
 .   .   .   .   .   distribution-bar: 
 .   .   .   .   .   .   count="1"
-.   .   .   .   .   .   metric="0.00300002098083"
+.   .   .   .   .   .   metric="0.0019998550415"
 .   .   .   .   .   .   ratio="1.0"
 .   .   .   size: 
 .   .   .   .   count="1"

+ 5 - 5
mainline/tests/general/test_basic/test_std_general_metrics_view_txt_stdout.gold.txt

@@ -22,15 +22,15 @@ data:
 .   .   .   .   distribution-bars:
 .   .   .   proctime: 
 .   .   .   .   count="1"
-.   .   .   .   max="0.00300002098083"
-.   .   .   .   avg="0.00300002098083"
-.   .   .   .   total="0.00300002098083"
-.   .   .   .   min="0.00300002098083" 
+.   .   .   .   max="0.0019998550415"
+.   .   .   .   avg="0.0019998550415"
+.   .   .   .   total="0.0019998550415"
+.   .   .   .   min="0.0019998550415" 
 .   .   .   .   distribution-bars:
 .   .   .   .   
 .   .   .   .   .   distribution-bar: 
 .   .   .   .   .   .   count="1"
-.   .   .   .   .   .   metric="0.00300002098083"
+.   .   .   .   .   .   metric="0.0019998550415"
 .   .   .   .   .   .   ratio="1.0"
 .   .   .   size: 
 .   .   .   .   count="1"

+ 48 - 10
mainline/tests/general/test_basic/test_std_lines_metrics_view_nest_per_file_stdout.gold.txt

@@ -22,6 +22,7 @@ data:
 .   .   .   .   data:  
 .   .   .   .   .   std.code.lines: 
 .   .   .   .   .   .   code="0"
+.   .   .   .   .   .   total="0"
 .   .   .   .   .   .   preprocessor="0"
 .   .   .   .   .   .   comments="0"
 .   .   .   .   subregions:
@@ -37,7 +38,8 @@ data:
 .   .   .   .   .   .   .   offset_begin="2"
 .   .   .   .   .   .   data:  
 .   .   .   .   .   .   .   std.code.lines: 
-.   .   .   .   .   .   .   .   code="5"
+.   .   .   .   .   .   .   .   code="4"
+.   .   .   .   .   .   .   .   total="5"
 .   .   .   .   .   .   .   .   preprocessor="0"
 .   .   .   .   .   .   .   .   comments="1"
 .   .   .   .   .   .   subregions:
@@ -54,6 +56,7 @@ data:
 .   .   .   .   .   .   .   .   data:  
 .   .   .   .   .   .   .   .   .   std.code.lines: 
 .   .   .   .   .   .   .   .   .   .   code="4"
+.   .   .   .   .   .   .   .   .   .   total="4"
 .   .   .   .   .   .   .   .   .   .   preprocessor="0"
 .   .   .   .   .   .   .   .   .   .   comments="0"
 .   .   .   .   .   .   .   .   subregions:
@@ -69,7 +72,8 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="88"
 .   .   .   .   .   .   .   .   .   .   data:  
 .   .   .   .   .   .   .   .   .   .   .   std.code.lines: 
-.   .   .   .   .   .   .   .   .   .   .   .   code="12"
+.   .   .   .   .   .   .   .   .   .   .   .   code="10"
+.   .   .   .   .   .   .   .   .   .   .   .   total="12"
 .   .   .   .   .   .   .   .   .   .   .   .   preprocessor="0"
 .   .   .   .   .   .   .   .   .   .   .   .   comments="2"
 .   .   .   .   .   .   .   .   .   .   subregions:
@@ -86,6 +90,7 @@ data:
 .   .   .   .   .   .   .   .   .   .   data:  
 .   .   .   .   .   .   .   .   .   .   .   std.code.lines: 
 .   .   .   .   .   .   .   .   .   .   .   .   code="5"
+.   .   .   .   .   .   .   .   .   .   .   .   total="5"
 .   .   .   .   .   .   .   .   .   .   .   .   preprocessor="0"
 .   .   .   .   .   .   .   .   .   .   .   .   comments="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
@@ -102,6 +107,7 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   .   data:  
 .   .   .   .   .   .   .   .   .   .   .   .   .   std.code.lines: 
 .   .   .   .   .   .   .   .   .   .   .   .   .   .   code="3"
+.   .   .   .   .   .   .   .   .   .   .   .   .   .   total="3"
 .   .   .   .   .   .   .   .   .   .   .   .   .   .   preprocessor="0"
 .   .   .   .   .   .   .   .   .   .   .   .   .   .   comments="0"
 .   .   .   .   .   .   .   .   .   .   .   .   subregions:
@@ -117,7 +123,8 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   offset_begin="287"
 .   .   .   .   .   .   .   .   .   .   .   .   .   .   data:  
 .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   std.code.lines: 
-.   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   code="8"
+.   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   code="7"
+.   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   total="8"
 .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   preprocessor="0"
 .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   comments="1"
 .   .   .   .   .   .   .   .   .   .   .   .   .   .   subregions:
@@ -134,6 +141,7 @@ data:
 .   .   .   .   .   .   .   .   .   .   data:  
 .   .   .   .   .   .   .   .   .   .   .   std.code.lines: 
 .   .   .   .   .   .   .   .   .   .   .   .   code="7"
+.   .   .   .   .   .   .   .   .   .   .   .   total="7"
 .   .   .   .   .   .   .   .   .   .   .   .   preprocessor="0"
 .   .   .   .   .   .   .   .   .   .   .   .   comments="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
@@ -143,6 +151,43 @@ data:
 .   .   std.code.lines:  
 .   .   .   code: 
 .   .   .   .   count="8"
+.   .   .   .   max="10"
+.   .   .   .   avg="5.0"
+.   .   .   .   total="40.0"
+.   .   .   .   min="0" 
+.   .   .   .   distribution-bars:
+.   .   .   .   
+.   .   .   .   .   distribution-bar: 
+.   .   .   .   .   .   count="1"
+.   .   .   .   .   .   metric="0"
+.   .   .   .   .   .   ratio="0.125"
+.   .   .   .   
+.   .   .   .   .   distribution-bar: 
+.   .   .   .   .   .   count="1"
+.   .   .   .   .   .   metric="3"
+.   .   .   .   .   .   ratio="0.125"
+.   .   .   .   
+.   .   .   .   .   distribution-bar: 
+.   .   .   .   .   .   count="2"
+.   .   .   .   .   .   metric="4"
+.   .   .   .   .   .   ratio="0.25"
+.   .   .   .   
+.   .   .   .   .   distribution-bar: 
+.   .   .   .   .   .   count="1"
+.   .   .   .   .   .   metric="5"
+.   .   .   .   .   .   ratio="0.125"
+.   .   .   .   
+.   .   .   .   .   distribution-bar: 
+.   .   .   .   .   .   count="2"
+.   .   .   .   .   .   metric="7"
+.   .   .   .   .   .   ratio="0.25"
+.   .   .   .   
+.   .   .   .   .   distribution-bar: 
+.   .   .   .   .   .   count="1"
+.   .   .   .   .   .   metric="10"
+.   .   .   .   .   .   ratio="0.125"
+.   .   .   total: 
+.   .   .   .   count="8"
 .   .   .   .   max="12"
 .   .   .   .   avg="5.5"
 .   .   .   .   total="44.0"
@@ -183,13 +228,6 @@ data:
 .   .   .   .   .   .   count="1"
 .   .   .   .   .   .   metric="12"
 .   .   .   .   .   .   ratio="0.125"
-.   .   .   total: 
-.   .   .   .   count="0"
-.   .   .   .   max="None"
-.   .   .   .   avg="None"
-.   .   .   .   total="0.0"
-.   .   .   .   min="None" 
-.   .   .   .   distribution-bars:
 .   .   .   preprocessor: 
 .   .   .   .   count="8"
 .   .   .   .   max="0"

+ 37 - 7
mainline/tests/general/test_basic/test_std_lines_metrics_view_txt_stdout.gold.txt

@@ -15,6 +15,43 @@ data:
 .   .   std.code.lines:  
 .   .   .   code: 
 .   .   .   .   count="8"
+.   .   .   .   max="10"
+.   .   .   .   avg="5.0"
+.   .   .   .   total="40.0"
+.   .   .   .   min="0" 
+.   .   .   .   distribution-bars:
+.   .   .   .   
+.   .   .   .   .   distribution-bar: 
+.   .   .   .   .   .   count="1"
+.   .   .   .   .   .   metric="0"
+.   .   .   .   .   .   ratio="0.125"
+.   .   .   .   
+.   .   .   .   .   distribution-bar: 
+.   .   .   .   .   .   count="1"
+.   .   .   .   .   .   metric="3"
+.   .   .   .   .   .   ratio="0.125"
+.   .   .   .   
+.   .   .   .   .   distribution-bar: 
+.   .   .   .   .   .   count="2"
+.   .   .   .   .   .   metric="4"
+.   .   .   .   .   .   ratio="0.25"
+.   .   .   .   
+.   .   .   .   .   distribution-bar: 
+.   .   .   .   .   .   count="1"
+.   .   .   .   .   .   metric="5"
+.   .   .   .   .   .   ratio="0.125"
+.   .   .   .   
+.   .   .   .   .   distribution-bar: 
+.   .   .   .   .   .   count="2"
+.   .   .   .   .   .   metric="7"
+.   .   .   .   .   .   ratio="0.25"
+.   .   .   .   
+.   .   .   .   .   distribution-bar: 
+.   .   .   .   .   .   count="1"
+.   .   .   .   .   .   metric="10"
+.   .   .   .   .   .   ratio="0.125"
+.   .   .   total: 
+.   .   .   .   count="8"
 .   .   .   .   max="12"
 .   .   .   .   avg="5.5"
 .   .   .   .   total="44.0"
@@ -55,13 +92,6 @@ data:
 .   .   .   .   .   .   count="1"
 .   .   .   .   .   .   metric="12"
 .   .   .   .   .   .   ratio="0.125"
-.   .   .   total: 
-.   .   .   .   count="0"
-.   .   .   .   max="None"
-.   .   .   .   avg="None"
-.   .   .   .   total="0.0"
-.   .   .   .   min="None" 
-.   .   .   .   distribution-bars:
 .   .   .   preprocessor: 
 .   .   .   .   count="8"
 .   .   .   .   max="0"