Skip to content

Commit

Permalink
Merge pull request rodjek#3 from robbyt/patch-1
Browse files Browse the repository at this point in the history
Add JSON lint
  • Loading branch information
joschi committed Nov 23, 2013
2 parents a181045 + 89186e4 commit 1d19b08
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ do
STATUS=2
fi
;;
json)
# syntax YAML files, https://ttboj.wordpress.com/2013/08/25/finding-yaml-errors-in-puppet/
ruby -rjson -e "JSON.parse(File.open('${TMPFILE}').read)" >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo "JSON syntax error in ${file}" >&2
STATUS=2
fi
;;
esac
fi
done
Expand Down

0 comments on commit 1d19b08

Please sign in to comment.