the module triggers coding-style errors on patterns like :
'a string literal'. $a_variable
(no space before the concatenation operator)

Yet this should be valid style (I can't find right now where this is explicitly mentioned in drupal coding standards handbook, but the whole core code relies on this)

Not actually critical, but it floods the reports with false positives.
Very useful module, BTW. Thanks :-)

Comments

douggreen’s picture

I don't think that these are false positives. code-style.pl in Drupal core, flags this. Even though this isn't mentioned on the Drupal coding page, I took the fact that this script is in core to mean that it as a standard. If the community disagrees and we can reach some concensus, I'd be happy to remove it.

ChrisKennedy’s picture

yched is correct, I have had to tweak several core patches to concatenate in the 'blah'. $var .'blah2' style before I got used to it. No consensus needed - this is the required concatenation style for Drupal core.

Plus, code-style.pl appears to handle it properly:

  # enforce "bar". foo() ."bar" syntax
  if (/^("[^"]*"|[^"])*("[^"]*")\.[^ ]/ && $program) {
    $msg = "'\".' -> '\". '";
  }
  elsif (/^("[^"]*"|[^"])*("[^"]*")\s+\./ && $program) {
    $msg = "'\" .' -> '\".'";
  }
  # enforce "bar". foo() ."bar" syntax
  elsif (/^("[^"]*"|[^"])*[^ "]\.("[^"]*")/ && $program) {
    $msg = "'.\"' -> '.\"'";
  }
  elsif (/^("[^"]*"|[^"])*[^ "]\.\s+("[^"]*")/ && $program) {
    $msg = "'. \"' -> '.\"'";
  }
douggreen’s picture

Assigned: Unassigned » douggreen

So, just to make sure, ... I have it backwards!?

  $var1 = 'this'. foo() .'is the desired format';
  $var2 = 'this' . foo() . 'is NOT!';

I'm going to have to fix all of my code!

douggreen’s picture

Please check-out the latest development branch and confirm that I'm properly handling the string concatenation rule. Thanks!

yched’s picture

Status: Active » Fixed

Works like a charm :-)
Thanks !

douggreen’s picture

Status: Fixed » Closed (fixed)