1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-08-03 22:15:42 +02:00

Added make lint-changed which lints changed files only.

This commit is contained in:
Ruben Vereecken 2015-04-14 22:15:00 +02:00
parent 075c96c3ce
commit 4b44492314
3 changed files with 13 additions and 2 deletions

View file

@ -7,8 +7,12 @@ setup:
@chmod +x .git/hooks/pre-commit
@echo "Git pre-commit hook installed."
@gem install mdl --install-dir .gem
@gem install mdl --install-dir .gem --no-rdoc --no-ri
@echo "Installed required Ruby gems under .gem"
lint:
@GEM_PATH=.gem PATH=$(PATH):.gem/bin find pages -exec mdl {} --style ./scripts/markdown-style.rb 1>&2 \;
@GEM_PATH=.gem find pages -exec .gem/bin/mdl {} --style ./scripts/markdown-style.rb 1>&2 \;
lint-changed:
@./scripts/lint-changed.sh

6
scripts/lint-changed.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
MD_FILES=`git diff --cached --name-only | tr " " "\n" | egrep ^.*\.md$`
# Execute Markdown lint if any markdown files have been changed and added to git
[[ -z "$MD_FILES" ]] || GEM_PATH=.gem .gem/bin/mdl "$MD_FILES"

View file

@ -2,3 +2,4 @@
make index
git add ./pages/index.json
make lint-changed