Dude's comprehensive code quality definitions and pre-commit hooks for WordPress projects.
- Pre-commit hooks with comprehensive code quality checks
- Automatic context detection (standalone theme vs dudestack project)
- Build system detection (Parcel or Gulp)
- PHP CodeSniffer validation
- Stylelint for SCSS files
- WordPress version checks (dudestack mode)
- Dependency validation for Composer and npm
- Merge conflict and scissor mark detection
- Commit message validation with Linear integration
- AI attribution rejection in commit messages
npm install @digitoimistodude/code-quality-checks husky --save-devInitialize husky:
npx husky initCreate wrapper scripts in your project's .husky/ directory that reference the package hooks.
node_modules/@digitoimistodude/code-quality-checks/.husky/pre-commitnode_modules/@digitoimistodude/code-quality-checks/.husky/commit-msg "$1"Make them executable:
chmod +x .husky/pre-commit .husky/commit-msgThe hooks automatically detect whether they're running in:
- dudestack project: Has
content/themes/directory andcomposer.json - Standalone theme: Everything else
- WordPress version in composer.json
- Composer dependencies
- CHANGELOG.md format and freshness
- Theme style.css validation
- Multi-theme dependency checks
- Root stylelintrc should not exist
- Basic file requirements (.nvmrc, phpcs.xml)
- Build system config (Parcel: .parcelrc or Gulp: gulpfile.js)
- npm dependencies
- Stylelint config in current directory
- PHP syntax validation
- SCSS linting
Every commit message is validated in the commit-msg hook.
The message must carry a task ID and a magic word, for example Fix navigation bug, Ref: DEV-123.
The commit is rejected if the message carries attribution to an AI tool. This covers Co-Authored-By trailers naming an assistant or model, generated-with lines such as Generated with Claude Code, AI vendor footer links and AI session URLs. The check runs before the merge-commit escape hatch, so a merge commit cannot carry attribution either.
Co-Authored-By trailers for real people are untouched. Use assistants as much as you like, just do not sign the history with them.
When a commit is rejected, amend it rather than bypassing the hook:
git commit --amendSee the organisation contributing rules for the policy this enforces.
Create .husky/pre-commit-config in your project to override defaults:
# Directories to exclude
EXCLUDE_DIRS=".husky|node_modules|vendor|.git|uploads|cache"
# Files to exclude (glob patterns)
EXCLUDE_FILES="*.min.js|*.min.css|*.map|*.lock|*.log"
# File extensions to exclude
EXCLUDE_EXTENSIONS=".jpg|.jpeg|.png|.gif|.svg|.ico|.pdf"
# Check only changed files (true) or entire codebase (false)
CHECK_CHANGED_ONLY=true- Node.js >= 18.0.0
- PHP >= 8.1
- Composer (for dudestack projects)
- husky >= 9.1.7
Simply update the package to get the latest hooks:
npm update @digitoimistodude/code-quality-checksNo need to re-copy files - your wrapper scripts always use the latest version from node_modules.