Skip to content

Commit 6050c21

Browse files
igorsgmcraduindy2krosnyk-botMartin Seysen
authored
Docker Support + Laravel 12 support + Configurable automatic fixing (#37)
* Updated workflow for Laravel 11 * Updated workflow for Laravel 11 * Added separate jobs for Laravel 10 and Laravel 11 * Added separate jobs for Laravel 9 * Added package lock to ignore, removed from project * Revert changes for package lock * Added support for more parameters including docker support * Fixed pint issues * Fixed pipeline failure detection * Fixed pint issues * Updated readme * Updated readme and tests * Updated readme * Fixed after rebase * Refactoring for strong typing enforce, added phpstan and rector run in pipeline * Added rector rules * Updated phpstan standard, added rector and php insights support * Added option for validate_paths * Added option for analyzer_chunk_size * Create dependabot.yml * Create snyk-security.yml * Removed snyk config * Create codacy.yml * Removed codacy config * Fixed param usage * Updated chunk size to be configurable per command if needed * Fixed rector tests * pint fixes * pint fixes * pint fixes * Updated composer reqs for pest plugin laravel * Removed Laravel 9 support * Updated npm package lock * fix: upgrade prettier from 2.8.7 to 2.8.8 Snyk has created this PR to upgrade prettier from 2.8.7 to 2.8.8. See this package in npm: prettier See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * Update package-lock.json * Updated npm deps * Updated npm deps * FΓΌge UnterstΓΌtzung fΓΌr Laravel Sail hinzu * Extend README.md with a "Laravel Sail" section * Optimize README.md Optimize config order * fix: upgrade eslint-plugin-import from 2.30.0 to 2.31.0 Snyk has created this PR to upgrade eslint-plugin-import from 2.30.0 to 2.31.0. See this package in npm: eslint-plugin-import See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade eslint-plugin-vue from 9.28.0 to 9.30.0 Snyk has created this PR to upgrade eslint-plugin-vue from 9.28.0 to 9.30.0. See this package in npm: eslint-plugin-vue See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade eslint-plugin-vue from 9.30.0 to 9.31.0 Snyk has created this PR to upgrade eslint-plugin-vue from 9.30.0 to 9.31.0. See this package in npm: eslint-plugin-vue See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade eslint-plugin-vue from 9.31.0 to 9.32.0 Snyk has created this PR to upgrade eslint-plugin-vue from 9.31.0 to 9.32.0. See this package in npm: eslint-plugin-vue See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade blade-formatter from 1.41.1 to 1.42.0 Snyk has created this PR to upgrade blade-formatter from 1.41.1 to 1.42.0. See this package in npm: blade-formatter See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: package.json & package-lock.json to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-CROSSSPAWN-8303230 - https://snyk.io/vuln/SNYK-JS-INFLIGHT-6095116 * updated package.json * Update .eslintrcFixture.js * Update .eslintrcFixture.js * Updated files * Skip test for now * Update main.yml * Update main.yml * Updated deps to be more loose with upgrades * Added cron execution for tests * Update main.yml * Fix ESLint tests * Upgrade scrutinizer checks * scrutinizer using 8.2 instead * scrutinizer using node v20.18.2 * node v22 * node v18 * node v18 * node v20 again * test * Check 2 * Check 3 * Check 4 * Using image * fix: package.json & package-lock.json to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-INFLIGHT-6095116 * fix: upgrade eslint from 9.18.0 to 9.19.0 Snyk has created this PR to upgrade eslint from 9.18.0 to 9.19.0. See this package in npm: eslint See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * Updated deps * Updated deps * Updated deps * Updated cache key * Added continue-on-error for laravel 12 for now * Removed laravel 12 jobs for now * Disable phpinsights security check (unrealiable now) * fix: upgrade eslint from 9.19.0 to 9.20.0 Snyk has created this PR to upgrade eslint from 9.19.0 to 9.20.0. See this package in npm: eslint See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade blade-formatter from 1.42.1 to 1.42.2 Snyk has created this PR to upgrade blade-formatter from 1.42.1 to 1.42.2. See this package in npm: blade-formatter See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade eslint from 9.20.0 to 9.20.1 Snyk has created this PR to upgrade eslint from 9.20.0 to 9.20.1. See this package in npm: eslint See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * Set fixed eslint version to avoid conflicts * Fixed eslint version * Update main.yml * Updated eslint deps * Update ESLintPreCommitHookTest.php * fix: upgrade eslint from 9.23.0 to 9.24.0 Snyk has created this PR to upgrade eslint from 9.23.0 to 9.24.0. See this package in npm: eslint See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade eslint from 9.24.0 to 9.25.1 Snyk has created this PR to upgrade eslint from 9.24.0 to 9.25.1. See this package in npm: eslint See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade eslint from 9.25.1 to 9.26.0 Snyk has created this PR to upgrade eslint from 9.25.1 to 9.26.0. See this package in npm: eslint See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade eslint from 9.26.0 to 9.27.0 Snyk has created this PR to upgrade eslint from 9.26.0 to 9.27.0. See this package in npm: eslint See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade eslint-plugin-import from 2.31.0 to 2.32.0 Snyk has created this PR to upgrade eslint-plugin-import from 2.31.0 to 2.32.0. See this package in npm: eslint-plugin-import See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * Bump @eslint/plugin-kit in the npm_and_yarn group across 1 directory --- updated-dependencies: - dependency-name: "@eslint/plugin-kit" dependency-version: 0.3.3 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <[email protected]> * fix: upgrade eslint from 9.27.0 to 9.30.1 Snyk has created this PR to upgrade eslint from 9.27.0 to 9.30.1. See this package in npm: eslint See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * fix: upgrade eslint from 9.30.1 to 9.31.0 Snyk has created this PR to upgrade eslint from 9.30.1 to 9.31.0. See this package in npm: eslint See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * Bump @eslint/plugin-kit in the npm_and_yarn group across 1 directory Bumps the npm_and_yarn group with 1 update in the / directory: [@eslint/plugin-kit](https://github.com/eslint/rewrite/tree/HEAD/packages/plugin-kit). Updates `@eslint/plugin-kit` from 0.3.3 to 0.3.4 - [Release notes](https://github.com/eslint/rewrite/releases) - [Changelog](https://github.com/eslint/rewrite/blob/main/packages/plugin-kit/CHANGELOG.md) - [Commits](https://github.com/eslint/rewrite/commits/plugin-kit-v0.3.4/packages/plugin-kit) --- updated-dependencies: - dependency-name: "@eslint/plugin-kit" dependency-version: 0.3.4 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <[email protected]> * fix: upgrade blade-formatter from 0.42.2 to 1.42.3 Snyk has created this PR to upgrade blade-formatter from 1.42.2 to 1.42.3. See this package in npm: blade-formatter See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * Update package-lock.json * Added mocking for test tools * Update main.yml * Update main.yml * Revert mock changes * Deprecate Laravel 10 support * Update .scrutinizer.yml * Added php-cs-fixer hook * Removed vitest reference * Updated readme * fix: upgrade eslint from 9.33.0 to 9.34.0 Snyk has created this PR to upgrade eslint from 9.33.0 to 9.34.0. See this package in npm: eslint See this project in Snyk: https://app.snyk.io/org/indy2kro/project/9f43d42b-212b-4851-b15c-d9c34efe76c1?utm_source=github&utm_medium=referral&page=upgrade-pr * Reverted upgrade to eslint * Update package-lock.json * feat: add Docker support and auto-fix capabilities to pre-commit hooks * refactor: remove Enlightn package and update related configurations * feat: add strict types declaration to WithAutoFix, WithDockerSupport, and WithFileAnalysis * feat: enhance pre-commit hooks with strict types and additional methods for command handling * wip * wip * feat: improve Docker command execution and enhance file analysis methods * feat: add CLAUDE.md for guidance on Laravel Git Hooks and update .gitignore --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: cradu <cradu@cradu> Co-authored-by: Cristi Radu <[email protected]> Co-authored-by: snyk-bot <[email protected]> Co-authored-by: Martin Seysen <[email protected]> Co-authored-by: Martin Seysen <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent c42045f commit 6050c21

File tree

115 files changed

+4609
-2371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+4609
-2371
lines changed

β€Ž.editorconfigβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ trim_trailing_whitespace = true
1111
[*.md]
1212
trim_trailing_whitespace = false
1313

14-
[*.yml]
15-
indent_size = 2
14+
[{*.yml,*.js}]
15+
indent_size = 2

β€Ž.github/dependabot.ymlβ€Ž

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
-
4+
package-ecosystem: composer
5+
directory: "/"
6+
schedule:
7+
interval: weekly
8+
versioning-strategy: auto
9+
groups:
10+
dev-dependencies:
11+
dependency-type: "development"

β€Ž.github/workflows/main.ymlβ€Ž

Lines changed: 41 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,27 @@ on:
1212
- master
1313
- main
1414
- develop
15+
schedule:
16+
- cron: "0 6 * * *"
17+
18+
permissions:
19+
contents: read
1520

1621
jobs:
17-
laravel9-tests:
22+
laravel11-tests:
1823
runs-on: ubuntu-latest
1924

2025
strategy:
26+
fail-fast: false
2127
matrix:
2228
operating-system: [ ubuntu-latest ]
23-
php: [ '8.1', '8.2' ]
29+
php: [ '8.2', '8.3', '8.4' ]
2430
dependency-stability: [ 'prefer-stable' ]
2531

26-
laravel: [ '9.*' ]
32+
laravel: [ '11.*' ]
2733
include:
28-
- laravel: 9.*
29-
testbench: 8.*
34+
- laravel: 11.*
35+
testbench: 9.*
3036

3137
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}
3238

@@ -44,7 +50,7 @@ jobs:
4450
id: node_modules-cache
4551
with:
4652
path: node_modules
47-
key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}
53+
key: ${{ runner.os }}-build-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}
4854

4955
- name: Install NPM packages
5056
if: steps.node_modules-cache.outputs.cache-hit != 'true'
@@ -65,22 +71,22 @@ jobs:
6571
id: actions-cache
6672
with:
6773
path: ${{ steps.composer-cache.outputs.dir }}
68-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
74+
key: ${{ runner.os }}-composer-laravel-11-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
6975
restore-keys: |
70-
${{ runner.os }}-composer-
76+
${{ runner.os }}-composer-laravel-11-${{ matrix.php }}-
7177
7278
- name: Cache PHP dependencies (vendor)
7379
uses: actions/cache@v4
7480
id: vendor-cache
7581
with:
7682
path: vendor
77-
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}
83+
key: ${{ runner.os }}-build-laravel-11-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
7884

7985
- name: Install Laravel Dependencies
8086
if: steps.vendor-cache.outputs.cache-hit != 'true'
8187
run: |
8288
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
83-
composer update --${{ matrix.dependency-stability }} --prefer-dist --no-interaction --no-suggest
89+
composer update --${{ matrix.dependency-stability }} --prefer-dist --no-interaction
8490
8591
- name: Update Dependencies with latest stable
8692
if: matrix.dependency-stability == 'prefer-stable'
@@ -108,113 +114,29 @@ jobs:
108114
- name: Execute Code Sniffer via Laravel Pint
109115
run: vendor/bin/pint --test src config
110116

111-
laravel10-tests:
112-
runs-on: ubuntu-latest
113-
114-
strategy:
115-
matrix:
116-
operating-system: [ ubuntu-latest ]
117-
php: [ '8.1', '8.2' ]
118-
dependency-stability: [ 'prefer-stable' ]
119-
120-
laravel: [ '10.*' ]
121-
include:
122-
- laravel: 10.*
123-
testbench: 8.*
124-
125-
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}
126-
127-
steps:
128-
- name: Checkout code
129-
uses: actions/checkout@v4
130-
131-
- name: Setup Node.js
132-
uses: actions/setup-node@v4
133-
with:
134-
node-version: '20.x'
135-
136-
- name: Cache node_modules directory
137-
uses: actions/cache@v4
138-
id: node_modules-cache
139-
with:
140-
path: node_modules
141-
key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}
142-
143-
- name: Install NPM packages
144-
if: steps.node_modules-cache.outputs.cache-hit != 'true'
145-
run: npm ci --include=dev
146-
147-
- name: Install PHP versions
148-
uses: shivammathur/setup-php@v2
149-
with:
150-
php-version: ${{ matrix.php }}
151-
152-
- name: Get Composer Cache Directory
153-
id: composer-cache
154-
run: |
155-
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
156-
157-
- name: Cache Composer dependencies
158-
uses: actions/cache@v4
159-
id: actions-cache
160-
with:
161-
path: ${{ steps.composer-cache.outputs.dir }}
162-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
163-
restore-keys: |
164-
${{ runner.os }}-composer-
165-
166-
- name: Cache PHP dependencies (vendor)
167-
uses: actions/cache@v4
168-
id: vendor-cache
169-
with:
170-
path: vendor
171-
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}
172-
173-
- name: Install Laravel Dependencies
174-
if: steps.vendor-cache.outputs.cache-hit != 'true'
175-
run: |
176-
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
177-
composer update --${{ matrix.dependency-stability }} --prefer-dist --no-interaction --no-suggest
178-
179-
- name: Update Dependencies with latest stable
180-
if: matrix.dependency-stability == 'prefer-stable'
181-
run: composer update --prefer-stable
182-
183-
- name: Update Dependencies with lowest stable
184-
if: matrix.dependency-stability == 'prefer-lowest'
185-
run: composer update --prefer-stable --prefer-lowest
186-
187-
- name: Set up Git User
188-
run: |
189-
git config --global user.email "[email protected]"
190-
git config --global user.name "GitHub Actions"
117+
- name: Execute PHP Stan
118+
run: vendor/bin/phpstan
191119

192-
# Code quality
193-
- name: Execute tests (Unit and Feature tests) via PestPHP
194-
shell: 'script -q -e -c "bash {0}"'
195-
# Set environment
196-
env:
197-
SESSION_DRIVER: array
198-
TTY: true
199-
200-
run: vendor/bin/pest
120+
- name: Execute Rector
121+
run: vendor/bin/rector --dry-run
201122

202-
- name: Execute Code Sniffer via Laravel Pint
203-
run: vendor/bin/pint --test src config
123+
- name: Execute PHP Insights
124+
run: vendor/bin/phpinsights --disable-security-check --no-interaction
204125

205-
laravel11-tests:
126+
laravel12-tests:
206127
runs-on: ubuntu-latest
207128

208129
strategy:
130+
fail-fast: false
209131
matrix:
210132
operating-system: [ ubuntu-latest ]
211-
php: [ '8.2', '8.3' ]
133+
php: [ '8.2', '8.3', '8.4' ]
212134
dependency-stability: [ 'prefer-stable' ]
213135

214-
laravel: [ '11.*' ]
136+
laravel: [ '12.*' ]
215137
include:
216-
- laravel: 11.*
217-
testbench: 9.*
138+
- laravel: 12.*
139+
testbench: 10.*
218140

219141
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system}}
220142

@@ -232,7 +154,7 @@ jobs:
232154
id: node_modules-cache
233155
with:
234156
path: node_modules
235-
key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}
157+
key: ${{ runner.os }}-build-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}
236158

237159
- name: Install NPM packages
238160
if: steps.node_modules-cache.outputs.cache-hit != 'true'
@@ -253,22 +175,22 @@ jobs:
253175
id: actions-cache
254176
with:
255177
path: ${{ steps.composer-cache.outputs.dir }}
256-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
178+
key: ${{ runner.os }}-composer-laravel-12-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
257179
restore-keys: |
258-
${{ runner.os }}-composer-
180+
${{ runner.os }}-composer-laravel-12-${{ matrix.php }}-
259181
260182
- name: Cache PHP dependencies (vendor)
261183
uses: actions/cache@v4
262184
id: vendor-cache
263185
with:
264186
path: vendor
265-
key: ${{ runner.OS }}-build-${{ hashFiles('**/composer.lock') }}
187+
key: ${{ runner.os }}-build-laravel-12-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
266188

267189
- name: Install Laravel Dependencies
268190
if: steps.vendor-cache.outputs.cache-hit != 'true'
269191
run: |
270192
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
271-
composer update --${{ matrix.dependency-stability }} --prefer-dist --no-interaction --no-suggest
193+
composer update --${{ matrix.dependency-stability }} --prefer-dist --no-interaction
272194
273195
- name: Update Dependencies with latest stable
274196
if: matrix.dependency-stability == 'prefer-stable'
@@ -296,3 +218,11 @@ jobs:
296218
- name: Execute Code Sniffer via Laravel Pint
297219
run: vendor/bin/pint --test src config
298220

221+
- name: Execute PHP Stan
222+
run: vendor/bin/phpstan
223+
224+
- name: Execute Rector
225+
run: vendor/bin/rector --dry-run
226+
227+
- name: Execute PHP Insights
228+
run: vendor/bin/phpinsights --disable-security-check --no-interaction

β€Ž.gitignoreβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ composer.lock
55
yarn.lock
66
.phpunit.cache
77
.phpunit.result.cache
8+
.phpactor.json
9+
.claude/

β€Ž.scrutinizer.ymlβ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
build:
2+
image: default-jammy
23
environment:
4+
node: v20
35
php:
4-
version: 8.1
5-
node: "v16.20.0"
6+
version: 8.3.3
67
nodes:
78
analysis:
89
project_setup:

β€ŽCLAUDE.mdβ€Ž

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# CLAUDE.md
2+
3+
Guidance for Claude Code (claude.ai/code) when working with Laravel Git Hooks package.
4+
5+
## Quick Start
6+
7+
Laravel Git Hooks manages Git hooks for Laravel projects with pre-configured quality tools (Pint, PHPCS, ESLint, Prettier, Larastan) + Docker support.
8+
9+
### Essential Commands
10+
11+
**Quality Checks** (run these before committing):
12+
```bash
13+
vendor/bin/pint --test src config # Check code style
14+
vendor/bin/phpstan # Static analysis
15+
composer test # Run tests
16+
```
17+
18+
**Auto-fix Issues**:
19+
```bash
20+
vendor/bin/pint src config # Fix code style
21+
vendor/bin/rector # Apply code improvements
22+
vendor/bin/phpcbf # Fix PHP CodeSniffer issues
23+
```
24+
25+
**Hook Management**:
26+
```bash
27+
php artisan git-hooks:register # Register hooks after config changes
28+
php artisan git-hooks:make # Create custom hook class
29+
```
30+
31+
## Project Structure
32+
33+
```
34+
src/
35+
β”œβ”€β”€ Contracts/ # Hook interfaces (PreCommitHook, MessageHook, etc.)
36+
β”œβ”€β”€ Console/Commands/
37+
β”‚ β”œβ”€β”€ Hooks/ # Pre-configured tool integrations
38+
β”‚ └── *.php # Core hook commands
39+
β”œβ”€β”€ Traits/
40+
β”‚ β”œβ”€β”€ WithAutoFix # Auto-fixing functionality
41+
β”‚ β”œβ”€β”€ WithDockerSupport # Docker execution
42+
β”‚ └── WithFileAnalysis # File utilities
43+
└── GitHooksServiceProvider.php
44+
45+
config/git-hooks.php # Main configuration
46+
tests/ # Pest tests
47+
```
48+
49+
## Key Concepts
50+
51+
- **Pipeline Processing**: Hooks run sequentially via Laravel Pipeline
52+
- **Docker Support**: Configure per-hook with `run_in_docker`, `docker_container`, `use_sail`
53+
- **Auto-fix**: Hooks can automatically fix issues when configured
54+
- **Hook Types**: PreCommit, PostCommit, PrePush, CommitMessage
55+
56+
## Development Workflow
57+
58+
1. Make changes
59+
2. `composer test` - Ensure tests pass
60+
3. `vendor/bin/pint --test src config` - Check style
61+
4. `vendor/bin/phpstan` - Static analysis
62+
5. `php artisan git-hooks:register` - After config changes
63+
64+
## Testing
65+
66+
```bash
67+
vendor/bin/pest # Run all tests
68+
vendor/bin/pest tests/Unit/SomeTest.php # Specific test
69+
composer test-coverage # With coverage
70+
```

0 commit comments

Comments
Β (0)