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 |
Jump to:
Description
Just to keep track of the idea and point to the standards:
It seems that there are just 2 basic rules.

#1
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
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
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
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
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
+1 for this feature request -- can help testing also :)