Преглед на файлове

catch support for cyclomatic complexity. C# support for cyclomatic complexity

avkonst преди 12 години
родител
ревизия
e585a42d53

+ 16 - 6
mainline/ext/std/code/complexity.py

@@ -32,17 +32,27 @@ class Plugin(core.api.Plugin, core.api.Child, core.api.IConfigurable):
         
     def initialize(self):
         if self.is_active == True:
+            # trigger version property set
+            core.api.Plugin.initialize(self)
             namespace = self.get_plugin_loader().get_database_loader().create_namespace(self.get_name(), support_regions = True)
             namespace.add_field('cyclomatic', int)
             core.api.subscribe_by_parents_name('std.code.cpp', self, 'callback_cpp')
-            # trigger version property set
-            core.api.Plugin.initialize(self)
+            core.api.subscribe_by_parents_name('std.code.cs', self, 'callback_cs')
 
     # cyclomatic complexity pattern
-    pattern = re.compile(r'''([^0-9A-Za-z_]((if)|(case)|(for)|(while))[^0-9A-Za-z_])|[&][&]|[|][|]|[?]''')
+    # - C/C++
+    pattern_cpp = re.compile(r'''([^0-9A-Za-z_]((if)|(case)|(for)|(while)|(catch))[^0-9A-Za-z_])|[&][&]|[|][|]|[?]''')
+    # - C#
+    #   supports Null-coalescing '??' and conditional '?:'
+    pattern_cs = re.compile(r'''([^0-9A-Za-z_]((if)|(case)|(for)|(foreach)|(while)|(catch))[^0-9A-Za-z_])|[&][&]|[|][|]|[?][?]?''')
 
     def callback_cpp(self, parent, data, is_updated):
-        
+        self.callback_common(parent, data, is_updated, self.pattern_cpp)
+
+    def callback_cs(self, parent, data, is_updated):
+        self.callback_common(parent, data, is_updated, self.pattern_cs)
+
+    def callback_common(self, parent, data, is_updated, pattern):
         is_updated = is_updated or self.is_updated
         if is_updated == True:
             text = data.get_content(exclude = data.get_marker_types().ALL_EXCEPT_CODE)
@@ -52,8 +62,8 @@ class Plugin(core.api.Plugin, core.api.Child, core.api.IConfigurable):
                 start_pos = region.get_offset_begin()
                 for sub_id in region.iterate_subregion_ids():
                     # exclude sub regions, like enclosed classes
-                    count += len(self.pattern.findall(text, start_pos, data.get_region(sub_id).get_offset_begin()))
+                    count += len(pattern.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.findall(text, start_pos, region.get_offset_end()))
+                count += len(pattern.findall(text, start_pos, region.get_offset_end()))
                 region.set_data(self.get_name(), 'cyclomatic', count)
 

+ 2 - 2
mainline/ext/std/code/cpp.py

@@ -35,14 +35,14 @@ class Plugin(core.api.Plugin, core.api.Parent, core.api.IParser, core.api.IConfi
         self.files.sort() # sorted list goes to properties
         
     def initialize(self):
-        self.get_plugin_loader().register_parser(self.files, self)
-
         # trigger version property set
         core.api.Plugin.initialize(self)
         db_loader = self.get_plugin_loader().get_database_loader()
         prev_ext = db_loader.set_property(self.get_name() + ":files", ','.join(self.files))
         if prev_ext != ','.join(self.files):
             self.is_updated = True
+
+        self.get_plugin_loader().register_parser(self.files, self)
         
     def process(self, parent, data, is_updated):
         is_updated = is_updated or self.is_updated

+ 2 - 2
mainline/ext/std/code/cs.py

@@ -35,14 +35,14 @@ class Plugin(core.api.Plugin, core.api.Parent, core.api.IParser, core.api.IConfi
         self.files.sort() # sorted list goes to properties
         
     def initialize(self):
-        self.get_plugin_loader().register_parser(self.files, self)
-
         # trigger version property set
         core.api.Plugin.initialize(self)
         db_loader = self.get_plugin_loader().get_database_loader()
         prev_ext = db_loader.set_property(self.get_name() + ":files", ','.join(self.files))
         if prev_ext != ','.join(self.files):
             self.is_updated = True
+
+        self.get_plugin_loader().register_parser(self.files, self)
         
     def process(self, parent, data, is_updated):
         is_updated = is_updated or self.is_updated

+ 1 - 1
mainline/tests/general/test_basic/test_workflow_collect_default_stderr.gold.txt

@@ -2,4 +2,4 @@
 [LOG]: INFO:	Excluding: ./.unused.cpp
 [LOG]: INFO:	Skipping: ./dummy.txt
 [LOG]: INFO:	Processing: ./simple.cpp
-[LOG]: WARNING:	Exit code: 0. Time spent: 0.11 seconds. Done
+[LOG]: WARNING:	Exit code: 0. Time spent: 0.12 seconds. Done

+ 1 - 1
mainline/tests/general/test_basic/test_workflow_limit_default_stderr.gold.txt

@@ -1,4 +1,4 @@
 [LOG]: WARNING:	Logging enabled with INFO level
 [LOG]: INFO:	Processing: 
 [LOG]: INFO:	Applying limit: namespace 'std.code.complexity', filter '('cyclomatic', '>', 0.0)'
-[LOG]: WARNING:	Exit code: 4. Time spent: 0.01 seconds. Done
+[LOG]: WARNING:	Exit code: 4. Time spent: 0.0 seconds. Done

+ 12 - 0
mainline/tests/general/test_std_code_cpp/sources/test2.cpp

@@ -23,6 +23,18 @@ namespace aaa {
 int main(int a, string b)
 {
 	return 0;
+
+	try {
+
+	}
+	catch (a) // for cyclomatic complexity test
+	{
+
+	}
+	catch (b) // for cyclomatic complexity test
+	{
+
+	}
 }
 }
 

+ 1 - 1
mainline/tests/general/test_std_code_cpp/test_parser_export_default_stdout.gold.txt

@@ -10,7 +10,7 @@
         </subdirs>
         <aggregated-data>
             <std.code.complexity>
-                <cyclomatic max="2" total="15.0" avg="0.180722891566" min="0" />
+                <cyclomatic max="2" total="17.0" avg="0.204819277108" min="0" />
             </std.code.complexity>
         </aggregated-data>
     </data>

+ 10 - 10
mainline/tests/general/test_std_code_cpp/test_parser_export_files_stdout.gold.txt

@@ -1133,10 +1133,10 @@ data:
 .   .   .   .   info: 
 .   .   .   .   .   cursor="0"
 .   .   .   .   .   name="__global__"
-.   .   .   .   .   offset_end="512"
+.   .   .   .   .   offset_end="628"
 .   .   .   .   .   line_begin="1"
 .   .   .   .   .   type="global"
-.   .   .   .   .   line_end="41"
+.   .   .   .   .   line_end="53"
 .   .   .   .   .   offset_begin="0"
 .   .   .   .   data: 
 .   .   
@@ -1194,10 +1194,10 @@ data:
 .   .   .   .   info: 
 .   .   .   .   .   cursor="22"
 .   .   .   .   .   name="aaa"
-.   .   .   .   .   offset_end="234"
+.   .   .   .   .   offset_end="350"
 .   .   .   .   .   line_begin="21"
 .   .   .   .   .   type="namespace"
-.   .   .   .   .   line_end="27"
+.   .   .   .   .   line_end="39"
 .   .   .   .   .   offset_begin="173"
 .   .   .   .   data: 
 .   .   
@@ -1205,22 +1205,22 @@ data:
 .   .   .   .   info: 
 .   .   .   .   .   cursor="23"
 .   .   .   .   .   name="main"
-.   .   .   .   .   offset_end="232"
+.   .   .   .   .   offset_end="348"
 .   .   .   .   .   line_begin="23"
 .   .   .   .   .   type="function"
-.   .   .   .   .   line_end="26"
+.   .   .   .   .   line_end="38"
 .   .   .   .   .   offset_begin="192"
 .   .   .   .   data:  
 .   .   .   .   .   std.code.complexity: 
-.   .   .   .   .   .   cyclomatic="0"
+.   .   .   .   .   .   cyclomatic="2"
 .   subfiles:
 .   subdirs:
 .   aggregated-data:  
 .   .   std.code.complexity:  
 .   .   .   cyclomatic: 
-.   .   .   .   max="1"
-.   .   .   .   total="1.0"
-.   .   .   .   avg="0.25"
+.   .   .   .   max="2"
+.   .   .   .   total="3.0"
+.   .   .   .   avg="0.75"
 .   .   .   .   min="0"
 ================================================================================
 --------------------------------------------------------------------------------

+ 8 - 0
mainline/tests/general/test_std_code_cpp/test_parser_limit_default_stdout.gold.txt

@@ -62,6 +62,14 @@
 	Change trend   : None
 	Limit          : 0.0
 
+./test2.cpp:23: warning: Metric 'std.code.complexity/cyclomatic' for region 'main' exceeds the limit.
+	Metric name    : std.code.complexity/cyclomatic
+	Region name    : main
+	Metric value   : 2
+	Modified       : None
+	Change trend   : None
+	Limit          : 0.0
+
 ./test3.cpp:39: warning: Metric 'std.code.complexity/cyclomatic' for region 'doColor' exceeds the limit.
 	Metric name    : std.code.complexity/cyclomatic
 	Region name    : doColor

+ 6 - 0
mainline/tests/general/test_std_code_cs/sources/File.cs

@@ -426,6 +426,12 @@ internal sealed class File // surprise
 	public void Unlock(long fromRecord, long toRecord)
 			{
 				// TODO
+				try
+				{
+				}
+				catch(a) // to test cyclomatic complexity
+				{
+				}
 			}
 
 }; // class File

+ 1 - 1
mainline/tests/general/test_std_code_cs/test_parser_export_default_stdout.gold.txt

@@ -10,7 +10,7 @@
         </subdirs>
         <aggregated-data>
             <std.code.complexity>
-                <cyclomatic max="None" total="0.0" avg="None" min="None" />
+                <cyclomatic max="39" total="45.0" avg="2.04545454545" min="0" />
             </std.code.complexity>
         </aggregated-data>
     </data>

+ 84 - 40
mainline/tests/general/test_std_code_cs/test_parser_export_files_stdout.gold.txt

@@ -14,10 +14,10 @@ data:
 .   .   .   .   info: 
 .   .   .   .   .   cursor="0"
 .   .   .   .   .   name="__global__"
-.   .   .   .   .   offset_end="9063"
+.   .   .   .   .   offset_end="9141"
 .   .   .   .   .   line_begin="1"
 .   .   .   .   .   type="global"
-.   .   .   .   .   line_end="442"
+.   .   .   .   .   line_end="448"
 .   .   .   .   .   offset_begin="0"
 .   .   .   .   data: 
 .   .   .   .   subregions:
@@ -26,10 +26,10 @@ data:
 .   .   .   .   .   .   info: 
 .   .   .   .   .   .   .   cursor="21"
 .   .   .   .   .   .   .   name="Microsoft.VisualBasic"
-.   .   .   .   .   .   .   offset_end="9026"
+.   .   .   .   .   .   .   offset_end="9104"
 .   .   .   .   .   .   .   line_begin="21"
 .   .   .   .   .   .   .   type="namespace"
-.   .   .   .   .   .   .   line_end="441"
+.   .   .   .   .   .   .   line_end="447"
 .   .   .   .   .   .   .   offset_begin="855"
 .   .   .   .   .   .   data: 
 .   .   .   .   .   .   subregions:
@@ -38,12 +38,14 @@ data:
 .   .   .   .   .   .   .   .   info: 
 .   .   .   .   .   .   .   .   .   cursor="31"
 .   .   .   .   .   .   .   .   .   name="other_template"
-.   .   .   .   .   .   .   .   .   offset_end="8959"
+.   .   .   .   .   .   .   .   .   offset_end="9037"
 .   .   .   .   .   .   .   .   .   line_begin="30"
 .   .   .   .   .   .   .   .   .   type="function"
-.   .   .   .   .   .   .   .   .   line_end="431"
+.   .   .   .   .   .   .   .   .   line_end="437"
 .   .   .   .   .   .   .   .   .   offset_begin="1012"
-.   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   cyclomatic="39"
 .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -67,17 +69,19 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   .   .   line_end="240"
 .   .   .   .   .   .   .   .   .   .   .   .   .   offset_begin="4943"
-.   .   .   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   .   .   subregions:
 .   subfiles:
 .   subdirs:
 .   aggregated-data:  
 .   .   std.code.complexity:  
 .   .   .   cyclomatic: 
-.   .   .   .   max="None"
-.   .   .   .   total="0.0"
-.   .   .   .   avg="None"
-.   .   .   .   min="None"
+.   .   .   .   max="39"
+.   .   .   .   total="39.0"
+.   .   .   .   avg="19.5"
+.   .   .   .   min="0"
 ================================================================================
 --------------------------------------------------------------------------------
 data:  
@@ -144,7 +148,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="43"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="1391"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -156,7 +162,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="48"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="1464"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -168,7 +176,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="56"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="1552"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="1"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   
 .   .   .   .   .   .   .   subregion:  
@@ -204,7 +214,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="73"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="1960"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   
 .   .   .   .   .   .   .   subregion:  
@@ -228,7 +240,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="81"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="2130"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   
 .   .   .   .   .   .   .   subregion:  
@@ -240,7 +254,9 @@ data:
 .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   line_end="94"
 .   .   .   .   .   .   .   .   .   offset_begin="2698"
-.   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   
 .   .   .   .   .   .   .   subregion:  
@@ -252,7 +268,9 @@ data:
 .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   line_end="98"
 .   .   .   .   .   .   .   .   .   offset_begin="2802"
-.   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   
 .   .   .   .   .   .   .   subregion:  
@@ -264,17 +282,19 @@ data:
 .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   line_end="104"
 .   .   .   .   .   .   .   .   .   offset_begin="2879"
-.   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   subregions:
 .   subfiles:
 .   subdirs:
 .   aggregated-data:  
 .   .   std.code.complexity:  
 .   .   .   cyclomatic: 
-.   .   .   .   max="None"
-.   .   .   .   total="0.0"
-.   .   .   .   avg="None"
-.   .   .   .   min="None"
+.   .   .   .   max="1"
+.   .   .   .   total="1.0"
+.   .   .   .   avg="0.125"
+.   .   .   .   min="0"
 ================================================================================
 --------------------------------------------------------------------------------
 data:  
@@ -353,7 +373,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="83"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="2288"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -365,7 +387,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="92"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="2802"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -377,7 +401,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="102"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="3073"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -389,7 +415,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="112"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="3336"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -401,7 +429,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="122"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="3602"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -413,7 +443,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="131"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="3863"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -425,7 +457,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="146"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="3954"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="1"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -437,7 +471,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="152"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="4354"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -449,7 +485,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="195"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="5003"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="4"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -461,7 +499,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="201"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="5946"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -473,7 +513,9 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="207"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="6134"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   .   .   .   .   .   .   .   
 .   .   .   .   .   .   .   .   .   subregion:  
@@ -485,17 +527,19 @@ data:
 .   .   .   .   .   .   .   .   .   .   .   type="function"
 .   .   .   .   .   .   .   .   .   .   .   line_end="213"
 .   .   .   .   .   .   .   .   .   .   .   offset_begin="6302"
-.   .   .   .   .   .   .   .   .   .   data: 
+.   .   .   .   .   .   .   .   .   .   data:  
+.   .   .   .   .   .   .   .   .   .   .   std.code.complexity: 
+.   .   .   .   .   .   .   .   .   .   .   .   cyclomatic="0"
 .   .   .   .   .   .   .   .   .   .   subregions:
 .   subfiles:
 .   subdirs:
 .   aggregated-data:  
 .   .   std.code.complexity:  
 .   .   .   cyclomatic: 
-.   .   .   .   max="None"
-.   .   .   .   total="0.0"
-.   .   .   .   avg="None"
-.   .   .   .   min="None"
+.   .   .   .   max="4"
+.   .   .   .   total="5.0"
+.   .   .   .   avg="0.416666666667"
+.   .   .   .   min="0"
 ================================================================================
 
 

+ 32 - 0
mainline/tests/general/test_std_code_cs/test_parser_limit_default_stdout.gold.txt

@@ -0,0 +1,32 @@
+./File.cs:31: warning: Metric 'std.code.complexity/cyclomatic' for region 'other_template' exceeds the limit.
+	Metric name    : std.code.complexity/cyclomatic
+	Region name    : other_template
+	Metric value   : 39
+	Modified       : None
+	Change trend   : None
+	Limit          : 0.0
+
+./Generics.cs:50: warning: Metric 'std.code.complexity/cyclomatic' for region 'Grow' exceeds the limit.
+	Metric name    : std.code.complexity/cyclomatic
+	Region name    : Grow
+	Metric value   : 1
+	Modified       : None
+	Change trend   : None
+	Limit          : 0.0
+
+./interface.cs:135: warning: Metric 'std.code.complexity/cyclomatic' for region 'Equals' exceeds the limit.
+	Metric name    : std.code.complexity/cyclomatic
+	Region name    : Equals
+	Metric value   : 1
+	Modified       : None
+	Change trend   : None
+	Limit          : 0.0
+
+./interface.cs:169: warning: Metric 'std.code.complexity/cyclomatic' for region 'ToTitleCase' exceeds the limit.
+	Metric name    : std.code.complexity/cyclomatic
+	Region name    : ToTitleCase
+	Metric value   : 4
+	Modified       : None
+	Change trend   : None
+	Limit          : 0.0
+