{"id":13852700,"url":"https://github.com/alexpott/d8githooks","last_synced_at":"2026-01-16T07:54:25.521Z","repository":{"id":70070007,"uuid":"11910643","full_name":"alexpott/d8githooks","owner":"alexpott","description":"Drupal core committer git hooks","archived":false,"fork":false,"pushed_at":"2025-07-01T08:08:55.000Z","size":128,"stargazers_count":58,"open_issues_count":4,"forks_count":16,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-07-02T05:08:46.623Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexpott.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-08-05T22:48:34.000Z","updated_at":"2025-07-01T08:08:59.000Z","dependencies_parsed_at":"2024-01-14T09:17:23.400Z","dependency_job_id":"e44b7153-34cb-494e-924b-9a7417e77105","html_url":"https://github.com/alexpott/d8githooks","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alexpott/d8githooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpott%2Fd8githooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpott%2Fd8githooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpott%2Fd8githooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpott%2Fd8githooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexpott","download_url":"https://codeload.github.com/alexpott/d8githooks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpott%2Fd8githooks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265098887,"owners_count":23711217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T22:01:32.756Z","updated_at":"2026-01-16T07:54:25.495Z","avatar_url":"https://github.com/alexpott.png","language":"Shell","funding_links":[],"categories":["Shell","Scripts"],"sub_categories":["Git hooks"],"readme":"# Drupal core committer git hooks\n\n## About this project\nThis project performs automated checks (e.g. file permissions, PHP/CSS/JS coding standards) before/after performing a commit, to ensure regressions are not accidentally committed.\n\n## Project setup\n\n_How do I, as a developer, start working on the project?_\n\nThis project depends on:\n\n1. [git] (https://git-scm.com/downloads)\n1. [composer](https://getcomposer.org/download/)\n1. Drupal 10\n1. Running composer install in the root directory of the repository you have checked out\n1. Running yarn install in the core directory of the repository you have checked out\n\n### Optional dependencies\n1. [Homebrew](http://brew.sh/) (You can use homebrew to install many of the dependencies above.)\n1. pbcopy \u0026 pbpaste\n1. cowsay (```brew install cowsay```)\n\n\n## How to install\n\n1. Clone the respository into any directory; for example your home directory: \n\n   ````\n   cd ~; git clone https://github.com/alexpott/d8githooks.git\n   ````\n   \n1. Navigate to the `.git/hooks` directory inside the Drupal 8 clone from which you commit patches \n\n   ````\n   cd ~/Sites/8.x/.git/hooks\n   ````\n\n1. Create symlinks to pre-commit and post-commit files:\n   \n  ```\n  ln -sfn ~/d8githooks/pre-commit pre-commit;\n  ln -sfn ~/d8githooks/post-commit post-commit;\n  ````\n\n1. Mark the hooks as executable. \n\n   ````\n   chmod u+x pre-commit; chmod u+x post-commit\n   ````\n\nTo test that it's working, introduce a file permissions error and then attempt to commit a text change:\n\n````\ncd ~/Sites/8.x\ncomposer install\nchmod 777 core/core.services.yml\necho 'test' \u003e\u003e core/core.services.yml \ngit add core/core.services.yml\ngit commit -m \"Test.\"\n````\n\nYou should see the error:\n\n````\ngit pre-commit check failed: file core/core.services.yml should be 644 not 777\n````\n\n## Troubleshooting\n\n### Using core's Coder dev dependency\n\nIf you previously installed PHPCS or Coder globally according to instructions on https://www.drupal.org/node/1419988 and your pre-commit hook starts failing silently, you may need to do:\n\n````\ncomposer global remove drupal/coder\ncomposer global remove phpcs\ncomposer install\n````\n\nThis change is required because a canonical version of Coder is now added as a core dev dependency.\n\n### Manually checking or fixing a PHP standard\n\nTo manually test the standard on a particular file prior to commit:\n\n1. Apply any relevant patch (including fixes, newly configured rules, etc.)\n2. From within the repository, run:\n\n   ````\n   composer install\n   ````\n\n3. From the root of the repository, run:\n\n   ````\n   composer run phpcs -- core/path/to/file.php\n   ````\n\n   You can confirm that the check is working properly by (e.g.) adding an unused use statement to the file and ensuring it raises an error.\n   \n   Similarly, to use phpcbf to fix a file, run:\n\n   ````\n   composer run phpcbf -- core/path/to/file.php\n   ````\n\n   Note that in some cases the enabled core rules are not enough to fix errors correctly! You can also check:\n\n   ````\n   vendor/bin/phpcs --standard=Drupal core/path/to/file.php\n   ````\n   \n   Be aware, however, that this may introduce out-of-scope changes as it will run rules that core does not yet comply with.\n\n### Troubleshooting eslint\n\n````\nsudo npm update -g\n````\n\nIf you previously installed yarn from Homebrew or another non-npm package manager:\n````\nbrew uninstall yarn\nnpm install -g corepack\ncorepack enable\n````\n\n## How to use\n@todo something about what standard message(s) to copy/paste.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexpott%2Fd8githooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexpott%2Fd8githooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexpott%2Fd8githooks/lists"}