Okay, I've gotten rid of all the other flags. But I don't know what to do with these:

Line 825: do not use mixed case (camelCase), use lower case and _
$row_count += $table->Rows;

The table is defined with capital letters and if I try using lower case, I get no data.

Should I just ignore the messages or is there a way to satisfy both you and MySQL?

Comments

sun’s picture

Could you please post the code that is on line 825 and surrounding lines?

douggreen’s picture

It's complaining about the capitalized Rows in $table->Rows. If you provide a little more context for what you're doing (as sun suggested), we might be able to offer a more-Drupalish solution.

nancydru’s picture

  $result = db_query("SHOW TABLE STATUS");
...
  while ($table = db_fetch_object($result)) {
    $row_count += $table->Rows;
    $datalen += $table->Data_length;
    $indexlen += $table->Index_length;
    $overhead += $table->Data_free;
    $r = number_format($table->Rows);       
...
  }

AFAIK, I have no control over what MySQL returns on this query. And it's giving me proper case.

douggreen’s picture

You could use $table = db_fetch_row($result) and $table['Rows']. I'm wondering if (a) this is a hack to just get around the coding standards, or (b) it would be a valuable additional coding standard to use db_fetch_row instead of db_fetch_array when reading tables we didn't create...

douggreen’s picture

Sorry, I meant to say db_fetch_array

nancydru’s picture

I've always wondered which was faster, array or object. I've just developed the habit of using objects. I've seen others who prefer arrays. But I have no problem either changing my code, or just ignoring the messages.

b) Could you catch and warn about this?

douggreen’s picture

It's kinda the Drupal way to use arrays instead of objects, I think mostly to support php4; however Drupal does use objects for things like $node, so it's not completely standardized. I don't think anyone will admonish you for the way you did it, I was just offering an alternative approach. But I do think most Drupal developers would lean towards using the array.

nancydru’s picture

Not a big deal for me to change but virtually every module I've looked, core or contributed, has used objects. But I will admit, $node is the biggest thing I see in Drupal.

douggreen’s picture

Status: Active » Closed (won't fix)
samirnassar’s picture

Version: 5.x-2.2 » 6.x-1.x-dev
Status: Closed (won't fix) » Active
  /**
   * Implementation of setUp().
   */
  function setUp() {
    // Custom content type for path setting tests.
    $this->content_type = $this->drupalCreateContentType();
    menu_rebuild();

    // User to create paths with pathauto.
    $this->web_user = $this->drupalCreateUserRolePerm(array(
      'administer pathauto',
      'create '. $this->content_type->type .' content',
      'edit own '. $this->content_type->type .' content',
      'administer url aliases',
      'create url aliases',
    ));
  }

I ran a recent pathauto through coder and it complained about the function being camelcased.

Coder only cared about the function name, not the rest. Since this is a snippet from pathauto/tests/pathauto.test

greggles thinks that camelcase is allowed in tests and therefore this might be a bug in coder.

Feedback?

nancydru’s picture

Well, I was trying to read some of the docs about Views 2 and saw some similar camel case stuff. Is this a normal OOP technique? If so, perhaps Coder needs to change.

jcnventura’s picture

Version: 6.x-1.x-dev » 5.x-2.2
Status: Active » Closed (won't fix)

Please comment the CamelCase problems for tests in here #271028: Coder should not check camelCase for class methods.