PHP code example of blundergoat / gruff-php
1. Go to this page and download the library: Download blundergoat/gruff-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
blundergoat / gruff-php example snippets bash
composer ruff-php init
vendor/bin/gruff-php summary
bash
git clone https://github.com/blundergoat/gruff-php.git
cd gruff-php
composer install
php bin/gruff-php --help
bash
# Create the project config.
vendor/bin/gruff-php init
# Review the current finding mix.
vendor/bin/gruff-php summary
# Explore without failing because of findings.
vendor/bin/gruff-php analyse --fail-on none
# Gate on warning and error findings.
vendor/bin/gruff-php analyse --fail-on warning
# Emit SARIF for code scanning.
vendor/bin/gruff-php analyse --format sarif --fail-on none > gruff.sarif
# Generate a fresh-start baseline.
vendor/bin/gruff-php analyse --generate-baseline --fail-on none
# Start the local dashboard.
vendor/bin/gruff-php dashboard
bash
vendor/bin/gruff-php analyse --format github --fail-on warning
yaml
jobs:
gruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
- run: composer install --no-interaction --prefer-dist
- run: vendor/bin/gruff-php analyse --format sarif --fail-on none > gruff-php.sarif
bash
vendor/bin/gruff-php analyse --profile security --no-baseline --fail-on warning
bash
vendor/bin/gruff-php analyse --generate-baseline --fail-on none
vendor/bin/gruff-php analyse --baseline=gruff-baseline.json --fail-on warning
vendor/bin/gruff-php analyse --no-baseline --fail-on none
bash
vendor/bin/gruff-php analyse --format json --changed-ranges "3-3,8-10" src/Example.php --fail-on none
vendor/bin/gruff-php analyse --format json --since HEAD src/Example.php --fail-on none
git diff | vendor/bin/gruff-php analyse --format json --diff - --fail-on none
bash
vendor/bin/gruff-php analyse --diff-vs=origin/main --changed-only --fail-on none
bash
vendor/bin/gruff-php analyse --infection-report=infection-report.json
vendor/bin/gruff-php analyse --infection-run --infection-report=infection-report.json
bash
vendor/bin/gruff-php dashboard
vendor/bin/gruff-php dashboard --host=127.0.0.1 --port=8765 --project=/path/to/project