Quellcode durchsuchen

finished todo markers counter plugin

avkonst vor 11 Jahren
Ursprung
Commit
240aba4052

+ 2 - 0
mainline/CHANGELOG.md

@@ -1,6 +1,8 @@
 ## 1.3 (August, 2013)
 - Deprecated and dropped support for callback based implementation of advanced counters
 (use MetricPluginMixin.*Counter classes instead)
+- New metric: std.code.todo:comments - number of todo markers in comments.
+- New metric: std.code.todo:strings - number of todo markers in strings.
 
 ## 1.2 (August, 2013)
 - **Feature** suppressions capability for limit tool

+ 7 - 0
mainline/doc/home.html

@@ -368,6 +368,13 @@ class WeekClass {
                 	The <a href="http://stackoverflow.com/questions/47882/what-is-a-magic-number-and-why-is-it-bad" target="blank">
                 		discussion on stackoverflow</a> explains why.</td>
               </tr>
+              <tr>
+                <td>std.code.todo.comments, std.code.todo.strings</td>
+                <td>Number of TODO/FIXME/etc markers in comments and strings accordingly.
+                	There is an option to configure a list of markers.</td>
+                <td>Manage potentially incomplete work. If project manager dispatches issues only in a tracker tool,
+                	todo markers are lost in the source code. The metric could make these 'lost' issues visible.</td>
+              </tr>
               <tr>
                 <td>std.suppress</td>
                 <td>An option enables collection of Metrix++ suppressions and 2 metrics: 'std.suppress:count' and 

+ 3 - 1
mainline/ext/std/code/todo.py

@@ -46,7 +46,9 @@ class Plugin(mpp.api.Plugin,
             if re.match(r'''^[A-Za-z0-9]+$''', tag) == None:
                 self.parser.error('option --std.code.todo.tags: tag {0} includes not allowed symbols'.
                                   format(tag))
-        self.pattern_to_search = re.compile('([^a-zA-Z]({0})(?=[^a-zA-Z]))|([^a-zA-Z]({0})$)'.format('|'.join(self.tags_list)))
+        self.pattern_to_search = re.compile(
+            r'\b({0})\b'.
+            format('|'.join(self.tags_list)))
 
     def initialize(self):
         self.declare_metric(self.is_active_comments,

+ 3 - 3
mainline/tests/general/test_std_code_todo/sources/test.cpp

@@ -9,9 +9,9 @@ int main()
 	//HACK is here
 	//XXX is here
 	//All here: TODO,ToDo,FIXME,FixMe,TBD,HACK,XXX
-	// no heretodoss
-	// no heretodo
-	// no todoss
+	// no hereTODOss
+	// no hereTODO
+	// no TODOss
 	//TOBEDONE
 	char a[] = "TODO string TOBEDONE";
 }

+ 6 - 6
mainline/tests/general/test_std_code_todo/sources/test.cs

@@ -19,17 +19,17 @@ class MainClass
 		//HACK is here
 		//XXX is here
 		//All here: TODO,ToDo,FIXME,FixMe,TBD,HACK,XXX
-		// no heretodoss
-		// no heretodo
-		// no todoss
+		// no hereTODOss
+		// no hereTODO
+		// no TODOss
 		//TOBEDONE
 		
 		char a[] = "TODO string TOBEDONE";
 	}
 
 		//All here: TODO,ToDo,FIXME,FixMe,TBD,HACK,XXX
-		// no heretodoss
-		// no heretodo
-		// no todoss
+		// no hereTODOss
+		// no hereTODO
+		// no TODOss
 		//TOBEDONE
 }

+ 14 - 10
mainline/tests/general/test_std_code_todo/test_strings_view_files_stdout.gold.txt

@@ -11,14 +11,16 @@
     	Offsets        : 1-272
     	Line numbers   : 2-17
     	Modified       : None
+    	std.code.todo:strings: 1
 
 ./test.cpp:: info: Overall metrics for 'std.code.todo:strings' metric
-	Average        : None (excluding zero metric values)
-	Minimum        : None
-	Maximum        : None
-	Total          : 0.0
-	Distribution   : 0 regions in total (including 0 suppressed)
+	Average        : 1.0 (excluding zero metric values)
+	Minimum        : 1
+	Maximum        : 1
+	Total          : 1.0
+	Distribution   : 1 regions in total (including 0 suppressed)
 	  Metric value : Ratio : R-sum : Number of regions
+	             1 : 1.000 : 1.000 : 1	||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 
 ./test.cs:0: info: Metrics per '__global__' region
 	Region name    : __global__
@@ -40,13 +42,15 @@
         	Offsets        : 141-430
         	Line numbers   : 12-28
         	Modified       : None
+        	std.code.todo:strings: 1
 
 ./test.cs:: info: Overall metrics for 'std.code.todo:strings' metric
-	Average        : None (excluding zero metric values)
-	Minimum        : None
-	Maximum        : None
-	Total          : 0.0
-	Distribution   : 0 regions in total (including 0 suppressed)
+	Average        : 1.0 (excluding zero metric values)
+	Minimum        : 1
+	Maximum        : 1
+	Total          : 1.0
+	Distribution   : 1 regions in total (including 0 suppressed)
 	  Metric value : Ratio : R-sum : Number of regions
+	             1 : 1.000 : 1.000 : 1	||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 
 

+ 5 - 5
mainline/tests/general/test_std_code_todo/test_tags_view_default_stdout.gold.txt

@@ -1,11 +1,11 @@
 :: info: Overall metrics for 'std.code.todo:strings' metric
-	Average        : 1.0 (excluding zero metric values)
-	Minimum        : 1
-	Maximum        : 1
-	Total          : 2.0
+	Average        : 2.0 (excluding zero metric values)
+	Minimum        : 2
+	Maximum        : 2
+	Total          : 4.0
 	Distribution   : 2 regions in total (including 0 suppressed)
 	  Metric value : Ratio : R-sum : Number of regions
-	             1 : 1.000 : 1.000 : 2	||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+	             2 : 1.000 : 1.000 : 2	||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 
 :: info: Overall metrics for 'std.code.todo:comments' metric
 	Average        : 5.0 (excluding zero metric values)