? 180226.patch
? t.patch
Index: coder.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/coder/coder.module,v
retrieving revision 1.55.2.19.4.22
diff -u -u -p -r1.55.2.19.4.22 coder.module
--- coder.module	26 Feb 2008 12:43:00 -0000	1.55.2.19.4.22
+++ coder.module	26 Feb 2008 13:07:05 -0000
@@ -1233,15 +1233,13 @@ function do_coder_review($coder_args, $r
  */
 function do_coder_review_regex(&$coder_args, $review, $rule, $lines, &$results) {
   if (isset($rule['#value'])) {
-    $regex = '/'. $rule['#value'] .'/';
-    if (!isset($rule['#case-sensitive'])) {
-      $regex .= 'i';
-    }
+    $regexflags = isset($rule['#case-sensitive']) ? '' : 'i';
+    $regex = '/'. $rule['#value'] .'/'. $regexflags;
     $function_regex = isset($rule['#function']) ? '/'. $rule['#function'] .'/' : '';
     $current_function = '';
     $paren = 0;
-    $not_regex = isset($rule['#not']) ? '/'. $rule['#not'] .'/i' : '';
-    $never_regex = isset($rule['#never']) ? '/'. $rule['#never'] .'/i' : '';
+    $not_regex = isset($rule['#not']) ? '/'. $rule['#not'] .'/'. $regexflags : '';
+    $never_regex = isset($rule['#never']) ? '/'. $rule['#never'] .'/'. $regexflags : '';
     foreach ($lines as $lineno => $line) {
       // Some rules apply only within certain functions.
       if ($function_regex) {
Index: includes/coder_6x.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/coder/includes/coder_6x.inc,v
retrieving revision 1.17.4.43
diff -u -u -p -r1.17.4.43 coder_6x.inc
--- includes/coder_6x.inc	20 Feb 2008 14:52:17 -0000	1.17.4.43
+++ includes/coder_6x.inc	26 Feb 2008 13:07:05 -0000
@@ -115,7 +115,7 @@ function coder_6x_reviews() {
       '#type' => 'regex',
       '#source' => 'allphp',
       '#value' => '\$form\s*\[\s*[\'"]#validate[\'"]\]\[[\'"]',
-      '#warning' => 'Validation for specific form elements now uses the #element_validate property',
+      '#warning_callback' => '_coder_6x_formapi_element_validate_warning',
     ),
     array(
       '#type' => 'regex',
@@ -137,7 +137,7 @@ function coder_6x_reviews() {
       '#type' => 'regex',
       '#value' => '\$form\[[\'"]#submit[\'"]\]\[[\'"]',
       '#source' => 'allphp',
-      '#warning' => '$form[\'#submit\'] and $form[\'#validate\'] no longer support custom parameters',
+      '#warning_callback' => '_coder_6x_formapi_custom_params_warning',
     ),
     array(
       '#type' => 'regex',
@@ -655,6 +655,13 @@ function _coder_6x_file_check_upload_war
   );
 }
 
+function _coder_6x_formapi_element_validate_warning() {
+  return array(
+      '#warning' => 'Validation for specific form elements now uses the #element_validate property',
+      '#link' => 'http://drupal.org/node/144132#element-validate',
+  );
+}
+
 function _coder_6x_form_validate_and_submit_warning() {
   return array(
     '#warning' => t('The parameters for form validation and submission functions have changed to $form, &$form_state.'),
@@ -669,6 +676,13 @@ function _coder_6x_form_prerender_warnin
   );
 }
 
+function _coder_6x_formapi_custom_params_warning() {
+  return array(
+    '#warning' => '$form[\'#submit\'] and $form[\'#validate\'] no longer support custom parameters',
+    '#link' => 'http://drupal.org/node/144132#custom-params',
+  );
+}
+
 function _coder_6x_form_set_value_warning() {
   return array(
     '#warning' => t('!form_set_value() parameters have changed',
Index: includes/coder_style.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/coder/includes/coder_style.inc,v
retrieving revision 1.4.4.7.4.11
diff -u -u -p -r1.4.4.7.4.11 coder_style.inc
--- includes/coder_style.inc	1 Feb 2008 12:54:18 -0000	1.4.4.7.4.11
+++ includes/coder_style.inc	26 Feb 2008 13:07:05 -0000
@@ -114,12 +114,6 @@ function coder_style_reviews() {
     ),
     array(
       '#type' => 'regex',
-      '#value' => '\[\s*[a-z][a-z0-9_]+\\s*]',
-      '#warning' => 'use quotes around a string literal array index, this is not only a style issue, but a known performance problem',
-      '#case-sensitive' => TRUE,
-    ),
-    array(
-      '#type' => 'regex',
       '#value' => '\s(if|elseif|while|foreach|switch|return|for|catch)\s*\(.*\) \s*{\s*[^\s]+',
       '#warning' => 'The control statement should be on a separate line from the control conditional',
     ),
@@ -130,6 +124,13 @@ function coder_style_reviews() {
       '#warning' => 'There should be no trailing spaces',
       '#severity' => 'minor',
     ),
+    array(
+      '#type' => 'regex',
+      '#value' => '\[\s*[A-Za-z][A-Za-z0-9_]*\s*]',
+      '#not' => '\[\s*[A-Z][A-Z0-9_]*\s*]',
+      '#warning' => 'use quotes around a string literal array index, this is not only a style issue, but a known performance problem',
+      '#case-sensitive' => TRUE,
+    ),
   );
   $review = array(
     '#title' => t('Drupal Coding Standards'),
Index: tests/coder_style.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/coder/tests/coder_style.inc,v
retrieving revision 1.1.4.2.4.7
diff -u -u -p -r1.1.4.2.4.7 coder_style.inc
--- tests/coder_style.inc	19 Feb 2008 14:28:36 -0000	1.1.4.2.4.7
+++ tests/coder_style.inc	26 Feb 2008 13:07:05 -0000
@@ -10,6 +10,11 @@
  * admin/coder/coder.
  */
 
+function coder_array_ticks() {
+  $some_array[FOO_BAR] = $baz; // This is ok.
+  $some_array[foo] = $baz; // This is not.
+}
+
 function coder_test_tab() {
   // Tab in	comment - is this ok?
   $var = 'tab in	quote'; // Is this ok?
