Sfoglia il codice sorgente

Merge pull request #48 from eolivi/feat_ratio

Added new metric, ratio of comment lines to code lines 2
Andrey 2 anni fa
parent
commit
5d4a0ea648
22 ha cambiato i file con 356 aggiunte e 42 eliminazioni
  1. 15 0
      metrixpp/ext/std/code/ratio.ini
  2. 49 0
      metrixpp/ext/std/code/ratio.py
  3. 1 1
      metrixpp/ext/std/tools/view.py
  4. 23 0
      metrixpp/mpp/api.py
  5. 4 4
      metrixpp/tests/common.py
  6. 3 0
      metrixpp/tests/general/test_basic.py
  7. 6 0
      metrixpp/tests/general/test_basic/test_help_collect_default_stdout.gold.txt
  8. 23 0
      metrixpp/tests/general/test_basic/test_std_lines_metrics_view_nest_per_file_stdout.gold.txt
  9. 13 0
      metrixpp/tests/general/test_basic/test_std_lines_metrics_view_txt_stdout.gold.txt
  10. 19 19
      metrixpp/tests/general/test_basic/test_workflow_export_default_stdout.gold.txt
  11. 18 18
      metrixpp/tests/general/test_basic/test_workflow_export_second_stdout.gold.txt
  12. 2 0
      metrixpp/tests/general/test_basic/test_workflow_info_default_stdout.gold.txt
  13. 2 0
      metrixpp/tests/general/test_basic/test_workflow_info_second_stdout.gold.txt
  14. 11 0
      metrixpp/tests/general/test_basic/test_workflow_view_default_stdout.gold.txt
  15. 40 0
      metrixpp/tests/general/test_basic/test_workflow_view_second_per_file_stdout.gold.txt
  16. 25 0
      metrixpp/tests/general/test_basic/test_workflow_view_second_per_file_txt_all_stdout.gold.txt
  17. 22 0
      metrixpp/tests/general/test_basic/test_workflow_view_second_per_file_txt_new_stdout.gold.txt
  18. 24 0
      metrixpp/tests/general/test_basic/test_workflow_view_second_per_file_txt_touched_stdout.gold.txt
  19. 14 0
      metrixpp/tests/general/test_basic/test_workflow_view_second_stdout.gold.txt
  20. 15 0
      metrixpp/tests/general/test_basic/test_workflow_view_second_txt_all_stdout.gold.txt
  21. 13 0
      metrixpp/tests/general/test_basic/test_workflow_view_second_txt_new_stdout.gold.txt
  22. 14 0
      metrixpp/tests/general/test_basic/test_workflow_view_second_txt_touched_stdout.gold.txt

+ 15 - 0
metrixpp/ext/std/code/ratio.ini

@@ -0,0 +1,15 @@
+;
+;    Metrix++, Copyright 2009-2019, Metrix++ Project
+;    Link: https://github.com/metrixplusplus/metrixplusplus
+;    
+;    This file is a part of Metrix++ Tool.
+;    
+
+[Plugin]
+version: 1.0
+package: std.code
+module:  ratio
+class:   Plugin
+depends: std.code.lines
+actions: collect
+enabled: True

+ 49 - 0
metrixpp/ext/std/code/ratio.py

@@ -0,0 +1,49 @@
+#
+#    Metrix++, Copyright 2009-2019, Metrix++ Project
+#    Link: https://github.com/metrixplusplus/metrixplusplus
+#    
+#    This file is a part of Metrix++ Tool.
+#    
+
+from metrixpp.mpp import api
+
+class Plugin(api.Plugin,
+             api.IConfigurable,
+             api.Child,
+             api.MetricPluginMixin):
+    
+    def declare_configuration(self, parser):
+        self.parser = parser
+        parser.add_option("--std.code.ratio.comments", "--scrc", action="store_true", default=False,
+                         help="Enables collection of comment ratio metric (per region detalization) - "
+                         "ratio of non-empty lines of comments to non-empty lines of (code + comments)"
+                         " It uses std.code.lines.code, std.code.lines.comments"
+                         " metrics to calculate the ratio."
+                         " [default: %default]")
+
+    def configure(self, options):
+        self.is_active_ratiocomments = options.__dict__['std.code.ratio.comments']
+        if self.is_active_ratiocomments == True:
+            required_opts = ['std.code.lines.comments', 'std.code.lines.code']
+            for each in required_opts:
+                if options.__dict__[each] == False:
+                    self.parser.error('option --std.code.ratio.comments: requires --{0} option'.
+                                      format(each))
+
+    def initialize(self):
+        self.declare_metric(self.is_active_ratiocomments,
+                            self.Field('comments', float),
+                            {
+                             'std.code.lines':(None, self.RatioCalculatorCounter)
+                            },
+                            # set none, because this plugin is not interested in parsing the code
+                            marker_type_mask=api.Marker.T.NONE)
+
+        super(Plugin, self).initialize(fields=self.get_fields())
+
+        if self.is_active() == True:
+            self.subscribe_by_parents_name('std.code.lines')
+
+    class RatioCalculatorCounter(api.MetricPluginMixin.RatioCalculator):
+        ratio_comments = ('std.code.lines', 'comments')
+        ratio_code = ('std.code.lines', 'code')

+ 1 - 1
metrixpp/ext/std/tools/view.py

@@ -544,7 +544,7 @@ def cout_txt_regions(path, regions, indent = 0):
                 if field == '__diff__':
                     continue
                 if field in list(diff_data.keys()):
-                    diff_str = " [" + ("+" if diff_data[field] >= 0 else "") + str(diff_data[field]) + "]"
+                    diff_str = " [" + ("+" if diff_data[field] >= 0 else "") + "{0:.3g}".format(diff_data[field]) + "]"
                 details.append((namespace + ":" + field, str(region['data'][namespace][field]) + diff_str))
         cout.notify(path,
                         region['info']['cursor'],

+ 23 - 0
metrixpp/mpp/api.py

@@ -1167,6 +1167,29 @@ class MetricPluginMixin(Parent):
                     break
             return self.result
 
+    class RatioCalculator(PlainCounter):
+        
+        def __init__(self, *args, **kwargs):
+            super(MetricPluginMixin.RatioCalculator, self).__init__(*args, **kwargs)
+            self.result = self.region.get_data(self.namespace, self.field)
+            if self.result == None:
+                self.result = 0.0
+        
+        def get_result(self):
+            sourced_comments = self.region.get_data(self.ratio_comments[0], self.ratio_comments[1])
+            sourced_code = self.region.get_data(self.ratio_code[0], self.ratio_code[1])
+            if ((sourced_comments != None)
+                and
+                (sourced_code != None)
+                and
+                (sourced_comments + sourced_code != 0)
+               ): # 3-digit precision
+                self.result = float((1000 * sourced_comments) // (sourced_code + sourced_comments)) / 1000.
+            else:
+              self.result = 0.0
+
+            return self.result
+
     def declare_metric(self, is_active, field,
                        pattern_to_search_or_map_of_patterns,
                        marker_type_mask=Marker.T.ANY,

+ 4 - 4
metrixpp/tests/common.py

@@ -96,9 +96,9 @@ class ToolRunner(object):
                 f.close()
 
         # Match with gold        
-        self.is_stdout_matched = self.inetrnal_compare_with_gold(child_stdout, gold_file_stdout, real_file_stdout, diff_file_stdout)
+        self.is_stdout_matched = self.internal_compare_with_gold(child_stdout, gold_file_stdout, real_file_stdout, diff_file_stdout)
         if self.stderr_lines != None:
-            self.is_stderr_matched = self.inetrnal_compare_with_gold(child_stderr, gold_file_stderr, real_file_stderr, diff_file_stderr, self.stderr_lines)
+            self.is_stderr_matched = self.internal_compare_with_gold(child_stderr, gold_file_stderr, real_file_stderr, diff_file_stderr, self.stderr_lines)
         else:
             self.is_stderr_matched = None
             if self.is_stdout_matched == False:
@@ -114,7 +114,7 @@ class ToolRunner(object):
             shutil.copy2(self.dbfile, self.dbfile_prev)                
         return self
 
-    def inetrnal_compare_with_gold(self, text, gold_file, real_file, diff_file, lines = None):
+    def internal_compare_with_gold(self, text, gold_file, real_file, diff_file, lines = None):
         if os.path.exists(gold_file) == False:
             self.message += "\nGold file does not exist: " + gold_file
             return False
@@ -123,7 +123,7 @@ class ToolRunner(object):
         gold_text = f.read();
         f.close()
         
-        # don't compare dictionaries as string - they are not in order... (test case failes sometimes)
+        # don't compare dictionaries as string - they are not in order... (test case fails sometimes)
         try:
             textDict = ast.literal_eval(str(text.decode('ascii')))
             goldDict = ast.literal_eval(str(gold_text))

+ 3 - 0
metrixpp/tests/general/test_basic.py

@@ -20,6 +20,7 @@ class Test(tests.common.TestCase):
                                           '--std.code.lines.code',
                                           '--std.code.lines.preprocessor',
                                           '--std.code.lines.comments',
+                                          '--std.code.ratio.comments',
                                           '--std.suppress',
                                           '--log-level=INFO'],
                                          check_stderr=[(0, -1)],
@@ -56,6 +57,7 @@ class Test(tests.common.TestCase):
                                           '--std.code.lines.code',
                                           '--std.code.lines.preprocessor',
                                           '--std.code.lines.comments',
+                                          '--std.code.ratio.comments',
                                           '--std.suppress',
                                           '--log-level=INFO'],
                                          check_stderr=[(0, -1)],
@@ -279,6 +281,7 @@ class Test(tests.common.TestCase):
                                          ['--std.code.lines.code',
                                           '--std.code.lines.preprocessor',
                                           '--std.code.lines.comments',
+                                          '--std.code.ratio.comments',
                                           '--std.code.lines.total'])
         self.assertExec(runner.run())
 

+ 6 - 0
metrixpp/tests/general/test_basic/test_help_collect_default_stdout.gold.txt

@@ -113,6 +113,12 @@ Options:
                         std.code.complexity:cyclomatic metrics to rank level
                         of maintainability. Lower value of this metric
                         indicates better maintainability. [default: False]
+  --std.code.ratio.comments, --scrc
+                        Enables collection of comment ratio metric (per region
+                        detalization) - ratio of non-empty lines of comments
+                        to non-empty lines of (code + comments) It uses
+                        std.code.lines.code, std.code.lines.comments metrics
+                        to calculate the ratio. [default: False]
   --std.code.todo.comments, --sctc
                         Enables collection of number of todo/fixme/etc markers
                         in comments [default: False]

+ 23 - 0
metrixpp/tests/general/test_basic/test_std_lines_metrics_view_nest_per_file_stdout.gold.txt

@@ -8,6 +8,7 @@
 	std.code.lines:comments: 0
 	std.code.lines:preprocessor: 0
 	std.code.lines:total: 0
+	std.code.ratio:comments: 0.0
 
 .   ./simple.cpp:4: info: Metrics per 'hmm' region
     	Region name    : hmm
@@ -19,6 +20,7 @@
     	std.code.lines:comments: 1
     	std.code.lines:preprocessor: 1
     	std.code.lines:total: 6
+    	std.code.ratio:comments: 0.2
 
 .   .   ./simple.cpp:9: info: Metrics per 'A' region
         	Region name    : A
@@ -30,6 +32,7 @@
         	std.code.lines:comments: 0
         	std.code.lines:preprocessor: 0
         	std.code.lines:total: 20
+        	std.code.ratio:comments: 0.0
 
 .   .   .   ./simple.cpp:12: info: Metrics per 'A' region
             	Region name    : A
@@ -41,6 +44,7 @@
             	std.code.lines:comments: 2
             	std.code.lines:preprocessor: 0
             	std.code.lines:total: 12
+            	std.code.ratio:comments: 0.153
 
 .   .   .   ./simple.cpp:26: info: Metrics per 'func' region
             	Region name    : func
@@ -52,6 +56,7 @@
             	std.code.lines:comments: 0
             	std.code.lines:preprocessor: 0
             	std.code.lines:total: 5
+            	std.code.ratio:comments: 0.0
 
 .   .   .   .   ./simple.cpp:28: info: Metrics per 'embeded' region
                 	Region name    : embeded
@@ -63,6 +68,7 @@
                 	std.code.lines:comments: 0
                 	std.code.lines:preprocessor: 0
                 	std.code.lines:total: 3
+                	std.code.ratio:comments: 0.0
 
 .   .   .   .   .   ./simple.cpp:30: info: Metrics per 'embeded' region
                     	Region name    : embeded
@@ -74,6 +80,7 @@
                     	std.code.lines:comments: 1
                     	std.code.lines:preprocessor: 0
                     	std.code.lines:total: 8
+                    	std.code.ratio:comments: 0.125
 
 .   .   .   ./simple.cpp:42: info: Metrics per 'func_to_be_removed_in_new_sources' region
             	Region name    : func_to_be_removed_in_new_sources
@@ -85,6 +92,7 @@
             	std.code.lines:comments: 0
             	std.code.lines:preprocessor: 0
             	std.code.lines:total: 5
+            	std.code.ratio:comments: 0.0
 
 .   .   .   .   ./simple.cpp:44: info: Metrics per 'embeded' region
                 	Region name    : embeded
@@ -96,6 +104,7 @@
                 	std.code.lines:comments: 0
                 	std.code.lines:preprocessor: 0
                 	std.code.lines:total: 3
+                	std.code.ratio:comments: 0.0
 
 .   .   .   .   .   ./simple.cpp:46: info: Metrics per 'embeded' region
                     	Region name    : embeded
@@ -107,6 +116,7 @@
                     	std.code.lines:comments: 1
                     	std.code.lines:preprocessor: 0
                     	std.code.lines:total: 8
+                    	std.code.ratio:comments: 0.125
 
 .   .   .   ./simple.cpp:58: info: Metrics per 'never' region
             	Region name    : never
@@ -118,6 +128,7 @@
             	std.code.lines:comments: 0
             	std.code.lines:preprocessor: 0
             	std.code.lines:total: 7
+            	std.code.ratio:comments: 0.0
 
 ./simple.cpp:: info: Overall metrics for 'std.code.lines:code' metric
 	Average        : 6.54545455
@@ -171,4 +182,16 @@
 	            12 : 0.091 : 0.909 :  1	|||||||||
 	            20 : 0.091 : 1.000 :  1	|||||||||
 
+./simple.cpp:: info: Overall metrics for 'std.code.ratio:comments' metric
+	Average        : 0.05481818
+	Minimum        : 0.0
+	Maximum        : 0.2
+	Total          : 0.603
+	Distribution   : 11 regions in total (including 0 suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	        0.0000 : 0.636 : 0.636 :  7	|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+	        0.1250 : 0.182 : 0.818 :  2	||||||||||||||||||
+	        0.1530 : 0.091 : 0.909 :  1	|||||||||
+	        0.2000 : 0.091 : 1.000 :  1	|||||||||
+
 

+ 13 - 0
metrixpp/tests/general/test_basic/test_std_lines_metrics_view_txt_stdout.gold.txt

@@ -53,6 +53,19 @@
 	            12 : 0.062 : 0.938 :  1	||||||
 	            20 : 0.062 : 1.000 :  1	||||||
 
+./:: info: Overall metrics for 'std.code.ratio:comments' metric
+	Average        : 0.0769375
+	Minimum        : 0.0
+	Maximum        : 0.428
+	Total          : 1.231
+	Distribution   : 16 regions in total (including 0 suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	        0.0000 : 0.625 : 0.625 : 10	||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+	        0.1250 : 0.125 : 0.750 :  2	||||||||||||
+	        0.1530 : 0.062 : 0.812 :  1	||||||
+	        0.2000 : 0.125 : 0.938 :  2	||||||||||||
+	        0.4280 : 0.062 : 1.000 :  1	||||||
+
 ./:: info: Directory content:
 	File           : file_deleted_in_new_sources.cpp
 	File           : simple.cpp

+ 19 - 19
metrixpp/tests/general/test_basic/test_workflow_export_default_stdout.gold.txt

@@ -1,19 +1,19 @@
-file,region,type,modified,line start,line end,std.code.complexity:cyclomatic,std.code.lines:code,std.code.lines:comments,std.code.lines:preprocessor,std.code.lines:total,std.suppress:count,std.suppress:list,std.suppress.file:count,std.suppress.file:list
-./file_deleted_in_new_sources.cpp,__global__,global,,1,34,,0,0,0,0,,,,
-./file_deleted_in_new_sources.cpp,hmm,namespace,,3,24,,4,3,0,7,,,,
-./file_deleted_in_new_sources.cpp,B,class,,9,22,,3,0,0,3,,,,
-./file_deleted_in_new_sources.cpp,B,function,,12,20,1,8,2,0,9,,,,
-./file_deleted_in_new_sources.cpp,never_old,function,,26,33,1,7,0,0,7,,,,
-./file_deleted_in_new_sources.cpp,,file,,1,34,,,,,,,,,
-./simple.cpp,__global__,global,,1,90,,0,0,0,0,,,,
-./simple.cpp,hmm,namespace,,3,89,,4,1,1,6,,,,
-./simple.cpp,A,class,,9,87,,20,0,0,20,,,,
-./simple.cpp,A,function,,12,23,3,11,2,0,12,,,,
-./simple.cpp,func,function,,26,40,1,5,0,0,5,,,,
-./simple.cpp,embeded,class,,28,38,,3,0,0,3,,,,
-./simple.cpp,embeded,function,,30,37,1,7,1,0,8,,,,
-./simple.cpp,func_to_be_removed_in_new_sources,function,,42,56,2,5,0,0,5,,,,
-./simple.cpp,embeded,class,,44,54,,3,0,0,3,,,,
-./simple.cpp,embeded,function,,46,53,1,7,1,0,8,,,,
-./simple.cpp,never,function,,58,65,1,7,0,0,7,,,,
-./simple.cpp,,file,,1,90,,,,,,,,,
+file,region,type,modified,line start,line end,std.code.complexity:cyclomatic,std.code.lines:code,std.code.lines:comments,std.code.lines:preprocessor,std.code.lines:total,std.code.ratio:comments,std.suppress:count,std.suppress:list,std.suppress.file:count,std.suppress.file:list
+./file_deleted_in_new_sources.cpp,__global__,global,,1,34,,0,0,0,0,0.0,,,,
+./file_deleted_in_new_sources.cpp,hmm,namespace,,3,24,,4,3,0,7,0.428,,,,
+./file_deleted_in_new_sources.cpp,B,class,,9,22,,3,0,0,3,0.0,,,,
+./file_deleted_in_new_sources.cpp,B,function,,12,20,1,8,2,0,9,0.2,,,,
+./file_deleted_in_new_sources.cpp,never_old,function,,26,33,1,7,0,0,7,0.0,,,,
+./file_deleted_in_new_sources.cpp,,file,,1,34,,,,,,,,,,
+./simple.cpp,__global__,global,,1,90,,0,0,0,0,0.0,,,,
+./simple.cpp,hmm,namespace,,3,89,,4,1,1,6,0.2,,,,
+./simple.cpp,A,class,,9,87,,20,0,0,20,0.0,,,,
+./simple.cpp,A,function,,12,23,3,11,2,0,12,0.153,,,,
+./simple.cpp,func,function,,26,40,1,5,0,0,5,0.0,,,,
+./simple.cpp,embeded,class,,28,38,,3,0,0,3,0.0,,,,
+./simple.cpp,embeded,function,,30,37,1,7,1,0,8,0.125,,,,
+./simple.cpp,func_to_be_removed_in_new_sources,function,,42,56,2,5,0,0,5,0.0,,,,
+./simple.cpp,embeded,class,,44,54,,3,0,0,3,0.0,,,,
+./simple.cpp,embeded,function,,46,53,1,7,1,0,8,0.125,,,,
+./simple.cpp,never,function,,58,65,1,7,0,0,7,0.0,,,,
+./simple.cpp,,file,,1,90,,,,,,,,,,

+ 18 - 18
metrixpp/tests/general/test_basic/test_workflow_export_second_stdout.gold.txt

@@ -1,18 +1,18 @@
-file,region,type,modified,line start,line end,std.code.complexity:cyclomatic,std.code.lines:code,std.code.lines:comments,std.code.lines:preprocessor,std.code.lines:total,std.suppress:count,std.suppress:list,std.suppress.file:count,std.suppress.file:list
-./simple.cpp,__global__,global,False,1,78,,0,0,0,0,,,,
-./simple.cpp,hmm,namespace,True,3,77,,4,1,2,7,,,,
-./simple.cpp,A,class,True,10,75,,4,0,0,4,,,,
-./simple.cpp,A,function,False,13,24,3,11,2,0,12,,,,
-./simple.cpp,func,function,False,26,42,1,5,0,0,5,,,,
-./simple.cpp,embeded,class,False,28,40,,3,0,0,3,,,,
-./simple.cpp,embeded,function,True,30,39,2,8,2,0,9,,,,
-./simple.cpp,never,function,True,44,51,1,7,1,0,7,,,,
-./simple.cpp,new_func,function,,53,56,0,3,1,0,4,,,,
-./simple.cpp,new_func_complex,function,,58,62,1,5,0,0,5,,,,
-./simple.cpp,new_func_complex_but_suppressed,function,,64,72,2,8,1,0,9,1,[std.code.complexity:cyclomatic],,
-./simple.cpp,,file,True,1,78,,,,,,,,,
-./simple2.cpp,__global__,global,,1,26,,0,0,0,0,,,,
-./simple2.cpp,hmm,namespace,,3,25,,4,1,0,5,,,,
-./simple2.cpp,New_A,class,,7,23,,3,0,0,3,,,,
-./simple2.cpp,New_A,function,,10,21,3,10,2,0,12,,,,
-./simple2.cpp,,file,,1,26,,,,,,,,,
+file,region,type,modified,line start,line end,std.code.complexity:cyclomatic,std.code.lines:code,std.code.lines:comments,std.code.lines:preprocessor,std.code.lines:total,std.code.ratio:comments,std.suppress:count,std.suppress:list,std.suppress.file:count,std.suppress.file:list
+./simple.cpp,__global__,global,False,1,78,,0,0,0,0,0.0,,,,
+./simple.cpp,hmm,namespace,True,3,77,,4,1,2,7,0.2,,,,
+./simple.cpp,A,class,True,10,75,,4,0,0,4,0.0,,,,
+./simple.cpp,A,function,False,13,24,3,11,2,0,12,0.153,,,,
+./simple.cpp,func,function,False,26,42,1,5,0,0,5,0.0,,,,
+./simple.cpp,embeded,class,False,28,40,,3,0,0,3,0.0,,,,
+./simple.cpp,embeded,function,True,30,39,2,8,2,0,9,0.2,,,,
+./simple.cpp,never,function,True,44,51,1,7,1,0,7,0.125,,,,
+./simple.cpp,new_func,function,,53,56,0,3,1,0,4,0.25,,,,
+./simple.cpp,new_func_complex,function,,58,62,1,5,0,0,5,0.0,,,,
+./simple.cpp,new_func_complex_but_suppressed,function,,64,72,2,8,1,0,9,0.111,1,[std.code.complexity:cyclomatic],,
+./simple.cpp,,file,True,1,78,,,,,,,,,,
+./simple2.cpp,__global__,global,,1,26,,0,0,0,0,0.0,,,,
+./simple2.cpp,hmm,namespace,,3,25,,4,1,0,5,0.2,,,,
+./simple2.cpp,New_A,class,,7,23,,3,0,0,3,0.0,,,,
+./simple2.cpp,New_A,function,,10,21,3,10,2,0,12,0.166,,,,
+./simple2.cpp,,file,,1,26,,,,,,,,,,

+ 2 - 0
metrixpp/tests/general/test_basic/test_workflow_info_default_stdout.gold.txt

@@ -10,6 +10,7 @@ test_workflow.db:: info: Created using plugins and settings:
 	std.code.lines:version: 1.1
 	std.code.magic:version: 1.3
 	std.code.magic:number.simplier: False
+	std.code.ratio:version: 1.0
 	std.code.todo:version: 1.0
 	std.code.todo:tags: FIXME,FixMe,HACK,TBD,TODO,ToDo,XXX
 	std.suppress:version: 1.0
@@ -20,6 +21,7 @@ test_workflow.db:: info: Collected metrics:
 	std.code.lines:comments: 
 	std.code.lines:preprocessor: 
 	std.code.lines:total: 
+	std.code.ratio:comments: 
 	std.suppress:count: 
 	std.suppress:list: 
 	std.suppress.file:count: 

+ 2 - 0
metrixpp/tests/general/test_basic/test_workflow_info_second_stdout.gold.txt

@@ -10,6 +10,7 @@ test_workflow.db:: info: Created using plugins and settings:
 	std.code.lines:version: 1.1
 	std.code.magic:version: 1.3
 	std.code.magic:number.simplier: False
+	std.code.ratio:version: 1.0
 	std.code.todo:version: 1.0
 	std.code.todo:tags: FIXME,FixMe,HACK,TBD,TODO,ToDo,XXX
 	std.suppress:version: 1.0
@@ -20,6 +21,7 @@ test_workflow.db:: info: Collected metrics:
 	std.code.lines:comments: 
 	std.code.lines:preprocessor: 
 	std.code.lines:total: 
+	std.code.ratio:comments: 
 	std.suppress:count: 
 	std.suppress:list: 
 	std.suppress.file:count: 

+ 11 - 0
metrixpp/tests/general/test_basic/test_workflow_view_default_stdout.gold.txt

@@ -52,6 +52,17 @@
                     </distribution-bars>
                 </total>
             </std.code.lines>
+            <std.code.ratio>
+                <comments avg="0.0769375" count="16" max="0.428" min="0.0" nonzero="False" sup="0" total="1.231">
+                    <distribution-bars>
+                        <distribution-bar count="10" metric="0.0000" ratio="0.625" />
+                        <distribution-bar count="2" metric="0.1250" ratio="0.125" />
+                        <distribution-bar count="1" metric="0.1530" ratio="0.0625" />
+                        <distribution-bar count="2" metric="0.2000" ratio="0.125" />
+                        <distribution-bar count="1" metric="0.4280" ratio="0.0625" />
+                    </distribution-bars>
+                </comments>
+            </std.code.ratio>
             <std.suppress>
                 <count avg="None" count="0" max="None" min="None" nonzero="True" sup="0" total="0.0">
                     <distribution-bars>

+ 40 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_per_file_stdout.gold.txt

@@ -57,6 +57,19 @@
                     </distribution-bars>
                 </total>
             </std.code.lines>
+            <std.code.ratio>
+                <comments avg="0.09445455" count="11" max="0.25" min="0.0" nonzero="False" sup="0" total="1.039">
+                    <__diff__ avg="0.03963636" count="0" max="0.05" min="0.0" nonzero="0" sup="0" total="0.436" />
+                    <distribution-bars>
+                        <distribution-bar __diff__="-2" count="5" metric="0.0000" ratio="0.45454545" />
+                        <distribution-bar __diff__="1" count="1" metric="0.1110" ratio="0.09090909" />
+                        <distribution-bar __diff__="-1" count="1" metric="0.1250" ratio="0.09090909" />
+                        <distribution-bar __diff__="0" count="1" metric="0.1530" ratio="0.09090909" />
+                        <distribution-bar __diff__="1" count="2" metric="0.2000" ratio="0.18181818" />
+                        <distribution-bar __diff__="1" count="1" metric="0.2500" ratio="0.09090909" />
+                    </distribution-bars>
+                </comments>
+            </std.code.ratio>
             <std.suppress>
                 <count avg="1.0" count="1" max="1" min="1" nonzero="True" sup="0" total="1.0">
                     <__diff__ avg="1.0" count="1" max="1" min="1" nonzero="0" sup="0" total="1.0" />
@@ -80,6 +93,9 @@
                         <std.code.lines code="0" comments="0" preprocessor="0" total="0">
                             <__diff__ code="0" comments="0" preprocessor="0" total="0" />
                         </std.code.lines>
+                        <std.code.ratio comments="0.0">
+                            <__diff__ comments="0.0" />
+                        </std.code.ratio>
                     </data>
                     <info cursor="0" line_begin="1" line_end="78" modified="False" name="__global__" offset_begin="0" offset_end="836" type="global" />
                 </region>
@@ -88,6 +104,9 @@
                         <std.code.lines code="4" comments="1" preprocessor="2" total="7">
                             <__diff__ code="0" comments="0" preprocessor="1" total="1" />
                         </std.code.lines>
+                        <std.code.ratio comments="0.2">
+                            <__diff__ comments="0.0" />
+                        </std.code.ratio>
                     </data>
                     <info cursor="4" line_begin="3" line_end="77" modified="True" name="hmm" offset_begin="2" offset_end="835" type="namespace" />
                 </region>
@@ -96,6 +115,9 @@
                         <std.code.lines code="4" comments="0" preprocessor="0" total="4">
                             <__diff__ code="-16" comments="0" preprocessor="0" total="-16" />
                         </std.code.lines>
+                        <std.code.ratio comments="0.0">
+                            <__diff__ comments="0.0" />
+                        </std.code.ratio>
                     </data>
                     <info cursor="10" line_begin="10" line_end="75" modified="True" name="A" offset_begin="111" offset_end="831" type="class" />
                 </region>
@@ -107,6 +129,9 @@
                         <std.code.lines code="11" comments="2" preprocessor="0" total="12">
                             <__diff__ code="0" comments="0" preprocessor="0" total="0" />
                         </std.code.lines>
+                        <std.code.ratio comments="0.153">
+                            <__diff__ comments="0.0" />
+                        </std.code.ratio>
                     </data>
                     <info cursor="13" line_begin="13" line_end="24" modified="False" name="A" offset_begin="123" offset_end="269" type="function" />
                 </region>
@@ -118,6 +143,9 @@
                         <std.code.lines code="5" comments="0" preprocessor="0" total="5">
                             <__diff__ code="0" comments="0" preprocessor="0" total="0" />
                         </std.code.lines>
+                        <std.code.ratio comments="0.0">
+                            <__diff__ comments="0.0" />
+                        </std.code.ratio>
                     </data>
                     <info cursor="26" line_begin="26" line_end="42" modified="False" name="func" offset_begin="272" offset_end="455" type="function" />
                 </region>
@@ -126,6 +154,9 @@
                         <std.code.lines code="3" comments="0" preprocessor="0" total="3">
                             <__diff__ code="0" comments="0" preprocessor="0" total="0" />
                         </std.code.lines>
+                        <std.code.ratio comments="0.0">
+                            <__diff__ comments="0.0" />
+                        </std.code.ratio>
                     </data>
                     <info cursor="28" line_begin="28" line_end="40" modified="False" name="embeded" offset_begin="301" offset_end="441" type="class" />
                 </region>
@@ -137,6 +168,9 @@
                         <std.code.lines code="8" comments="2" preprocessor="0" total="9">
                             <__diff__ code="1" comments="1" preprocessor="0" total="1" />
                         </std.code.lines>
+                        <std.code.ratio comments="0.2">
+                            <__diff__ comments="0.075" />
+                        </std.code.ratio>
                     </data>
                     <info cursor="30" line_begin="30" line_end="39" modified="True" name="embeded" offset_begin="322" offset_end="437" type="function" />
                 </region>
@@ -148,6 +182,9 @@
                         <std.code.lines code="7" comments="1" preprocessor="0" total="7">
                             <__diff__ code="0" comments="1" preprocessor="0" total="0" />
                         </std.code.lines>
+                        <std.code.ratio comments="0.125">
+                            <__diff__ comments="0.125" />
+                        </std.code.ratio>
                     </data>
                     <info cursor="44" line_begin="44" line_end="51" modified="True" name="never" offset_begin="458" offset_end="549" type="function" />
                 </region>
@@ -155,6 +192,7 @@
                     <data>
                         <std.code.complexity cyclomatic="0" />
                         <std.code.lines code="3" comments="1" preprocessor="0" total="4" />
+                        <std.code.ratio comments="0.25" />
                     </data>
                     <info cursor="53" line_begin="53" line_end="56" modified="None" name="new_func" offset_begin="552" offset_end="585" type="function" />
                 </region>
@@ -162,6 +200,7 @@
                     <data>
                         <std.code.complexity cyclomatic="1" />
                         <std.code.lines code="5" comments="0" preprocessor="0" total="5" />
+                        <std.code.ratio comments="0.0" />
                     </data>
                     <info cursor="58" line_begin="58" line_end="62" modified="None" name="new_func_complex" offset_begin="588" offset_end="646" type="function" />
                 </region>
@@ -169,6 +208,7 @@
                     <data>
                         <std.code.complexity cyclomatic="2" />
                         <std.code.lines code="8" comments="1" preprocessor="0" total="9" />
+                        <std.code.ratio comments="0.111" />
                         <std.suppress count="1" list="[std.code.complexity:cyclomatic]" />
                     </data>
                     <info cursor="65" line_begin="64" line_end="72" modified="None" name="new_func_complex_but_suppressed" offset_begin="649" offset_end="808" type="function" />

+ 25 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_per_file_txt_all_stdout.gold.txt

@@ -8,6 +8,7 @@
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 0 [+0]
+	std.code.ratio:comments: 0.0 [+0]
 
 ./simple.cpp:4: info: Metrics per 'hmm' region
 	Region name    : hmm
@@ -19,6 +20,7 @@
 	std.code.lines:comments: 1 [+0]
 	std.code.lines:preprocessor: 2 [+1]
 	std.code.lines:total: 7 [+1]
+	std.code.ratio:comments: 0.2 [+0]
 
 ./simple.cpp:10: info: Metrics per 'A' region
 	Region name    : A
@@ -30,6 +32,7 @@
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 4 [-16]
+	std.code.ratio:comments: 0.0 [+0]
 
 ./simple.cpp:13: info: Metrics per 'A' region
 	Region name    : A
@@ -42,6 +45,7 @@
 	std.code.lines:comments: 2 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 12 [+0]
+	std.code.ratio:comments: 0.153 [+0]
 
 ./simple.cpp:26: info: Metrics per 'func' region
 	Region name    : func
@@ -54,6 +58,7 @@
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 5 [+0]
+	std.code.ratio:comments: 0.0 [+0]
 
 ./simple.cpp:28: info: Metrics per 'embeded' region
 	Region name    : embeded
@@ -65,6 +70,7 @@
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 3 [+0]
+	std.code.ratio:comments: 0.0 [+0]
 
 ./simple.cpp:30: info: Metrics per 'embeded' region
 	Region name    : embeded
@@ -77,6 +83,7 @@
 	std.code.lines:comments: 2 [+1]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 9 [+1]
+	std.code.ratio:comments: 0.2 [+0.075]
 
 ./simple.cpp:44: info: Metrics per 'never' region
 	Region name    : never
@@ -89,6 +96,7 @@
 	std.code.lines:comments: 1 [+1]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 7 [+0]
+	std.code.ratio:comments: 0.125 [+0.125]
 
 ./simple.cpp:53: info: Metrics per 'new_func' region
 	Region name    : new_func
@@ -101,6 +109,7 @@
 	std.code.lines:comments: 1
 	std.code.lines:preprocessor: 0
 	std.code.lines:total: 4
+	std.code.ratio:comments: 0.25
 
 ./simple.cpp:58: info: Metrics per 'new_func_complex' region
 	Region name    : new_func_complex
@@ -113,6 +122,7 @@
 	std.code.lines:comments: 0
 	std.code.lines:preprocessor: 0
 	std.code.lines:total: 5
+	std.code.ratio:comments: 0.0
 
 ./simple.cpp:65: info: Metrics per 'new_func_complex_but_suppressed' region
 	Region name    : new_func_complex_but_suppressed
@@ -125,6 +135,7 @@
 	std.code.lines:comments: 1
 	std.code.lines:preprocessor: 0
 	std.code.lines:total: 9
+	std.code.ratio:comments: 0.111
 	std.suppress:count: 1
 	std.suppress:list: [std.code.complexity:cyclomatic]
 
@@ -194,6 +205,20 @@
 	             9 : 0.182 : 0.909 :  2 [+2 ]	||||||||||||||||||
 	            12 : 0.091 : 1.000 :  1 [+0 ]	|||||||||
 
+./simple.cpp:: info: Overall metrics for 'std.code.ratio:comments' metric
+	Average        : 0.09445455 [+0.03963636]
+	Minimum        : 0.0 [+0.0]
+	Maximum        : 0.25 [+0.05]
+	Total          : 1.039 [+0.436]
+	Distribution   : 11 [+0] regions in total (including 0 [+0] suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	        0.0000 : 0.455 : 0.455 :  5 [-2 ]	|||||||||||||||||||||||||||||||||||||||||||||
+	        0.1110 : 0.091 : 0.545 :  1 [+1 ]	|||||||||
+	        0.1250 : 0.091 : 0.636 :  1 [-1 ]	|||||||||
+	        0.1530 : 0.091 : 0.727 :  1 [+0 ]	|||||||||
+	        0.2000 : 0.182 : 0.909 :  2 [+1 ]	||||||||||||||||||
+	        0.2500 : 0.091 : 1.000 :  1 [+1 ]	|||||||||
+
 ./simple.cpp:: info: Overall metrics for 'std.suppress:count' metric
 	Average        : 1.0 [+1.0] (excluding zero metric values)
 	Minimum        : 1 [+1]

+ 22 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_per_file_txt_new_stdout.gold.txt

@@ -8,6 +8,7 @@
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 0 [+0]
+	std.code.ratio:comments: 0.0 [+0]
 
 ./simple.cpp:4: info: Metrics per 'hmm' region
 	Region name    : hmm
@@ -19,6 +20,7 @@
 	std.code.lines:comments: 1 [+0]
 	std.code.lines:preprocessor: 2 [+1]
 	std.code.lines:total: 7 [+1]
+	std.code.ratio:comments: 0.2 [+0]
 
 ./simple.cpp:10: info: Metrics per 'A' region
 	Region name    : A
@@ -30,6 +32,7 @@
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 4 [-16]
+	std.code.ratio:comments: 0.0 [+0]
 
 ./simple.cpp:13: info: Metrics per 'A' region
 	Region name    : A
@@ -42,6 +45,7 @@
 	std.code.lines:comments: 2 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 12 [+0]
+	std.code.ratio:comments: 0.153 [+0]
 
 ./simple.cpp:26: info: Metrics per 'func' region
 	Region name    : func
@@ -54,6 +58,7 @@
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 5 [+0]
+	std.code.ratio:comments: 0.0 [+0]
 
 ./simple.cpp:28: info: Metrics per 'embeded' region
 	Region name    : embeded
@@ -65,6 +70,7 @@
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 3 [+0]
+	std.code.ratio:comments: 0.0 [+0]
 
 ./simple.cpp:30: info: Metrics per 'embeded' region
 	Region name    : embeded
@@ -77,6 +83,7 @@
 	std.code.lines:comments: 2 [+1]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 9 [+1]
+	std.code.ratio:comments: 0.2 [+0.075]
 
 ./simple.cpp:44: info: Metrics per 'never' region
 	Region name    : never
@@ -89,6 +96,7 @@
 	std.code.lines:comments: 1 [+1]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 7 [+0]
+	std.code.ratio:comments: 0.125 [+0.125]
 
 ./simple.cpp:53: info: Metrics per 'new_func' region
 	Region name    : new_func
@@ -101,6 +109,7 @@
 	std.code.lines:comments: 1
 	std.code.lines:preprocessor: 0
 	std.code.lines:total: 4
+	std.code.ratio:comments: 0.25
 
 ./simple.cpp:58: info: Metrics per 'new_func_complex' region
 	Region name    : new_func_complex
@@ -113,6 +122,7 @@
 	std.code.lines:comments: 0
 	std.code.lines:preprocessor: 0
 	std.code.lines:total: 5
+	std.code.ratio:comments: 0.0
 
 ./simple.cpp:65: info: Metrics per 'new_func_complex_but_suppressed' region
 	Region name    : new_func_complex_but_suppressed
@@ -125,6 +135,7 @@
 	std.code.lines:comments: 1
 	std.code.lines:preprocessor: 0
 	std.code.lines:total: 9
+	std.code.ratio:comments: 0.111
 	std.suppress:count: 1
 	std.suppress:list: [std.code.complexity:cyclomatic]
 
@@ -180,6 +191,17 @@
 	             5 : 0.333 : 0.667 : 1 [+1]	|||||||||||||||||||||||||||||||||
 	             9 : 0.333 : 1.000 : 1 [+1]	|||||||||||||||||||||||||||||||||
 
+./simple.cpp:: info: Overall metrics for 'std.code.ratio:comments' metric
+	Average        : 0.12033333 [+0.12033333]
+	Minimum        : 0.0 [+0.0]
+	Maximum        : 0.25 [+0.25]
+	Total          : 0.361 [+0.361]
+	Distribution   : 3 [+3] regions in total (including 0 [+0] suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	        0.0000 : 0.333 : 0.333 : 1 [+1]	|||||||||||||||||||||||||||||||||
+	        0.1110 : 0.333 : 0.667 : 1 [+1]	|||||||||||||||||||||||||||||||||
+	        0.2500 : 0.333 : 1.000 : 1 [+1]	|||||||||||||||||||||||||||||||||
+
 ./simple.cpp:: info: Overall metrics for 'std.suppress:count' metric
 	Average        : 1.0 [+1.0] (excluding zero metric values)
 	Minimum        : 1 [+1]

+ 24 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_per_file_txt_touched_stdout.gold.txt

@@ -8,6 +8,7 @@
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 0 [+0]
+	std.code.ratio:comments: 0.0 [+0]
 
 ./simple.cpp:4: info: Metrics per 'hmm' region
 	Region name    : hmm
@@ -19,6 +20,7 @@
 	std.code.lines:comments: 1 [+0]
 	std.code.lines:preprocessor: 2 [+1]
 	std.code.lines:total: 7 [+1]
+	std.code.ratio:comments: 0.2 [+0]
 
 ./simple.cpp:10: info: Metrics per 'A' region
 	Region name    : A
@@ -30,6 +32,7 @@
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 4 [-16]
+	std.code.ratio:comments: 0.0 [+0]
 
 ./simple.cpp:13: info: Metrics per 'A' region
 	Region name    : A
@@ -42,6 +45,7 @@
 	std.code.lines:comments: 2 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 12 [+0]
+	std.code.ratio:comments: 0.153 [+0]
 
 ./simple.cpp:26: info: Metrics per 'func' region
 	Region name    : func
@@ -54,6 +58,7 @@
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 5 [+0]
+	std.code.ratio:comments: 0.0 [+0]
 
 ./simple.cpp:28: info: Metrics per 'embeded' region
 	Region name    : embeded
@@ -65,6 +70,7 @@
 	std.code.lines:comments: 0 [+0]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 3 [+0]
+	std.code.ratio:comments: 0.0 [+0]
 
 ./simple.cpp:30: info: Metrics per 'embeded' region
 	Region name    : embeded
@@ -77,6 +83,7 @@
 	std.code.lines:comments: 2 [+1]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 9 [+1]
+	std.code.ratio:comments: 0.2 [+0.075]
 
 ./simple.cpp:44: info: Metrics per 'never' region
 	Region name    : never
@@ -89,6 +96,7 @@
 	std.code.lines:comments: 1 [+1]
 	std.code.lines:preprocessor: 0 [+0]
 	std.code.lines:total: 7 [+0]
+	std.code.ratio:comments: 0.125 [+0.125]
 
 ./simple.cpp:53: info: Metrics per 'new_func' region
 	Region name    : new_func
@@ -101,6 +109,7 @@
 	std.code.lines:comments: 1
 	std.code.lines:preprocessor: 0
 	std.code.lines:total: 4
+	std.code.ratio:comments: 0.25
 
 ./simple.cpp:58: info: Metrics per 'new_func_complex' region
 	Region name    : new_func_complex
@@ -113,6 +122,7 @@
 	std.code.lines:comments: 0
 	std.code.lines:preprocessor: 0
 	std.code.lines:total: 5
+	std.code.ratio:comments: 0.0
 
 ./simple.cpp:65: info: Metrics per 'new_func_complex_but_suppressed' region
 	Region name    : new_func_complex_but_suppressed
@@ -125,6 +135,7 @@
 	std.code.lines:comments: 1
 	std.code.lines:preprocessor: 0
 	std.code.lines:total: 9
+	std.code.ratio:comments: 0.111
 	std.suppress:count: 1
 	std.suppress:list: [std.code.complexity:cyclomatic]
 
@@ -189,6 +200,19 @@
 	             8 : 0.000 : 0.714 : 0 [-2]	
 	             9 : 0.286 : 1.000 : 2 [+2]	||||||||||||||||||||||||||||
 
+./simple.cpp:: info: Overall metrics for 'std.code.ratio:comments' metric
+	Average        : 0.12657143 [+0.06228571]
+	Minimum        : 0.0 [+0.0]
+	Maximum        : 0.25 [+0.05]
+	Total          : 0.886 [+0.436]
+	Distribution   : 7 [+0] regions in total (including 0 [+0] suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	        0.0000 : 0.286 : 0.286 : 2 [-2]	||||||||||||||||||||||||||||
+	        0.1110 : 0.143 : 0.429 : 1 [+1]	||||||||||||||
+	        0.1250 : 0.143 : 0.571 : 1 [-1]	||||||||||||||
+	        0.2000 : 0.286 : 0.857 : 2 [+1]	||||||||||||||||||||||||||||
+	        0.2500 : 0.143 : 1.000 : 1 [+1]	||||||||||||||
+
 ./simple.cpp:: info: Overall metrics for 'std.suppress:count' metric
 	Average        : 1.0 [+1.0] (excluding zero metric values)
 	Minimum        : 1 [+1]

+ 14 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_stdout.gold.txt

@@ -58,6 +58,20 @@
                     </distribution-bars>
                 </total>
             </std.code.lines>
+            <std.code.ratio>
+                <comments avg="0.09366667" count="15" max="0.25" min="0.0" nonzero="False" sup="0" total="1.405">
+                    <__diff__ avg="0.01672917" count="-1" max="-0.178" min="0.0" nonzero="0" sup="0" total="0.174" />
+                    <distribution-bars>
+                        <distribution-bar __diff__="-3" count="7" metric="0.0000" ratio="0.46666667" />
+                        <distribution-bar __diff__="1" count="1" metric="0.1110" ratio="0.06666667" />
+                        <distribution-bar __diff__="-1" count="1" metric="0.1250" ratio="0.06666667" />
+                        <distribution-bar __diff__="0" count="1" metric="0.1530" ratio="0.06666667" />
+                        <distribution-bar __diff__="1" count="1" metric="0.1660" ratio="0.06666667" />
+                        <distribution-bar __diff__="1" count="3" metric="0.2000" ratio="0.2" />
+                        <distribution-bar __diff__="1" count="1" metric="0.2500" ratio="0.06666667" />
+                    </distribution-bars>
+                </comments>
+            </std.code.ratio>
             <std.suppress>
                 <count avg="1.0" count="1" max="1" min="1" nonzero="True" sup="0" total="1.0">
                     <__diff__ avg="1.0" count="1" max="1" min="1" nonzero="0" sup="0" total="1.0" />

+ 15 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_txt_all_stdout.gold.txt

@@ -65,6 +65,21 @@
 	             9 : 0.133 : 0.867 :  2 [+1 ]	|||||||||||||
 	            12 : 0.133 : 1.000 :  2 [+1 ]	|||||||||||||
 
+./:: info: Overall metrics for 'std.code.ratio:comments' metric
+	Average        : 0.09366667 [+0.01672917]
+	Minimum        : 0.0 [+0.0]
+	Maximum        : 0.25 [-0.178]
+	Total          : 1.405 [+0.174]
+	Distribution   : 15 [-1] regions in total (including 0 [+0] suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	        0.0000 : 0.467 : 0.467 :  7 [-3 ]	||||||||||||||||||||||||||||||||||||||||||||||
+	        0.1110 : 0.067 : 0.533 :  1 [+1 ]	||||||
+	        0.1250 : 0.067 : 0.600 :  1 [-1 ]	||||||
+	        0.1530 : 0.067 : 0.667 :  1 [+0 ]	||||||
+	        0.1660 : 0.067 : 0.733 :  1 [+1 ]	||||||
+	        0.2000 : 0.200 : 0.933 :  3 [+1 ]	||||||||||||||||||||
+	        0.2500 : 0.067 : 1.000 :  1 [+1 ]	||||||
+
 ./:: info: Overall metrics for 'std.suppress:count' metric
 	Average        : 1.0 [+1.0] (excluding zero metric values)
 	Minimum        : 1 [+1]

+ 13 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_txt_new_stdout.gold.txt

@@ -58,6 +58,19 @@
 	             9 : 0.143 : 0.857 : 1 [+1]	||||||||||||||
 	            12 : 0.143 : 1.000 : 1 [+1]	||||||||||||||
 
+./:: info: Overall metrics for 'std.code.ratio:comments' metric
+	Average        : 0.10385714 [+0.10385714]
+	Minimum        : 0.0 [+0.0]
+	Maximum        : 0.25 [+0.25]
+	Total          : 0.727 [+0.727]
+	Distribution   : 7 [+7] regions in total (including 0 [+0] suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	        0.0000 : 0.429 : 0.429 : 3 [+3]	||||||||||||||||||||||||||||||||||||||||||
+	        0.1110 : 0.143 : 0.571 : 1 [+1]	||||||||||||||
+	        0.1660 : 0.143 : 0.714 : 1 [+1]	||||||||||||||
+	        0.2000 : 0.143 : 0.857 : 1 [+1]	||||||||||||||
+	        0.2500 : 0.143 : 1.000 : 1 [+1]	||||||||||||||
+
 ./:: info: Overall metrics for 'std.suppress:count' metric
 	Average        : 1.0 [+1.0] (excluding zero metric values)
 	Minimum        : 1 [+1]

+ 14 - 0
metrixpp/tests/general/test_basic/test_workflow_view_second_txt_touched_stdout.gold.txt

@@ -64,6 +64,20 @@
 	             9 : 0.182 : 0.909 :  2 [+1 ]	||||||||||||||||||
 	            12 : 0.091 : 1.000 :  1 [+1 ]	|||||||||
 
+./:: info: Overall metrics for 'std.code.ratio:comments' metric
+	Average        : 0.11381818 [+0.02398485]
+	Minimum        : 0.0 [+0.0]
+	Maximum        : 0.25 [-0.178]
+	Total          : 1.252 [+0.174]
+	Distribution   : 11 [-1] regions in total (including 0 [+0] suppressed)
+	  Metric value : Ratio : R-sum : Number of regions
+	        0.0000 : 0.364 : 0.364 :  4 [-3 ]	||||||||||||||||||||||||||||||||||||
+	        0.1110 : 0.091 : 0.455 :  1 [+1 ]	|||||||||
+	        0.1250 : 0.091 : 0.545 :  1 [-1 ]	|||||||||
+	        0.1660 : 0.091 : 0.636 :  1 [+1 ]	|||||||||
+	        0.2000 : 0.273 : 0.909 :  3 [+1 ]	|||||||||||||||||||||||||||
+	        0.2500 : 0.091 : 1.000 :  1 [+1 ]	|||||||||
+
 ./:: info: Overall metrics for 'std.suppress:count' metric
 	Average        : 1.0 [+1.0] (excluding zero metric values)
 	Minimum        : 1 [+1]