We run coder reviews with Jenkins outside from the projects Drupal root, including coder from the ~/.drush directory. But in this case @ignore comments have no effect for the CodeStyle checks.
We found a quick solution to use native PHP substr instead of _substr which is a wrapper function in the coder_review.common.inc for drupal_substr or native substr. We have no idea why the wrapper function couldn't found the name of the ignored rule. We seemed that in this case calling the native substr is more than enough.
We attached a patch and a test file.
Before applying the patch when you run drush coder --ignorename --ignore --druplart --minor test_ignore_without_bootstrap.php from inside a Drupal instance you will get the following summary:
Coder found 1 projects, 1 files, 1 minor warnings, 1 warnings were flagged to be ignored
But if run the same command from outside Drupal:
Coder found 1 projects, 1 files, 2 minor warnings, 0 warnings were flagged to be ignored
After the patch was applied you will get only "1 minor warnings, 1 warnings were flagged to be ignored" in both cases.
| Comment | File | Size | Author |
|---|---|---|---|
| coder_review_not_found_ignore_without_bootstrap.patch | 776 bytes | tikaszvince | |
| test_ignore_without_bootstrap.php_.txt | 144 bytes | tikaszvince |
Comments
Comment #1
Désiré commentedI reproduced the bug, applied the patch and it really fixes it.
I think using native PHP substr is OK here, since only '@[a-z]+' format strings will be checked here, no need for the special solutions in drupal_substr.
Note: rename the test php file form .txt to .php.
Comment #2
douggreen commentedI believe I have fixed this problem with http://drupalcode.org/project/coder.git/commit/05c9e687692dced7f21ef165d..., but rather than selectively using substr() or _substr() I have fixed _substr() to act the same when the $length argument is NULL.
Comment #3.0
(not verified) commentedfix grammar