I don't think we should run any code sniff on JS files.

Right now JS, is a problem in Drupal being that we have no documentation for it (I'm working on that in the api queue), Also the coding standards that we're going to adapt is going to be based on a different project (jsdocs), so we'll have a jsHint configuration for the JS files.

So in short, this should be for php, and js will be handler with the js projects.

This is also a step towards being more standard :)

Comments

ericduran’s picture

I committed a fixed to overwrite the InlineControlStructure to only sniff php files.

Sorry for all the quick bug reports. I switch our CI environment to use this project for code validation instead of the drupalcs we where using before, so now a bunch of things are breaking lol.

So I'm fixing them as I see the,

--
Commit: http://drupalcode.org/sandbox/ericduran/1337998.git/commit/a1fe792

klausi’s picture

Yes we have some JS coding standards: http://drupal.org/node/172169

Why does this rule not apply to javascript?

ericduran’s picture

Version: » 7.x-1.x-dev

@klausi In order to get better the js code visible in the api site we're currently working on adopting JSDocs (#25901: Parse/save/display JavaScript files). There's also a D8 task #1337022: [policy, no patch] Create/adopt JavaScript docs standards compatible with a JS documentation parser.

Just like the API documentation is being handle by a separate project, JS project to document JS, and PHP project to document PHP, I think this same approach should be taken with syntax checks.

What happens when you try to run most of the validation check on any JS files it mostly returns false positive. This is especially the case if you're JS is minified.

Js validation is better handle by a standard JS syntax checker such as JSHints. This tools is greatly configurable and is made in JS for JS.

Anyways I'm always open for discussion.

klausi’s picture

Status: Active » Closed (won't fix)

We concluded in another issue that people can decide whether they want to run drupalcs on JS anyway.