From a6bccfe1d67b2fb3a83367dbb47351c9bd36ff05 Fri, 6 Jan 2012 10:36:10 +0100
From: Bram Goffings <bramgoffings@gmail.com>
Date: Fri, 6 Jan 2012 10:36:04 +0100
Subject: [PATCH] QSD

diff --git a/coder_tough_love.module b/coder_tough_love.module
index be4bee4..9854535 100644
--- a/coder_tough_love.module
+++ b/coder_tough_love.module
@@ -154,6 +154,7 @@
 function _coder_tough_love_admin_menu_descriptions(&$coder_args, $review, $rule, $lines, &$results) {
   $potentially_inside_a_hook_menu = FALSE;
   $saw_a_description = FALSE;
+  $needs_a_description = TRUE;
   $potentially_found_an_admin_path = FALSE;
 
   foreach ((array)$lines as $line_number => $line) {
@@ -176,14 +177,25 @@
       }
     }
 
+    // Ignore MENU_CALLBACK and MENU_DEFAULT_LOCAL_TASK
+    if ($potentially_inside_a_hook_menu && $potentially_found_an_admin_path) {
+      if (preg_match('/[\'"]type[\'"]\s*=>/', $line)) {
+        if (preg_match('/MENU_CALLBACK/', $line) || preg_match('/MENU_DEFAULT_LOCAL_TASK/', $line)) {
+          $needs_a_description = FALSE;
+        }
+      }
+    }
+
     // if we've found any sort of ");", we assume the menu's array is done.
     if ($potentially_inside_a_hook_menu && $potentially_found_an_admin_path && preg_match("/\);/", $line)) {
-      if (!$saw_a_description) { // if there's no description for an admin path, yell. loudly. HORSE HEAD!
+      if (!$saw_a_description && $needs_a_description) { // if there's no description for an admin path, yell. loudly. HORSE HEAD!
         _coder_review_error($results, $rule, _coder_review_severity_name($coder_args, $review, $rule), $potentially_found_an_admin_path);
       }
 
       // reset for the next iteration, bub.
       $saw_a_description = $potentially_found_an_admin_path = FALSE;
+      $needs_a_description = TRUE;
     }
 
     // are we inside a function that ends in _menu?
