Nobody likes a red item on the test page. There are a few normal errors and one critical error detected in coder review. Cleaning them up would make things nice and green all around.

CommentFileSizeAuthor
#1 coder-review-1805588-1.patch642 bytesgeerlingguy

Comments

geerlingguy’s picture

Status: Fixed » Needs review
StatusFileSize
new642 bytes

Attached patch fixes two st() calls, but there are a bunch of things that are plain wrong in the coder review. For example:

  1. Format should be * Implementation of hook_foo(). for what I have as Implements hook_schema() - coder review is applying a D6 code style rule to D7.
  2. Potential problem: drupal_set_message() only accepts filtered text, be sure all !placeholders for $variables in t() are fully sanitized using check_plain(), filter_xss() or similar. (Drupal Docs) - well, for links in translatable messages, the ! passthrough placeholder is the only option. I don't think coder should necessarily mark that as a critical issue, since it's used pretty much everywhere. Maybe a small notice, to remind devs to use @ and % where appropriate, but not a critical issue.
  3. Format should be * Implementation of hook_foo(). for what I have as Implements hook_cron() - same as #1.
  4. in most cases, replace the string function with the drupal_ equivalent string functions - In this case, though, substr() is more fitting, and the docs for drupal_substr() even mention that in cases where the length to trim is known, you shouldn't use the drupal_ function.

Full listing here: http://qa.drupal.org/pifr/test/324973

I'm tracking this in #1361508: [META] Tracking issue for Coder Advisory Review test issues.

geerlingguy’s picture

Status: Active » Postponed

I committed the patch in the previous comment. I will wait until I learn more from #1361508: [META] Tracking issue for Coder Advisory Review test issues before closing this issue.

lars toomre’s picture

Status: Postponed » Needs review

Can you also open issues for each of these in the Coder module issue queue? I think they need to be there to resolve these false positive sniffs. Thanks.

geerlingguy’s picture

Status: Needs review » Fixed

Status: Needs review » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.