Add linter for order of declarations

Adds a linter that ensures declarations within a rule set are in a
consistent order of @extend declarations, properties, and nested rules.
For example:

    .rule-set {
      @extend .some-other-rule-set;
      property: value;
      .nested-rule-set {
        ...
      }
    }

Note that we're not verifying that there is a blank line between
properties and rules, or other rules. That will be soon to follow.

Change-Id: Ibc4da48d8e00373c2e8f6960bde7184b9f4b4a88
Reviewed-on: https://gerrit.causes.com/16697
Reviewed-by: Joe Lencioni <joe.lencioni@causes.com>
Tested-by: Shane da Silva <shane@causes.com>
Make scss-lint detect space before semicolon

For properties that look like `blah: blah ;`. I accomplished this by
adding a negative lookbehind before the semicolon in
PropertyFormatLinter.

At the same time, I replaced instances of `[^\s]` with `\S`.

Related Story:
  http://www.pivotaltracker.com/story/show/41693735 (delivered)
  ("Make scss-lint detect space before semicolon")

Change-Id: I4152adf2ded7154a79bdff81e7ee7f550ff58916
Reviewed-on: https://gerrit.causes.com/16901
Tested-by: Joe Lencioni <joe.lencioni@causes.com>
Reviewed-by: Alex Wallace <alex.wallace@causes.com>
Teach scss-lint to detect too-long shorthand values

With this commit, the linter now complains about styles that use
shorthand versions that can be further shortened, such as:

  border-width: 1px 1px 1px 1px;
  margin: 10px 5px 10px 5px;
  padding: 0 0 10px 0;

Related Story:
  http://www.pivotaltracker.com/story/show/41720871 (delivered)
  ("Teach scss-lint to detect unnecessary properties in shorthand")

Change-Id: Ia130720d4abcb584ee23ceb955f6212f67f9aab9
Reviewed-on: https://gerrit.causes.com/16944
Reviewed-by: Alex Wallace <alex.wallace@causes.com>
Tested-by: Joe Lencioni <joe.lencioni@causes.com>
Teach scss-lint about nested property syntax

Prior to this commit, scss-lint was giving false positives for nested
properties:

  http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#nested_properties

We have some of these in our code base, so this commit teaches scss-lint
to grok them.

As the regex was starting to get gnarly, I broke it into multi-line
syntax and added comments. I also replaced the negative look-behind with
a simpler positive construction.

Related Story:
  http://www.pivotaltracker.com/story/show/41761797 (delivered)
  ("Teach scss-lint about nested property syntax")

Change-Id: I27dde8025fb43b383aadd4c625429c9e3f4d5d7c
Reviewed-on: https://gerrit.causes.com/16962
Tested-by: Greg Hurrell <greg@causes.com>
Reviewed-by: Lann Martin <lann@causes.com>
Bump version to 0.2

Change-Id: Id4c5000f7f27a10a65b700c3961b8e6ebe3c5c22
Reviewed-on: https://gerrit.causes.com/17060
Reviewed-by: Shane da Silva <shane@causes.com>
Tested-by: Shane da Silva <shane@causes.com>
Teach scss-lint that selectors each get their own line

In our scss, each selector should be on its own line for readability.
scss-lint should complain about scss that has more than one selector on
a line, e.g.:

  .selector-a, .selector-b {

Related Story:
  http://www.pivotaltracker.com/story/show/42151789 (delivered)
  ("Teach scss-lint that selectors each get their own line")

Change-Id: If63df25bd5c275c104eefb4c23ba00d56b403c98
Reviewed-on: https://gerrit.causes.com/17213
Reviewed-by: Aiden Scandella <aiden@causes.com>
Tested-by: Joe Lencioni <joe.lencioni@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Bump version to 0.3

Related Story:
  http://www.pivotaltracker.com/story/show/42151789
  ("Teach scss-lint that selectors each get their own line")

Change-Id: If44fc4a9dea5c48c7e939057f2acb62ee0ebe1ec
Reviewed-on: https://gerrit.causes.com/17214
Tested-by: Joe Lencioni <joe.lencioni@causes.com>
Reviewed-by: Aiden Scandella <aiden@causes.com>
Reviewed-by: Shane da Silva <shane@causes.com>
Add linter for unnecessary types in selectors

Adds a linter that checks if an ID is unnecessarily qualified with a
selector.

For example, instead of

`ul#my-list`

we prefer

`#my-list`

as the latter is more concise, and the specificity of the ID far
outweighs the specificity of the type. This is also suggested by
http://google-styleguide.googlecode.com/svn/trunk/htmlcssguide.xml

Change-Id: I737ec89d7c5b089821504e6e9421ecb0749022e1
Reviewed-on: https://gerrit.causes.com/17396
Reviewed-by: Shane da Silva <shane@causes.com>
Tested-by: Shane da Silva <shane@causes.com>
Bump version to 0.4

Change-Id: Ided25d41650a407572533e59be97f1873a2e1186
Reviewed-on: https://gerrit.causes.com/17397
Reviewed-by: Shane da Silva <shane@causes.com>
Tested-by: Shane da Silva <shane@causes.com>
Clarify ShorthandLinter spec structure

- Group example groups by whether they pertain to full rules or to a
  single property.
- Tidy example group names.

Related Story:
  http://www.pivotaltracker.com/story/show/43148129
  ("Teach scss-lint about missed shorthand case")

Change-Id: Iabb4d75cf9aaf8e8a85c66b1ccdd5a530afc2f68
Reviewed-on: https://gerrit.causes.com/17748
Reviewed-by: Alex Wallace <alex.wallace@causes.com>
Tested-by: Joe Lencioni <joe.lencioni@causes.com>
Teach scss-lint `property: 10px 10px` can be shorter

The linter now complains about shorthand styles that follow the pattern
`property: 10px 10px`.

Related Story:
  http://www.pivotaltracker.com/story/show/43148129 (delivered)
  ("Teach scss-lint about missed shorthand case")

Change-Id: If8034ad68b0fe81afca64ba4228fda49e70f4bc5
Reviewed-on: https://gerrit.causes.com/17749
Reviewed-by: Lann Martin <lann@causes.com>
Tested-by: Joe Lencioni <joe.lencioni@causes.com>
Improve clarity of shorthand linter through naming

This commit improves the clarity of the shorthand linter by assigning
the values of the array that contains a property's shorthand values to
named variables that correspond to their placement (top, right, bottom,
and left).

Related Story:
  http://www.pivotaltracker.com/story/show/43148129
  ("Teach scss-lint about missed shorthand case")

Change-Id: Idc8833d36f2857eb56f7bada40674d5ba88ead14
Reviewed-on: https://gerrit.causes.com/17754
Reviewed-by: Lann Martin <lann@causes.com>
Tested-by: Joe Lencioni <joe.lencioni@causes.com>
Bump version to 0.5

Related Story:
  http://www.pivotaltracker.com/story/show/43148129
  ("Teach scss-lint about missed shorthand case")

Change-Id: I8b724a7b3cfe62894b65e3294c5fa1fe40c933eb
Reviewed-on: https://gerrit.causes.com/17750
Reviewed-by: Joe Lencioni <joe.lencioni@causes.com>
Tested-by: Joe Lencioni <joe.lencioni@causes.com>
Limit files included in gem to those tracked by git

In building v0.5 of the `scss-lint` gem, I had unknowingly included some
local files that were not tracked by git, resulting in some code being
included that shouldn't have been.

Although the original reason we included files based on glob matching
was because we didn't want to unnecessary tie our gem to git, this event
brings to light one of the advantages of only including files that are
tracked by git, and that is you have to have committed the file before
you can "push" it with the gem.

Since I personally have a bunch of untracked experimental files in my
scss-lint repository, I'd rather us include files in the gem based on
whether or not they have been "committed" (i.e. have been code reviewed)
than just based on whether or not they exist.

This change also bumps the version number to 0.5.1 so that the broken
version can be weeded out.

Change-Id: I862b30fc2a2f43e8f9396d856bff84a62caf0532
Reviewed-on: https://gerrit.causes.com/17792
Tested-by: Shane da Silva <shane@causes.com>
Reviewed-by: Aiden Scandella <aiden@causes.com>
Bump version to v0.5.2

The previous commit which deals with not commit untracked files still
picks up changes to tracked files. Unfortunately, I had a modification
to a file that was _already_ tracked, so it was accidentally included in
the gem that was build.

Upgrading the version allows us to push a new version to fix this
problem. I've learned a few painful lessons today about building gems.

Change-Id: I327925360007288d58f77f8f011a0e005039c80e
Reviewed-on: https://gerrit.causes.com/17803
Reviewed-by: Tony Wooster <tony.wooster@causes.com>
Tested-by: Shane da Silva <shane@causes.com>
Improve message for property format linter

Changes the lint error description for the property format linter to
suggest that the user is missing a semi-colon, as that usually is the
reason they are seeing the lint, and the more general language of the
error can be confusing the read at times.

Change-Id: I58dcb2845ba206e42de444381ab77d8bd1503614
Reviewed-on: https://gerrit.causes.com/17772
Tested-by: Shane da Silva <shane@causes.com>
Reviewed-by: Joe Lencioni <joe.lencioni@causes.com>
Ignore directories when recursively scanning

The call to `Find.find` was already recursing, but it was adding
directory names onto the `files` list, which in turn was causing the
Sass engine to choke trying to load a directory as a file.

Fixes #4.

Change-Id: I7c59ea3ff08410602d9e85459d8d615b49be9cb0
Reviewed-on: https://gerrit.causes.com/19252
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Greg Hurrell <greg@causes.com>
Add changelog

Change-Id: I013050435c24a141da542c70b8f96e6947c41540
Reviewed-on: https://gerrit.causes.com/19251
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Joe Lencioni <joe.lencioni@causes.com>
Fix shorthand_linter for most recent Sass gem

The internal structure changed between Sass versions. Previously, a
property such as:

    padding: 1px 1px 1px 1px;

Was stored as a `Sass::Script::String`, which the shorthand_linter was
explicitly sanity-checking. This changed to `Sass::Script::List`.
Fortunately, the `#to_s` returns the same thing, so the rest of the
linter works fine.

This drops the explicit class check for compatibility across versions,
letting duck-typing do its thing.

Change-Id: Ic9b1ce2d3a8ad48a284064fa24ac04fbd03612e4
Reviewed-on: https://gerrit.causes.com/19250
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Joe Lencioni <joe.lencioni@causes.com>
Only scan files with `css` or `scss` extension

Now that recursive directory scanning is working, it could be helpful to
pass a directory to `scss-lint` and have it only scan files that look
like they need to be linted.

Change-Id: I8eb2d49516b1514670f608b1f6c66c2e78615048
Reviewed-on: https://gerrit.causes.com/19253
Tested-by: jenkins <jenkins@causes.com>
Reviewed-by: Joe Lencioni <joe.lencioni@causes.com>