@@ -5,15 +5,16 @@ A collection of reusable git hook scripts for automating code quality checks and
55## Features
66
77- ** JavaScript/TypeScript** : ESLint, Prettier, TypeScript type checking, Vitest test runner, test existence validation
8- - ** Python** : Flake8 linting, Mypy static analysis, Pytest runner, service test validation (local and Docker modes)
8+ - ** Python** : Flake8 linting, Mypy static analysis, Ruff linting, Pytest runner, service test validation (local and Docker modes)
99- ** PHP/Laravel** : PHPStan analysis with progressive error reduction, Pint code style fixing, test coverage validation
1010- ** CSS/SCSS/Less** : Stylelint code style validation
1111- ** HTML** : HTMLHint linting
1212- ** Markdown** : markdownlint style validation
1313- ** YAML** : yamllint style validation
1414- ** Docker** : Dockerfile linting with Hadolint
15- - ** Shell** : Script validation with ShellCheck
16- - ** Git** : Branch naming conventions, automatic task ID injection in commits
15+ - ** Shell** : Script validation with ShellCheck, shfmt formatting check
16+ - ** Git** : Branch naming conventions, automatic task ID injection in commits, secret detection with gitleaks
17+ - ** Simple** : Spelling check with codespell, JSON syntax validation
1718
1819## Quick Start
1920
@@ -48,6 +49,8 @@ A collection of reusable git hook scripts for automating code quality checks and
4849| ` python/check_mypy_in_docker.sh ` | Runs Mypy inside the Docker container, maps host/container paths. |
4950| ` python/check_pytest.sh ` | Runs the full Pytest suite locally with ` PYTHONPATH=./app ` . |
5051| ` python/check_pytest_in_docker.sh ` | Runs Pytest inside the Docker container, converts container paths to host paths. |
52+ | ` python/check_ruff.sh ` | Runs Ruff linter on staged Python files passed as arguments. |
53+ | ` python/check_ruff_all.sh ` | Runs Ruff linter on all Python files in the project. |
5154| ` python/find_test.sh ` | Validates that each service in ` app/services/ ` has exactly one corresponding test file. |
5255
5356### PHP
@@ -92,6 +95,8 @@ A collection of reusable git hook scripts for automating code quality checks and
9295| Script | Description |
9396| --------| -------------|
9497| ` git/check_branch_name.sh ` | Validates branch names match pattern: ` {type}/{task-id}_{description} ` |
98+ | ` git/check_gitleaks.sh ` | Scans staged changes for secrets using gitleaks (optional; exits 0 if not installed). |
99+ | ` git/check_gitleaks_all.sh ` | Scans full repository history for secrets using gitleaks. |
95100| ` git/preparations/add_task_id_in_commit.sh ` | Prepends task ID from branch name to commit message. |
96101| ` git/preparations/prepare-commit-description.sh ` | Appends list of changed files to commit message. |
97102
@@ -106,8 +111,19 @@ A collection of reusable git hook scripts for automating code quality checks and
106111| Script | Description |
107112| --------| -------------|
108113| ` shell/check_shellcheck.sh ` | Validates shell scripts using ShellCheck (via Docker). |
114+ | ` shell/check_shfmt.sh ` | Checks shell script formatting using shfmt (` -i 2 -ci ` ). |
115+ | ` shell/check_shfmt_all.sh ` | Checks formatting of all ` .sh ` files in the project. |
109116| ` scripts/check_shellcheck.sh ` | Validates shell scripts using ShellCheck (local). |
110117
118+ ### Simple
119+
120+ | Script | Description |
121+ | --------| -------------|
122+ | ` simple/check_codespell.sh ` | Checks files for spelling mistakes using codespell. |
123+ | ` simple/check_codespell_all.sh ` | Checks all project files for spelling mistakes. |
124+ | ` simple/check_json_validate.sh ` | Validates JSON files for syntax correctness using ` python3 -m json.tool ` . |
125+ | ` simple/check_json_validate_all.sh ` | Validates all ` *.json ` files in the project. |
126+
111127## Usage Examples
112128
113129### JavaScript/TypeScript
@@ -210,6 +226,56 @@ A collection of reusable git hook scripts for automating code quality checks and
210226./yml/check_yamllint_all.sh
211227```
212228
229+ ### Ruff
230+
231+ ``` bash
232+ # Check staged files
233+ ./python/check_ruff.sh app/services/user.py app/models/auth.py
234+
235+ # Check all Python files in the project
236+ ./python/check_ruff_all.sh
237+ ```
238+
239+ ### Gitleaks
240+
241+ ``` bash
242+ # Check staged changes for secrets (optional: exits 0 if gitleaks not installed)
243+ ./git/check_gitleaks.sh
244+
245+ # Scan full repository history for secrets
246+ ./git/check_gitleaks_all.sh
247+ ```
248+
249+ ### shfmt
250+
251+ ``` bash
252+ # Check staged shell scripts for formatting
253+ ./shell/check_shfmt.sh deploy.sh scripts/setup.sh
254+
255+ # Check all shell scripts in the project
256+ ./shell/check_shfmt_all.sh
257+ ```
258+
259+ ### Codespell
260+
261+ ``` bash
262+ # Check specific files for spelling mistakes
263+ ./simple/check_codespell.sh README.md src/utils.py
264+
265+ # Check all project files
266+ ./simple/check_codespell_all.sh
267+ ```
268+
269+ ### JSON Validation
270+
271+ ``` bash
272+ # Validate specific JSON files
273+ ./simple/check_json_validate.sh package.json .eslintrc.json
274+
275+ # Validate all JSON files in the project
276+ ./simple/check_json_validate_all.sh
277+ ```
278+
213279### Branch Name Validation
214280
215281``` bash
@@ -290,6 +356,7 @@ SH_FILES=$(echo "$FILES" | grep '\.sh$' || true)
290356./tests/javascript/vitest/run.sh
291357./tests/python/flake8/run.sh
292358./tests/python/mypy/run.sh
359+ ./tests/python/ruff/run.sh
293360./tests/python/find_test/run.sh
294361./tests/css/stylelint/run.sh
295362./tests/css/stylelint_all/run.sh
@@ -299,6 +366,10 @@ SH_FILES=$(echo "$FILES" | grep '\.sh$' || true)
299366./tests/markdown/markdownlint_all/run.sh
300367./tests/yml/yamllint/run.sh
301368./tests/yml/yamllint_all/run.sh
369+ ./tests/git/gitleaks/run.sh
370+ ./tests/shell/shfmt/run.sh
371+ ./tests/simple/codespell/run.sh
372+ ./tests/simple/json_validate/run.sh
302373```
303374
304375## Requirements
@@ -308,11 +379,15 @@ SH_FILES=$(echo "$FILES" | grep '\.sh$' || true)
308379- jq
309380- Node.js with npx (for JavaScript/TypeScript, CSS, HTML hooks)
310381- Python 3, Flake8, Mypy, Pytest (for Python hooks)
382+ - Ruff (` pip install ruff ` ) for ` python/check_ruff.sh `
383+ - Codespell (` pip install codespell ` ) for ` simple/check_codespell.sh `
311384- PHP 8.1+ with Composer (for PHP hooks)
312385- Stylelint (` npm install -g stylelint ` ) or via ` npx `
313386- HTMLHint (` npm install -g htmlhint ` ) or via ` npx `
314387- markdownlint-cli (` npm install -g markdownlint-cli ` )
315388- yamllint (` pip install yamllint ` or system package)
389+ - shfmt (` go install mvdan.cc/sh/v3/cmd/shfmt@latest ` or ` brew install shfmt ` ) for ` shell/check_shfmt.sh `
390+ - gitleaks (optional, see [ install guide] ( https://github.com/gitleaks/gitleaks#installing ) ) for ` git/check_gitleaks.sh `
316391- Docker (optional, for Docker-based hooks)
317392- ShellCheck (for shell validation)
318393
0 commit comments