mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-09-14 20:36:37 +00:00
Add pre-commit hook to validate composer.json
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# Pre-commit git hooks.
|
||||
#
|
||||
# Usage:
|
||||
# 1. Run one of:
|
||||
# $ pip install pre-commit
|
||||
# $ brew install pre-commit
|
||||
#
|
||||
# 2. Install hooks
|
||||
# $ pre-commit install
|
||||
repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: composer-validate
|
||||
name: composer-validate
|
||||
language: script
|
||||
entry: scripts/pre-commit.sh
|
||||
files: 'composer\.json'
|
||||
pass_filenames: true
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
list_of_files="${@}"
|
||||
for file in $list_of_files; do
|
||||
if [[ "${file}" == "composer.json" ]]; then
|
||||
$(which composer) validate
|
||||
exit "${?}"
|
||||
else
|
||||
echo "unsupported file: ${file}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user