@@ -84,8 +84,8 @@ function coder_review_reviews() {
84
84
* @see _coder_review_get_default_settings()
85
85
*/
86
86
function _coder_review_default_reviews () {
87
- // Do not use backdrop_map_assoc() so that this will run without Backdrop being
88
- // bootstraped.
87
+ // Do not use backdrop_map_assoc() so that this will run without Backdrop
88
+ // being bootstraped.
89
89
return array (
90
90
'style ' => 'style ' ,
91
91
'sql ' => 'sql ' ,
@@ -200,7 +200,12 @@ function do_coder_reviews(array $coder_args) {
200
200
}
201
201
}
202
202
203
- $ results ['#stats ' ] = array ('minor ' => 0 , 'normal ' => 0 , 'critical ' => 0 , 'ignored ' => 0 );
203
+ $ results ['#stats ' ] = array (
204
+ 'minor ' => 0 ,
205
+ 'normal ' => 0 ,
206
+ 'critical ' => 0 ,
207
+ 'ignored ' => 0 ,
208
+ );
204
209
205
210
// Skip PHP include files when the user requested severity is above minor.
206
211
if (isset ($ coder_args ['#php_minor ' ]) && _substr ($ coder_args ['#filename ' ], -4 ) == '.php ' ) {
@@ -301,10 +306,19 @@ function theme_coder_review_warning($variables) {
301
306
}
302
307
if ($ lineno ) {
303
308
if ($ lineno > 0 ) {
304
- $ warning = _t ('Line @number: !warning [@review_@rule] ' , array ('@number ' => $ lineno , '!warning ' => $ warning , '@review ' => $ review_name , '@rule ' => $ rule_name ));
309
+ $ warning = _t ('Line @number: !warning [@review_@rule] ' , array (
310
+ '@number ' => $ lineno ,
311
+ '!warning ' => $ warning ,
312
+ '@review ' => $ review_name ,
313
+ '@rule ' => $ rule_name ,
314
+ ));
305
315
}
306
316
else {
307
- $ warning = _t ('File: !warning [@review_@rule] ' , array ('!warning ' => $ warning , '@review ' => $ review_name , '@rule ' => $ rule_name ));
317
+ $ warning = _t ('File: !warning [@review_@rule] ' , array (
318
+ '!warning ' => $ warning ,
319
+ '@review ' => $ review_name ,
320
+ '@rule ' => $ rule_name ,
321
+ ));
308
322
}
309
323
if ($ line ) {
310
324
$ warning .= '<pre> ' . check_plain ($ line ) . '</pre> ' ;
@@ -451,7 +465,7 @@ function _coder_review_read_and_parse_file(array &$coder_args) {
451
465
// Get the current character.
452
466
$ char = $ content [$ pos ];
453
467
// Look ahead to the next character, to cater for \r\n line ends.
454
- $ next_char = isset ($ content [$ pos+ 1 ]) ? $ content [$ pos+ 1 ] : '' ;
468
+ $ next_char = isset ($ content [$ pos + 1 ]) ? $ content [$ pos + 1 ] : '' ;
455
469
if ($ char == "\n" || $ char . $ next_char == "\r\n" ) {
456
470
// End C++ style comments on newline.
457
471
if ($ in_comment === '/ ' || $ in_comment === '# ' ) {
@@ -577,8 +591,10 @@ function _coder_review_read_and_parse_file(array &$coder_args) {
577
591
}
578
592
579
593
elseif ($ in_heredoc ) {
580
- // @note: backdrop_substr does not properly handle multi-byte characters in this string.
581
- // @todo: check other places where the backdrop_ string functions fail.
594
+ // @note: backdrop_substr does not properly handle multi-byte
595
+ // characters in this string.
596
+ // @todo: check other places where the backdrop_ string functions
597
+ // fail.
582
598
if ($ beginning_of_line && $ char == $ in_heredoc [0 ] && substr ($ content , $ pos , $ in_heredoc_length ) == $ in_heredoc ) {
583
599
$ this_all_lines .= _substr ($ content , $ pos + 1 , $ in_heredoc_length - 1 );
584
600
$ in_heredoc = 0 ;
@@ -923,7 +939,14 @@ function _coder_review_severity_name(array $coder_args, array $review, array $ru
923
939
* @see _coder_review_read_and_parse_file()
924
940
*/
925
941
function do_coder_review (array $ coder_args , array $ review ) {
926
- $ results = array ('#stats ' => array ('minor ' => 0 , 'normal ' => 0 , 'critical ' => 0 , 'ignored ' => 0 ));
942
+ $ results = array (
943
+ '#stats ' => array (
944
+ 'minor ' => 0 ,
945
+ 'normal ' => 0 ,
946
+ 'critical ' => 0 ,
947
+ 'ignored ' => 0 ,
948
+ ),
949
+ );
927
950
$ allowed_extensions = array_merge (
928
951
$ coder_args ['#php_extensions ' ],
929
952
$ coder_args ['#include_extensions ' ],
@@ -1024,9 +1047,13 @@ function do_coder_review(array $coder_args, array $review) {
1024
1047
* regular expression string.
1025
1048
*
1026
1049
* @param array $coder_args
1027
- * A Coder settings array, passed by reference. See do_coder_review() for format.
1050
+ * A Coder settings array, passed by reference. See do_coder_review() for
1051
+ * format.
1052
+ *
1028
1053
* @param array $review
1029
- * Review array the current rule belongs to, used by _coder_review_severity_name().
1054
+ * Review array the current rule belongs to, used by
1055
+ * _coder_review_severity_name().
1056
+ *
1030
1057
* @param array $rule
1031
1058
* Rule array being checked.
1032
1059
* @param array $lines
@@ -1054,7 +1081,7 @@ function do_coder_review_regex(array &$coder_args, array $review, array $rule, a
1054
1081
if (preg_match ($ regex , $ line , $ matches )) {
1055
1082
// Some rules apply only within certain functions and classes.
1056
1083
list ($ class_current , $ function_current ) = isset ($ coder_args ['#stack ' ][$ lineno ]) ? $ coder_args ['#stack ' ][$ lineno ] : array ('' , '' );
1057
- if ( ($ function_regex && (!$ function_current || !preg_match ($ function_regex , $ function_current )))
1084
+ if (($ function_regex && (!$ function_current || !preg_match ($ function_regex , $ function_current )))
1058
1085
|| ($ function_not_regex && $ function_current && preg_match ($ function_not_regex , $ function_current ))
1059
1086
|| ($ class_regex && (!$ class_current || !preg_match ($ class_regex , $ class_current [0 ])))
1060
1087
|| ($ class_not_regex && $ class_current && preg_match ($ class_not_regex , $ class_current [0 ]))
@@ -1153,13 +1180,19 @@ function _coder_review_ignore(array $rule, $lineno, array $ignores) {
1153
1180
* This type of do_coder_review_* searches for the occurance of a string.
1154
1181
*
1155
1182
* @param array $coder_args
1156
- * A Coder settings array, passed by reference. See do_coder_review() for format.
1183
+ * A Coder settings array, passed by reference. See do_coder_review() for
1184
+ * format.
1185
+ *
1157
1186
* @param array $review
1158
- * Review array the current rule belongs to, used by _coder_review_severity_name().
1187
+ * Review array the current rule belongs to, used by
1188
+ * _coder_review_severity_name().
1189
+ *
1159
1190
* @param array $rule
1160
1191
* Rule array being checked.
1192
+ *
1161
1193
* @param array $lines
1162
1194
* Pertinent source file lines according to rule's '#source' value.
1195
+ *
1163
1196
* @param array $results
1164
1197
* Results array variable to save errors to, passed by reference.
1165
1198
*
@@ -1187,13 +1220,19 @@ function do_coder_review_grep(array &$coder_args, array $review, array $rule, ar
1187
1220
* string.
1188
1221
*
1189
1222
* @param array $coder_args
1190
- * A Coder settings array, passed by reference. See do_coder_review() for format.
1223
+ * A Coder settings array, passed by reference. See do_coder_review() for
1224
+ * format.
1225
+ *
1191
1226
* @param array $review
1192
- * Review array the current rule belongs to, used by _coder_review_severity_name().
1227
+ * Review array the current rule belongs to, used by
1228
+ * _coder_review_severity_name().
1229
+ *
1193
1230
* @param array $rule
1194
1231
* Rule array being checked.
1232
+ *
1195
1233
* @param array $lines
1196
1234
* Pertinent source file lines according to rule's '#source' value.
1235
+ *
1197
1236
* @param array $results
1198
1237
* Results array variable to save errors to, passed by reference.
1199
1238
*
@@ -1221,13 +1260,19 @@ function do_coder_review_grep_invert(array &$coder_args, array $review, array $r
1221
1260
* perform a review.
1222
1261
*
1223
1262
* @param array $coder_args
1224
- * A Coder settings array, passed by reference. See do_coder_review() for format.
1263
+ * A Coder settings array, passed by reference. See do_coder_review() for
1264
+ * format.
1265
+ *
1225
1266
* @param array $review
1226
- * Review array the current rule belongs to, used by _coder_review_severity_name().
1267
+ * Review array the current rule belongs to, used by
1268
+ * _coder_review_severity_name().
1269
+ *
1227
1270
* @param array $rule
1228
1271
* Rule array being checked.
1272
+ *
1229
1273
* @param array $lines
1230
1274
* Pertinent source file lines according to rule's '#source' value.
1275
+ *
1231
1276
* @param array $results
1232
1277
* Results array variable to save errors to, passed by reference.
1233
1278
*
@@ -1238,7 +1283,12 @@ function do_coder_review_callback(array &$coder_args, array $review, array $rule
1238
1283
$ function = $ rule ['#value ' ];
1239
1284
if ($ function ) {
1240
1285
if (function_exists ($ function )) {
1241
- call_user_func_array ($ function , array (&$ coder_args , $ review , $ rule , $ lines , &$ results ));
1286
+ call_user_func_array ($ function , array (
1287
+ &$ coder_args ,
1288
+ $ review , $ rule ,
1289
+ $ lines ,
1290
+ &$ results ,
1291
+ ));
1242
1292
}
1243
1293
else {
1244
1294
static $ bad ;
@@ -1260,7 +1310,7 @@ function do_coder_review_callback(array &$coder_args, array $review, array $rule
1260
1310
* @param array $rule
1261
1311
* A Rule array to process.
1262
1312
*
1263
- * @return
1313
+ * @return int
1264
1314
* TRUE if needle is in haystack; otherwise, FALSE.
1265
1315
*/
1266
1316
function _coder_review_search_string ($ line , $ rule ) {
@@ -1285,11 +1335,11 @@ function _coder_review_search_string($line, $rule) {
1285
1335
* The name is a misnomer, but is a largely correct characterization
1286
1336
* for most of Coder's settings as the variables usually do not exist.
1287
1337
*
1288
- * @param string $args
1338
+ * @param string $arg
1289
1339
* (optional) A string settings argument, can be 'settings', 'active', 'core',
1290
1340
* 'all' and 'default'. Defaults to 'default'.
1291
1341
*
1292
- * @return
1342
+ * @return array $settings
1293
1343
* Associative array of settings in the form of setting name => setting value.
1294
1344
*/
1295
1345
function _coder_review_get_default_settings ($ arg = 'default ' ) {
@@ -1389,7 +1439,8 @@ function _coder_review_is_backdrop_core($system) {
1389
1439
* @todo Is this an HTML string? Is it sanitized? Needs better explanation.
1390
1440
*/
1391
1441
function _coder_review_warning (array $ rule ) {
1392
- /* @todo: add version check so we handle tranlations right for older rules definitions.
1442
+ /* @todo: add version check so we handle tranlations right for older rules
1443
+ * definitions.
1393
1444
* ... or should we just ignore them?
1394
1445
* This will require passing the review to this function.
1395
1446
*/
0 commit comments