Skip to content

kumadee/pre-commit-checks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to install

1. Install dependencies

Ubuntu
sudo apt install python3-pip gawk &&\
pip3 install pre-commit

2. Install the pre-commit hook globally

DIR=~/.git-template
git config --global init.templateDir ${DIR}
pre-commit init-templatedir -t pre-commit ${DIR}

3. Add configs and hooks

Step into the repository you want to have the pre-commit hooks installed and run:

git init
cat <<EOF > .pre-commit-config.yaml
repos:
- repo: git://github.com/kumadee/pre-commit-php
  rev: <VERSION> # Get the latest from: https://github.com/kumadee/pre-commit-php/releases
  hooks:
    - id: docker-phpda-0
EOF

4. Run

After pre-commit hook has been installed you can run it manually on all files in the repository

pre-commit run -a

Available Hooks

There are several pre-commit hooks to keep PHP source code in a good shape:

Hook name Description
docker-phpda-0 Checks for possible dependency cycles and hierarchy violations in classes.
docker-phpda-1 Checks for possible dependency cycles and hierarchy violations in 'Internal'.
docker-phpda-2 Checks for possible dependency cycles and hierarchy violations in 'Domain/Framework'.
docker-phpda-3 Checks for possible dependency cycles and hierarchy violations in 'Framework/Module'.
container-factory-check Check if 'ContainerFactory' class is used in PHP source code.

Check the source file to know arguments used for each hook.

About

Github pre-commit hooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published