Project:Coder
Version:6.x-2.x-dev
Component:Code
Category:bug report
Priority:major
Assigned:Unassigned
Status:needs review

Issue Summary

When I have the following in my .info file.....

name = 'Ubuntu Drupal Theme'
description = 'Ubuntu-Drupal is a theme for Ubuntu LoCo web sites.'
version = 6.4.0
core = '6.x'
engine = phptemplate

stylesheets[all][] = style.css

regions[banner] = Banner
regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer

I get these errors:

udtheme.info

*
severity: normalLine 8: string concatenation should be formatted with a space separating the operators (dot .) and non-quote terms

stylesheets[all][] = style.css

*
severity: normalLine 8: use quotes around a string literal array index, this is not only a style issue, but a known performance problem

stylesheets[all][] = style.css

*
severity: normalLine 10: use quotes around a string literal array index, this is not only a style issue, but a known performance problem

regions[banner] = Banner

*
severity: normalLine 11: use quotes around a string literal array index, this is not only a style issue, but a known performance problem

regions[left] = Left sidebar

*
severity: normalLine 12: use quotes around a string literal array index, this is not only a style issue, but a known performance problem

regions[right] = Right sidebar

*
severity: normalLine 13: use quotes around a string literal array index, this is not only a style issue, but a known performance problem

regions[content] = Content

*
severity: normalLine 14: use quotes around a string literal array index, this is not only a style issue, but a known performance problem

regions[header] = Header

*
severity: normalLine 15: use quotes around a string literal array index, this is not only a style issue, but a known performance problem

regions[footer] = Footer

Comments

#1

This is also happening for me in my theme's .info file. As previously said it just looks like the file is being incorrectly evaluated as PHP.

#2

Confirming this issue, for me thats the only files its looking at in my themes, I know there are coding standards errors in 8 files and it doesn't pick them up (inc files for custom Panel layouts).

#3

Version:6.x-2.0-beta1» 6.x-2.x-dev

lol... For the heck of it I made one of my bigger themes conform to the standards it wanted to force. It broke pretty completely. Doesn't look like the authors feel like fixing it.

#4

Priority:normal» major

I'm bumping up the priority because this seems of have been blown off and a user trying to follow the suggestion will actually break things.

#5

Haven't been able to fix yet but I'll try my hand at it. For now here's a failing simpletest

AttachmentSize
info-string-concat.patch 513 bytes

#6

Status:active» needs review

Actually that test sucks, please disregard. I'm not really sure how to simulate this with the current testing suite but I'll try a little bit more. For now please checkout this patch and see if it fixes your problem. The algorithm is correctly identifying that file as not php but because of some commented out code it still checks it as if it were php anyways. Sorta feels like that $is_php_file variable isn't doing anything or is slightly mucked up.

We really need to have sample files for our tests. Right now the logic that detects whether a file should be checked isn't really tested at all so we're probably breaking each other pretty often.

AttachmentSize
info-string-concat-fix.patch 536 bytes

#7

This patch fixes it for me. Excellent!

#8

Patch in #6 is a start, but it is not complete, I still get those when using it along with coder_tough_love:

  • warning: Invalid argument supplied for foreach() in /home/ao2/public_html/drupal/sites/default/modules/coder_tough_love/coder_tough_love.module on line 206.
  • warning: Invalid argument supplied for foreach() in /home/ao2/public_html/drupal/sites/default/modules/coder_tough_love/coder_tough_love.module on line 221.
  • warning: Invalid argument supplied for foreach() in /home/ao2/public_html/drupal/sites/default/modules/coder_tough_love/coder_tough_love.module on line 237.
  • warning: Invalid argument supplied for foreach() in /home/ao2/public_html/drupal/sites/default/modules/coder_tough_love/coder_tough_love.module on line 250.
  • warning: Invalid argument supplied for foreach() in /home/ao2/public_html/drupal/sites/default/modules/coder_tough_love/coder_tough_love.module on line 333.
  • warning: Invalid argument supplied for foreach() in /home/ao2/public_html/drupal/sites/default/modules/coder_tough_love/coder_tough_love.module on line 165.
  • warning: Invalid argument supplied for foreach() in /home/ao2/public_html/drupal/sites/default/modules/coder/coder.module on line 1727.
  • warning: Invalid argument supplied for foreach() in /home/ao2/public_html/drupal/sites/default/modules/coder/includes/coder_security.inc on line 240.

This happens because some code review rules still want the bidimensional all_array_lines variant.

The attached patch should be better and it allows to still catch non-php errors in .info files, I tested it with trailing spaces, for instance.

Maybe the non-php checks can be applied to javascript and css files as well?

Regards,
Antonio

P.S. If the patch is OK it can be applied with git am so I get attribution in the gt history.

AttachmentSize
0001-Issue-619880-by-ao2-don-t-parse-non-php-files.patch 2.16 KB