Code review (coder)

Coder found 1 projects, 16 files, 3 critical warnings, 20 normal warnings
Coder provides helpful hints without false positives, but offers no guarantee for creating good code. You are the final arbitrar. If in doubt, read the Drupal documentation (see review links below and api.drupal.org).
Use the Selection Form to select options for this code review, or change the Default Settings and use the Default tab above.
sites/default/modules/coder/coder.module

coder.module

  • No Problems Found
sites/default/modules/coder/scripts/coder_format/coder_format.inc

coder_format.inc

  • severity: normalLine 42: Functions should be called with no spaces between the function name
      require_once (!isset($file_inc) ? $root .'/includes/file.inc' : $file_inc);
sites/default/modules/coder/tests/coder_comment.inc

coder_comment.inc

  • severity: normalInclude the CVS keyword $Id$ in each file
sites/default/modules/coder/tests/coder_sql.inc

coder_sql.inc

  • severity: criticalLine 18: table names should be enclosed in {curly_brackets}
      $var = t('select something from this');
  • severity: criticalLine 22: table names should be enclosed in {curly_brackets}
      $sql = 'INSERT INTO node (changed) VALUES (1)';
  • severity: normalLine 23: Use db_query_range() instead of the SQL LIMIT clause (Drupal Docs)
      $sql = 'SELECT * FROM {node} LIMIT 10';
  • severity: criticalclick to read moreLine 24: In SQL strings, Use db_query() placeholders in place of variables. This is a protential source of SQL injection attacks when the variable can come from user data. (Drupal Docs)
      $sql = "SELECT * FROM {node} WHERE nid=$nid"; // unsecure
    Explanation: Use %s and %d variable substitution. When inserting an array of values use $placeholders = implode(',', array_fill(0, count($args), "'%s'"));
sites/default/modules/coder/tests/coder_style.inc

coder_style.inc

  • severity: normalLine 16: Use an indent of 2 spaces, with no tabs
    	$var = 'tab error';
  • severity: normalLine 21: use stdClass caseCapitalization, it's the one exception to the mixed case style standard
      $var = new StdClass(); // This is not.
  • severity: normalLine 25: do not use mixed case (camelCase), use lower case and _
    function coderCamelCase() {
  • severity: normalLine 26: do not use mixed case (camelCase), use lower case and _
      $camelCaseVar = 'whatever'; // Camel case functions and vars not allowed.
  • severity: normalLine 32: Control statements should have one space between the control keyword and opening parenthesis
      if('test=' . $test == 'test='){ // There are 3 errors on this line.
  • severity: normalLine 32: use a space between the closing parenthesis and the open bracket
      if('test=' . $test == 'test='){ // There are 3 errors on this line.
  • severity: normalLine 32: string concatenation should be formatted without a space separating the operators (dot .) and a quote
      if('test=' . $test == 'test='){ // There are 3 errors on this line.
  • severity: normalLine 69: string concatenation should be formatted without a space separating the operators (dot .) and a quote
      if ($file = file_check_upload($fieldname . '_upload')) { // Not ok.
  • severity: normalLine 74: string concatenation should be formatted with a space separating the operators (dot .) and non-quote terms
      $a = $v.'bugger'; // Not ok.
  • severity: normalLine 75: string concatenation should be formatted with a space separating the operators (dot .) and non-quote terms
      $a = $some_func().'bugger'; // Not ok.
  • severity: normalLine 79: use quotes around a string literal array index, this is not only a style issue, but a known performance problem
      $a[hello] = 'this is bad';
  • severity: normalLine 86: the final ?> should be omitted from all code files
  • severity: normalLine 89: Control statements should have one space between the control keyword and opening parenthesis
      if($a == 1){ }
  • severity: normalLine 89: use a space between the closing parenthesis and the open bracket
      if($a == 1){ }
  • severity: normalLine 91: else statements should begin on a new line
      }else {
  • severity: normalLine 93: The control statement should be on a separate line from the control conditional
      if ($a == 1) { $b = 2;
  • severity: normalLine 95: The control statement should be on a separate line from the control conditional
      if ($a == 1) {$b = 2;