Skip to content

Commit

Permalink
Add an scss linter.
Browse files Browse the repository at this point in the history
  • Loading branch information
WouterSioen committed Feb 3, 2015
1 parent 6ecd7ec commit 024f7a9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@ CSS Lint is easy to install with the node package manager:

sudo npm install -g csslint

### SCSS lint

[https://github.com/causes/scss-lint](https://github.com/causes/scss-lint)

SCSS Lint is easy to install using ruby gems:

gem install scss-lint
22 changes: 22 additions & 0 deletions pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# codesniffer (http://pear.php.net/package/PHP_CodeSniffer/redirected)
# esvalidate (https://github.com/duereg/esvalidate)
# CSS lint (https://github.com/stubbornella/csslint/wiki/Command-line-interface)
# SCSS lint (https://github.com/causes/scss-lint)
#
# @version 1.1.0
# @author Wouter Sioen <[email protected]>
Expand Down Expand Up @@ -98,6 +99,27 @@ if [ -n "$files" ]; then
done
fi

# fetch all changed css files and validate them
files=$(git diff-index --name-only --diff-filter=ACMR $against | grep -E '\.s(c|a)ss$')
if [ -n "$files" ]; then

echo
echo 'Checking SCSS Files'
echo '------------------'
echo

for file in $files; do
output=`scss-lint $file | grep '\[E\]'`

# if our output is not empty, there were errors
if [ -n "$output" ]; then
echo "$file contains scss syntax errors"
scss-lint $file | grep '\[E\]'
errors=("${errors[@]}" "$output")
fi
done
fi

# Let's pop our stash. We don't want to lose anything
git stash pop -q

Expand Down

0 comments on commit 024f7a9

Please sign in to comment.