Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ Or if installed as submodule/manually:
./pint
```

You can pass additional arguments to customise the behaviour:
```bash
./vendor/synergitech/laravel-coding-standards/pint --verbose
./vendor/synergitech/laravel-coding-standards/pint --dry-run
./vendor/synergitech/laravel-coding-standards/pint app/Models
```

#### Test Code Standards
To check for coding standard issues without making changes:
```bash
Expand All @@ -64,6 +71,12 @@ Or if installed as submodule/manually:
./pint-test
```

You can pass additional arguments to customise the testing:
```bash
./vendor/synergitech/laravel-coding-standards/pint-test --verbose
./vendor/synergitech/laravel-coding-standards/pint-test app/Controllers
```

### Adding Scripts to Your Composer.json

For easier access, you can add these scripts to your project's `composer.json`:
Expand Down
13 changes: 4 additions & 9 deletions pint
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@ CONFIG_FILE="$SCRIPT_DIR/pint.json"

# Try to find pint executable in different locations
PINT_EXECUTABLE=""
if [ -f "./vendor/bin/pint" ]; then
PINT_EXECUTABLE="./vendor/bin/pint"
elif [ -f "../../../bin/pint" ]; then
# When installed via Composer in vendor/synergitech/laravel-coding-standards
PINT_EXECUTABLE="../../../bin/pint"
elif command -v pint >/dev/null 2>&1; then
PINT_EXECUTABLE="pint"
if [ -f "./vendor/laravel/pint/builds/pint" ]; then
PINT_EXECUTABLE="./vendor/laravel/pint/builds/pint"
else
echo "Error: Laravel Pint not found. Please install it with 'composer require laravel/pint --dev'"
exit 1
Expand All @@ -29,6 +24,6 @@ if [ ! -f "$CONFIG_FILE" ]; then
exit 1
fi

# Run pint with the config file
# Run pint with the config file and pass through all arguments
echo "Running Laravel Pint with config: $CONFIG_FILE"
$PINT_EXECUTABLE --config="$CONFIG_FILE"
$PINT_EXECUTABLE --config="$CONFIG_FILE" "$@"
17 changes: 6 additions & 11 deletions pint-test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Laravel Pint - Test coding standards
# This script runs Laravel Pint in test mode to check for coding standard issues without making changes
# This script runs Laravel Pint to test the code matches standards

# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
Expand All @@ -11,13 +11,8 @@ CONFIG_FILE="$SCRIPT_DIR/pint.json"

# Try to find pint executable in different locations
PINT_EXECUTABLE=""
if [ -f "./vendor/bin/pint" ]; then
PINT_EXECUTABLE="./vendor/bin/pint"
elif [ -f "../../../bin/pint" ]; then
# When installed via Composer in vendor/synergitech/laravel-coding-standards
PINT_EXECUTABLE="../../../bin/pint"
elif command -v pint >/dev/null 2>&1; then
PINT_EXECUTABLE="pint"
if [ -f "./vendor/laravel/pint/builds/pint" ]; then
PINT_EXECUTABLE="./vendor/laravel/pint/builds/pint"
else
echo "Error: Laravel Pint not found. Please install it with 'composer require laravel/pint --dev'"
exit 1
Expand All @@ -29,6 +24,6 @@ if [ ! -f "$CONFIG_FILE" ]; then
exit 1
fi

# Run pint in test mode with the config file
echo "Testing coding standards with Laravel Pint using config: $CONFIG_FILE"
$PINT_EXECUTABLE --test --config="$CONFIG_FILE"
# Run pint with the config file and pass through all arguments
echo "Running Laravel Pint with config: $CONFIG_FILE"
$PINT_EXECUTABLE --test --config="$CONFIG_FILE" "$@"