Financial-Times/origami-build-tools — pull request #31 by samgiles (2014-06-17 15:34:48+00:00)
Title: Adds `verify` command to Origami build tools

This adds the `verify` command building on the previous work in the [verify](https://github.com/Financial-Times/origami-build-tools/tree/verify) branch by @dan-searle - issue #28.

#### Things to notice:

1. The files to exclude from the linters are determined by the `.gitignore` file.
While the spec does not explicitly require a git ignore file it does require it to be a `git(1)` repository. Consequently I've made the assumption that anything that should be committed to the repository should go through the linters (if it's the correct file type).

> Modules are git repos containing static resources...

This seems better than hard coding exclusions.

2. All verification tasks will run regardless of encountered errors
Every verification task will run regardless of errors, this resulted in some slightly complex code in the function exported by `commands/verify.js` as the `async` library would immediately stop all current/pending tasks when an error is encountered (not sure there is a better way of doing this?)

3. `scss-lint` and `jshint`'s exclusion command line parameters are slightly different
JSHint is able to accept a file (thankfully a .gitignore works perfectly).
`scss-lint` does not, consequently a function has been added to read the git ignore file, and then pass the exclusion parameters to the command line tool.

4. Output is not pretty
Not particularly important.. it looks something like the following:
```SH
scss-lint
/Users/sam/code/ftlabs/javascript/o-table/demos/src/demo.scss:20 [W] Shorthand form for property `margin` should be written more concisely as `0 0 5px` instead of `0 0 5px 0`
/Users/sam/code/ftlabs/javascript/o-table/demos/src/demo.scss:30 [W] Files should end with a trailing newline
/Users/sam/code/ftlabs/javascript/o-table/src/scss/_mixins.scss:29 [W] Files should end with a trailing newline
/Users/sam/code/ftlabs/javascript/o-table/src/scss/base.scss:2 [W] Rule sets should start with @extend declarations, followed by properties and nested rule sets, in that order
/Users/sam/code/ftlabs/javascript/o-table/src/scss/base.scss:2 [W] Shorthand form for property `margin` should be written more concisely as `0 0 20px` instead of `0 0 20px 0`
/Users/sam/code/ftlabs/javascript/o-table/src/scss/base.scss:40 [W] Files should end with a trailing newline
/Users/sam/code/ftlabs/javascript/o-table/src/scss/borders.scss:15 [W] Files should end with a trailing newline
/Users/sam/code/ftlabs/javascript/o-table/src/scss/captions.scss:13 [W] Rule sets should start with @extend declarations, followed by properties and nested rule sets, in that order
/Users/sam/code/ftlabs/javascript/o-table/src/scss/captions.scss:19 [W] Rule sets should start with @extend declarations, followed by properties and nested rule sets, in that order
/Users/sam/code/ftlabs/javascript/o-table/src/scss/captions.scss:22 [W] Files should end with a trailing newline
/Users/sam/code/ftlabs/javascript/o-table/src/scss/compact.scss:2 [W] Opening curly brace `{` should be preceded by one space
/Users/sam/code/ftlabs/javascript/o-table/src/scss/compact.scss:12 [W] Files should end with a trailing newline
/Users/sam/code/ftlabs/javascript/o-table/src/scss/lines.scss:13 [W] Files should end with a trailing newline
/Users/sam/code/ftlabs/javascript/o-table/src/scss/row-stripes.scss:9 [W] Files should end with a trailing newline

jshint
src/js/wrap.js: line 30, col 19, Expected ']' to match '[' from line 30 and instead saw '}'.
src/js/wrap.js: line 30, col 19, Expected an assignment or function call and instead saw an expression.
src/js/wrap.js: line 30, col 1, 'foo' is not defined.
src/js/wrap.js: line 30, col 7, 'bas' is not defined.
src/js/wrap.js: line 30, col 12, 'foo' is not defined.
src/js/wrap.js: line 30, col 16, 'bas' is not defined.

6 errors
```

It's simply a concatenation of the output of each linting tool delimited by its name.

Finally, the wildcard selectors (globs) seem a little hit and miss for the source path selection for the SCSS linter so these may be worth an extra look at (I'm not sure what the best globs would be). For JSHint it seems to do well recursing the directory structure and looking at file extensions.

Updates README.