Here is some output from the Coder module review:

captcha.module

  • Only local images are allowed.Line 27: string concatenation should be formatted without a space separating the operators (dot .) and a quote
          return '<p>' . t('A captcha is a tool to fight automated spam submission of forms (e.g. user registration forms, comment forms, guestbook forms, etc.) by malicious users. A captcha is an extra field (or several fields) on a form presented to the user. It embodies a challenge, which should be easy for a normal human to solve (e.g. a simple math problem), but hard enough to keep automated scripts and spam bots out. Users with the \'skip captcha\' <a href="@perm">permission</a> won\'t be offered a captcha. Be sure to grant this permission to the trusted users (e.g. site administrators).', array('@perm' => url('admin/user/access'))) . '</p>';
    
  • Only local images are allowed.Line 81: use a space between the closing parenthesis and the open bracket
    function _captcha_available_challenge_types(){
    
    
  • Only local images are allowed.Line 83: Control statements should have one space between the control keyword and opening parenthesis
      foreach(module_implements('captcha') as $module) {
    
  • Only local images are allowed.Line 86: Control statements should have one space between the control keyword and opening parenthesis
          foreach($result as $challenge) {
    
  • Only local images are allowed.Line 116: Arrays should be formatted with a space separating each element and assignment operator
            drupal_set_message(t('Disabled captcha for form %form_id.', array('%form_id'=>$form_id)));
    
  • Only local images are allowed.Line 122: Arrays should be formatted with a space separating each element and assignment operator
            drupal_set_message(t('Deleted captcha for form %form_id.', array('%form_id'=>$form_id)));
    
  • Only local images are allowed.Line 177: Arrays should be formatted with a space separating each element and assignment operator
          $form['captcha_types'][$captcha_point->form_id]['captcha_type']['#attributes'] = array('class'=>'error');
    
    
  • Only local images are allowed.Line 258: Control statements should have one space between the control keyword and opening parenthesis
        if(!variable_get('captcha_persistence', TRUE) && ($_SESSION['captcha'][$form_id]['success'] === TRUE)) {
    
  • Only local images are allowed.Line 278: Arrays should be formatted with a space separating each element and assignment operator
              array('%type' => $captcha_point->type, '%module' => $captcha_point->module, '%form_id'=> $form_id)),
    
  • Only local images are allowed.Line 308: Functions should be called with no spaces between the function name
        $form['captcha']['captcha_solution'] = array (
    
    
  • Only local images are allowed.Line 318: Functions should be called with no spaces between the function name
        $form['captcha']['captcha_token'] = array (
    
  • Only local images are allowed.Line 453: Control statements should have one space between the control keyword and opening parenthesis
      foreach(element_children($form) as $key) {
    
  • Only local images are allowed.Line 491: Control statements should have one space between the control keyword and opening parenthesis
        foreach(module_implements('captcha') as $module) {
    
  • Only local images are allowed.Line 494: Control statements should have one space between the control keyword and opening parenthesis
            foreach($challenges as $challenge) {
    
  • Only local images are allowed.Line 523: Control statements should have one space between the control keyword and opening parenthesis
      switch($op) {
    
  • Only local images are allowed.Line 533: Functions should be called with no spaces between the function name
            $result['form']['captcha_response'] = array (
    
    
    

    image_captcha.module

    • Only local images are allowed.Include the CVS keyword $Id$ in each file
    • Only local images are allowed.Line 19: string concatenation should be formatted without a space separating the operators (dot .) and a quote
            return '<p>' . t('The image captcha is the popular captcha type where a random text code is obfuscated in an image.') . '</p>';
      
    • Only local images are allowed.Line 84: Control statements should have one space between the control keyword and opening parenthesis
        foreach($fontsdirectories as $fontsdirectory) {
      
    • Only local images are allowed.Line 85: Control statements should have one space between the control keyword and opening parenthesis
          foreach(file_scan_directory($fontsdirectory, '\.[tT][tT][fF]$') as $filename => $font) {
      
      
    • Only local images are allowed.Line 180: Control statements should have one space between the control keyword and opening parenthesis
        switch($op) {
      

    text_captcha.module

    • Only local images are allowed.Include the CVS keyword $Id$ in each file
    • Only local images are allowed.Line 17: string concatenation should be formatted without a space separating the operators (dot .) and a quote
            return '<p>' . t('This text based captcha presents a captcha phrase of a given number of words and the visitor is asked to enter the n\'th word.') . '</p>';
      
    • Only local images are allowed.Line 106: missing space after comma
        $o = mt_rand(0,1); // randomly start with vowel or consonants
      
    • Only local images are allowed.Line 127: Control statements should have one space between the control keyword and opening parenthesis
          foreach($keys as $key) {
      
    • Only local images are allowed.Line 134: missing space after comma
            $words[] = _text_captcha_generate_nonsense_word(mt_rand(3,7));
      
      
    • Only local images are allowed.Line 159: Control statements should have one space between the control keyword and opening parenthesis
        switch($op) {
      
    • Only local images are allowed.Line 172: Functions should be called with no spaces between the function name
              $result['form']['captcha_response'] = array (
      

    Going by the Drupal coding standards is probably a good thing ;) .

Comments

soxofaan’s picture

I'm working on the image captcha module right now (mostly cleanup stuff, streamlining, making the image distortion code less more efficient, etc).
I'll include those remarks on the image_captcha.module

never heard about the coder module, seems interesting

wundo’s picture

Assigned: Unassigned » wundo

thanks rob,
as soxo seems busy with other things, I'm taking this one, ok?
I will start with text captcha.

soxofaan’s picture

StatusFileSize
new1.32 KB

captcha_api.txt also needs some tweaks
we shouldn't give the bad example ;)
see patch

robloach’s picture

Status: Active » Needs review
StatusFileSize
new7.8 KB

Here's the Captcha.module Coder Review fixes.

robloach’s picture

Status: Needs review » Fixed

No Problems Found

soxofaan’s picture

Status: Fixed » Needs review
StatusFileSize
new10.09 KB

here are some more fixes

robloach’s picture

Status: Needs review » Fixed

Excellent, thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)