provide javascript review

greggles - March 6, 2008 - 15:30
Project:Coder
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:stella
Status:active
Description

Just to keep track of the idea and point to the standards:

http://drupal.org/node/172169

It seems that there are just 2 basic rules.

#1

stella - September 4, 2008 - 15:13
Assigned to:Anonymous» stella

I've spent the last while trying to get consensus on the coding standards for JS files. I published the final version of the new standards yesterday, so we'll now be adding them to the Coder module in the near future.

Cheers,
Stella

#2

douggreen - September 20, 2008 - 16:55

We now read js files and can write rules for them. All rules are excluded from js by default, but you can add js only rules using '#filename' => '\.js$' and you can add existing rules to js files with '#filename-not' => ''. This second empty rule is needed to override the default '#filename-not' => '\.js$'.

#3

douggreen - September 29, 2008 - 12:57

The #filename and #filename-not directives have recently changed slightly, but hopefully for the better. The default rules are only valid for php files. And js files are only read if a rule in one of the reviews being run, accesses it. It should be pretty easy to add the #filename to existing style rules that should also apply to js, such the many spacing, parenthesis, and bracket rules. Note that the directive now takes an array of extensions instead of a regex, so, to add js you'd now write:

'#filename' => array('js'),

#4

stella - September 29, 2008 - 13:07

So '#filename' => array('js'), will add js files to the list of file types that the review is being run on? What if you want a js only rule?

#5

douggreen - September 29, 2008 - 19:22

hmm, that is a js only review. The problem in my logic here is that unlike what my comments say, there's not a way to add a rule to js without explicitly naming array('js', 'php', 'module', 'inc', 'test'), and that's not good....

#6

Manuel Garcia - February 2, 2009 - 12:27

+1 for this feature request -- can help testing also :)

 
 

Drupal is a registered trademark of Dries Buytaert.