Installation
Requirements
- PHP 8.5+
- Extensions:
dom,libxml,simplexml
Install
- Composer
composer require --dev jordikroon/docbook-cs
Quick start
- New project
- GitHub Actions
- Changed files only
# Copy the dist config and run
cp vendor/jordikroon/docbook-cs/docbookcs.xml.dist docbookcs.xml
vendor/bin/docbook-cs
- uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
- run: composer install --no-progress
- run: vendor/bin/docbook-cs --report=checkstyle --no-colors
Scan only the files touched by a pull request:
git diff origin/master...HEAD | vendor/bin/docbook-cs --diff --report=checkstyle
Options
| Option | Description |
|---|---|
--config=<file> | Path to configuration file (default: docbookcs.xml) |
--report=<format> | Output format: console (default), checkstyle, json |
--diff[=<file>] | Restrict analysis to lines changed in a unified diff. Pass - or omit the value to read from stdin. |
--colors | Force ANSI color output |
--no-colors | Disable ANSI color output |
-q, --quiet | Suppress progress output |
-v, --version | Show version and exit |
Exit codes
| Code | Meaning |
|---|---|
0 | No violations found |
1 | One or more violations found |
2 | Runtime error (bad config, unreadable file, etc.) |