소스 검색

Minor change

avkonst 10 년 전
부모
커밋
8acafc603e

+ 4 - 5
mainline/CHANGELOG.md

@@ -1,10 +1,9 @@
-## 1.4 (May, 2014)
-- New metric: std.code.mi:simple - simple implemetation of maintainability index.
+## 1.4 (June, 2014)
+- Fixed match of names of generic functions and classes 
+- New metrics group: std.code.member.* - counting of classes, fields, globals, etc.
+- New metric: std.code.maintindex:simple - simple implemetation of maintainability index.
 - New configuration option for collect tool: --include-files (symetrical to --exclude-files)
 - New metrics: lines of code metrics per file
-- New metrics: std.code.member.* group
-- Fixed match of names of generic functions and classes 
-
 
 ## 1.3 (August, 2013)
 - Deprecated and dropped support for callback based implementation of advanced counters

+ 11 - 2
mainline/ext/std/tools/collect.py

@@ -25,6 +25,7 @@ import logging
 import time
 import binascii
 import fnmatch
+import multiprocessing.pool
 
 class Plugin(mpp.api.Plugin, mpp.api.Parent, mpp.api.IConfigurable, mpp.api.IRunable):
     
@@ -124,7 +125,7 @@ class DirectoryReader():
         IS_TEST_MODE = False
         if 'METRIXPLUSPLUS_TEST_MODE' in os.environ.keys():
             IS_TEST_MODE = True
-        
+
         def run_per_file(plugin, fname, full_path):
             exit_code = 0
             norm_path = re.sub(r'''[\\]''', "/", full_path)
@@ -157,17 +158,25 @@ class DirectoryReader():
                         if plugin.is_size_enabled == True:
                             data.set_data('std.general', 'size', len(text))
                         db_loader.save_file_data(data)
-                        logging.debug("-" * 60)
+                        #logging.debug("-" * 60)
                         exit_code += procerrors
             else:
                 logging.info("Excluding: " + norm_path)
             return exit_code
         
+
+        #thread_pool = multiprocessing.pool.ThreadPool()
+        #def mp_worker(args):
+        #    run_per_file(args[0], args[1], args[2])
         def run_recursively(plugin, directory):
             exit_code = 0
+            #thread_pool.map(mp_worker,
+            #    [(plugin, f, os.path.join(subdir, f))
+            #        for subdir, dirs, files in os.walk(directory) for f in files])
             for fname in sorted(os.listdir(directory)):
                 full_path = os.path.join(directory, fname)
                 exit_code += run_per_file(plugin, fname, full_path)
+            
             return exit_code
         
         if os.path.exists(directory) == False:

+ 2 - 2
mainline/mpp/internal/dbwrap.py

@@ -210,7 +210,7 @@ class Database(object):
             logging.debug("Cloning database file: " + clone_from)
             shutil.copy2(clone_from, file_name)
             logging.debug("Connecting database file: " + file_name)
-            self.conn = sqlite3.connect(file_name)
+            self.conn = sqlite3.connect(file_name, check_same_thread=False)
             self.conn.row_factory = sqlite3.Row
             self.read_only = False
             
@@ -233,7 +233,7 @@ class Database(object):
         
     def connect(self, file_name, read_only = False):
         logging.debug("Connecting database file: " + file_name)
-        self.conn = sqlite3.connect(file_name)
+        self.conn = sqlite3.connect(file_name, check_same_thread=False)
         self.conn.row_factory = sqlite3.Row
         self.read_only = read_only
         if self.read_only == False:

+ 7 - 0
mainline/tests/general/test_std_code_cs_unit/sources/sample.cs

@@ -137,4 +137,11 @@ public class example
         where T : class
     {
     }
+
+    protected IList<T> Interface<T, S, A, B,   C>.testfunction18<T, S, A, V, F, G>(string text1)
+    {
+        List<int> numbers = new List<int>();
+        return numbers;
+    }
+
 }

+ 2 - 2
mainline/tests/general/test_std_code_cs_unit/test_parser_view_default_stdout.gold.txt

@@ -10,9 +10,9 @@
         </subdirs>
         <aggregated-data>
             <std.code.complexity>
-                <cyclomatic avg="0.0" count="17" max="0" min="0" nonzero="False" sup="0" total="0.0">
+                <cyclomatic avg="0.0" count="18" max="0" min="0" nonzero="False" sup="0" total="0.0">
                     <distribution-bars>
-                        <distribution-bar count="17" metric="0" ratio="1.0" />
+                        <distribution-bar count="18" metric="0" ratio="1.0" />
                     </distribution-bars>
                 </cyclomatic>
             </std.code.complexity>

+ 14 - 6
mainline/tests/general/test_std_code_cs_unit/test_parser_view_files_stdout.gold.txt

@@ -1,15 +1,15 @@
 ./sample.cs:0: info: Metrics per '__global__' region
 	Region name    : __global__
 	Region type    : global
-	Offsets        : 0-2860
-	Line numbers   : 1-141
+	Offsets        : 0-3040
+	Line numbers   : 1-148
 	Modified       : None
 
 .   ./sample.cs:3: info: Metrics per 'example' region
     	Region name    : example
     	Region type    : class
-    	Offsets        : 2-2859
-    	Line numbers   : 3-140
+    	Offsets        : 2-3039
+    	Line numbers   : 3-147
     	Modified       : None
 
 .   .   ./sample.cs:5: info: Metrics per 'testfunction1' region
@@ -197,13 +197,21 @@
         	Line numbers   : 136-139
         	Modified       : None
 
+.   .   ./sample.cs:141: info: Metrics per 'Interface<T,S,A,B,C>.testfunction18<T,S,A,V,F,G>' region
+        	Region name    : Interface<T,S,A,B,C>.testfunction18<T,S,A,V,F,G>
+        	Region type    : function
+        	Offsets        : 2863-3036
+        	Line numbers   : 141-145
+        	Modified       : None
+        	std.code.complexity:cyclomatic: 0
+
 ./sample.cs:: info: Overall metrics for 'std.code.complexity:cyclomatic' metric
 	Average        : 0.0
 	Minimum        : 0
 	Maximum        : 0
 	Total          : 0.0
-	Distribution   : 17 regions in total (including 0 suppressed)
+	Distribution   : 18 regions in total (including 0 suppressed)
 	  Metric value : Ratio : R-sum : Number of regions
-	             0 : 1.000 : 1.000 : 17	||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+	             0 : 1.000 : 1.000 : 18	||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||