Usage
CLI Usage
Run Sheath from the command line with the sheath:lint Artisan command.
#Basic Usage
Run Sheath without a path to lint the directories from your configuration. You can also pass a directory, file, or glob pattern:
php artisan sheath:lint
php artisan sheath:lint resources/views
php artisan sheath:lint resources/views/components/button.blade.php
php artisan sheath:lint "resources/views/**/*.blade.php"
#Command Reference
The command options control configuration, reporting, fixes, file selection, and runtime behavior.
#Configuration and Output
Choose a config file, preset, and report format with these options.
| Option | Description |
|---|---|
--config=FILE |
Load a PHP or JSON config file. A path that is missing, unreadable, or not .php/.json fails the run |
--preset=NAME |
Replace the configured presets. Repeat the option or separate names with commas |
--print-config |
Print the resolved config and rule status, then exit |
--format=NAME |
Choose stylish (default), json, compact, unix, checkstyle, github, or agent output |
--output=FILE |
Write the report to a file |
Examples:
php artisan sheath:lint --config=sheath.custom.php
php artisan sheath:lint --preset=strict --preset=stylistic
php artisan sheath:lint --preset=migration --fix --dangerous
php artisan sheath:lint --print-config
php artisan sheath:lint --format=json
php artisan sheath:lint --format=checkstyle --output=sheath-report.xml
--preset replaces the config's preset value for the current command. Rules
listed individually in the config still apply. Use --only when you want to run
one rule without any others.
--print-config includes a ruleStatus section that shows which rules Sheath
will run. See
packageRequirementMode.
#Standard Output and Standard Error
Standard output contains only the report. Fix summaries, skipped
items, the parallel progress bar, and the --stats summary go to standard
error.
That separation keeps machine-readable reports parseable. Use --output when
another tool should read the report from a file:
php artisan sheath:lint --format=json --output=sheath-report.json
#Previewing and Applying Fixes
Preview available fixes before changing files, or apply them directly.
| Option | Description |
|---|---|
--fix |
Apply fixes to files |
--dry-run |
Calculate and report fixes without changing files |
--dangerous |
Include dangerous fixes when used with --fix or --dry-run |
--fix-dangerous |
Alias for --dangerous |
Examples:
# apply safe fixes only
php artisan sheath:lint --fix
# preview safe fixes only
php artisan sheath:lint --dry-run
# preview safe and dangerous fixes
php artisan sheath:lint --dry-run --dangerous
# apply safe and dangerous fixes
php artisan sheath:lint --fix --dangerous
The fix options behave as follows:
- Sheath does not apply dangerous fixes unless you explicitly opt in.
- After each fix pass, Sheath lints the file again. It stops when no more fixes apply or after ten passes. A later pass can apply compatible fixes that become available after an earlier change.
--dry-runcalculates the same fixes as--fixbut does not change any files.- If you provide both
--fixand--dry-run, Sheath uses dry-run mode. It does not change any files and writes a notice to standard error. --dangeroushas no effect without--fixor--dry-run. Sheath writes a notice to standard error when you use this combination.--fixcannot be combined with--generate-baselineor--update-baseline. Apply fixes first, then generate a baseline from the remaining violations.
#Rule Selection and Overrides
Run a focused set of rules or change their severity for the current command.
| Option | Description |
|---|---|
--rule=RULE:SEVERITY |
Override a rule severity. Can be passed multiple times. |
--only=RULES |
Run only the specified rule IDs, comma-separated |
Supported severities:
errorwarninginfooff
Examples:
php artisan sheath:lint --rule=a11y-alt-text:error
php artisan sheath:lint --rule=security-csrf-field:warning --rule=seo-require-title:off
php artisan sheath:lint --only=a11y-alt-text,security-csrf-field
php artisan sheath:lint --only=blade-no-debug --rule=blade-no-debug:error
Unknown rule IDs in the config, --rule, or --only stop the command before
linting starts. This prevents a typo from silently disabling a rule in continuous
integration (CI). A malformed --rule value, such as one without a rule ID or
severity, also stops the command and reports the problem.
A rule that --only names but the configuration does not mention runs at the rule's own default severity.
#Ignore Handling
Add path exclusions for the current command, or bypass all configured exclusions.
| Option | Description |
|---|---|
--ignore-pattern=PATTERN |
Add ignore patterns without replacing configured patterns |
--no-ignore |
Disable all ignore patterns, including any --ignore-pattern values on the same command line |
php artisan sheath:lint --ignore-pattern="resources/views/vendor/**"
php artisan sheath:lint --ignore-pattern="**/legacy/**" --ignore-pattern="**/generated/**"
php artisan sheath:lint --no-ignore
#Thresholds and Exit Behavior
Set warning and error thresholds to control when the command fails.
| Option | Description |
|---|---|
--max-warnings=N |
Fail if warnings exceed the threshold. -1, the default, disables it. |
php artisan sheath:lint --max-warnings=0
php artisan sheath:lint --max-warnings=10
The value must be a non-negative integer, or -1 to disable the threshold.
Invalid values such as --max-warnings=abc fail the run instead of being read
as 0.
Sheath returns one of these exit codes:
| Code | Meaning |
|---|---|
0 |
No errors, and warnings did not exceed the configured threshold |
1 |
An error was reported, warnings exceeded the threshold, or the command could not complete |
Sheath returns exit code 1 in any of these cases:
- an error-severity violation was reported
- a parser error was reported
- warnings exceeded
--max-warnings - a file could not be read or written
- the provided paths matched no files
- invalid configuration, including an unknown rule ID in
--rule,--only, or the config, a malformed--ruleor--max-warningsvalue, conflicting flags (--fix --generate-baseline,--fix --update-baseline,--generate-baseline --update-baseline), an unknown--preset, or an unknown--format - a cache, baseline, report, or parallel worker operation failed
#Result Caching
Cache results for unchanged files in the default or a custom location.
| Option | Description |
|---|---|
--cache |
Cache results for unchanged files |
--cache-location=FILE |
Override the cache file location. Defaults to .sheath-cache |
php artisan sheath:lint --cache
php artisan sheath:lint --cache --cache-location=storage/framework/cache/sheath-cache.json
Each cache entry depends on the source content, resolved configuration, active rules, parser configuration, installed packages, and Sheath version. Custom rules that depend on other files or runtime state must add those inputs to the cache context described in Custom Rules.
#Baseline
Create or apply a baseline when existing violations cannot be fixed immediately.
| Option | Description |
|---|---|
--baseline=FILE |
Use the given baseline file. Defaults to sheath-baseline.json when it exists |
--generate-baseline |
Create a baseline from current violations |
--update-baseline |
Regenerate the baseline against current violations |
--ignore-baseline |
Run without baseline filtering even if a baseline exists |
Examples:
php artisan sheath:lint --generate-baseline
php artisan sheath:lint --generate-baseline --baseline=build/sheath-baseline.json
php artisan sheath:lint --baseline=sheath-baseline.json
php artisan sheath:lint --update-baseline
php artisan sheath:lint --ignore-baseline
You cannot combine --generate-baseline with --update-baseline. You also
cannot use --fix or --dry-run with either baseline operation. Apply fixes
first, then create or update the baseline with the remaining violations.
#Laravel Shortcuts
Choose one or more of Laravel's conventional view directories.
| Option | Description |
|---|---|
--views |
Lint resources/views |
--components |
Lint resources/views/components |
--emails |
Lint resources/views/emails |
php artisan sheath:lint --views
php artisan sheath:lint --components
php artisan sheath:lint --emails
php artisan sheath:lint --components --emails
An explicit path argument or shortcut takes priority over an ignore pattern
that excludes the entire selected directory. For example, --emails lints
resources/views/emails even though the default config ignores that directory.
Patterns that exclude files or directories inside the selected path still apply.
#Standard Input
Pipe template source to Sheath when no input file is available.
| Option | Description |
|---|---|
--stdin |
Read the source from standard input |
--stdin-filename=NAME |
Use a filename for reporting context |
echo '<img src="hero.jpg">' | php artisan sheath:lint --stdin
Get-Content resources/views/welcome.blade.php | php artisan sheath:lint --stdin --stdin-filename=welcome.blade.php
Adding --fix writes the fixed source to standard output instead of a report
because there is no input file to change. The exit code still reflects any
remaining findings. See Auto-fix.
Get-Content resources/views/welcome.blade.php | php artisan sheath:lint --stdin --fix
When you use --stdin, Sheath ignores path arguments and writes a notice to
standard error.
Baseline filtering, generation, and update work with stdin when
--stdin-filename identifies the buffer. Hashes are calculated from the piped
source, including unsaved editor content.
Caching and parallelism operate on discovered files, so --cache, --parallel,
and --processes have no effect with stdin. The same is true of --views,
--components, --emails, --ignore-pattern, and --no-ignore. Sheath emits
a notice on standard error when any of these combinations is used.
#PowerShell Input
Use -Raw so PowerShell sends the template as one string. If the resulting
input starts with a UTF-8 byte order mark, Sheath removes it before linting:
Get-Content resources/views/welcome.blade.php -Raw | php artisan sheath:lint --stdin --stdin-filename=welcome.blade.php
PowerShell decodes the file and encodes the native-command stream according to the PowerShell version and session settings. Use an editor integration or another byte-preserving producer when exact malformed source bytes matter.
#Parallel Linting
Lint files across multiple worker processes when the optional runtime is available.
| Option | Description |
|---|---|
--parallel |
Enable multi-process linting when supported |
--parallel-if-available |
Use multi-process linting when its optional runtime is installed; otherwise stay sequential without warning |
--processes=N |
Force the number of worker processes |
php artisan sheath:lint --parallel
php artisan sheath:lint --parallel --processes=4
php artisan sheath:lint --parallel --cache --stats
Parallel mode requires the optional runtime packages documented in
Installation and works on Linux, macOS, and Windows. If the
packages are missing, Sheath warns and falls back to sequential linting. Small
runs may also stay sequential automatically. With explicit --parallel,
invalid --processes values fail before the runtime availability fallback.
Use --parallel-if-available when sequential fallback should be silent. Use
explicit --parallel when a missing runtime should produce a warning.
Options that depend on another option are ignored when used alone. Sheath
prints a notice for --processes without --parallel, --cache-location
without --cache, and --stdin-filename without --stdin.
#Inline Suppressions
Report suppressed findings by ignoring suppression comments in templates.
| Option | Description |
|---|---|
--no-inline-config |
Ignore sheath-disable comments in templates |
# Honour suppression comments (default)
php artisan sheath:lint
# Report everything, including suppressed findings
php artisan sheath:lint --no-inline-config
See Inline Suppressions for the comment syntax.
#Diagnostics
Add timing, cache, and package-rule statistics to standard error.
| Option | Description |
|---|---|
--stats |
Show timing and cache statistics |
php artisan sheath:lint --stats
php artisan sheath:lint --parallel --cache --stats
When package-aware rules are skipped or disabled, stats include package rule counts.
#Parser Errors
If a file has parser errors, Sheath reports those diagnostics and skips rule checks for that file. Fix the syntax, then run the linter again to see any rule findings.
#Common Workflows
These examples combine options for common local and CI tasks.
#Local Cleanup
Apply available safe fixes, then preview any dangerous fixes that remain:
php artisan sheath:lint --fix
php artisan sheath:lint --dry-run --dangerous
#CI
Treat warnings as failures and format annotations for GitHub Actions:
php artisan sheath:lint --max-warnings=0 --format=github
Use the github reporter only in GitHub Actions. For other systems, preserve
the normal exit status and choose a report schema the receiving tool explicitly
accepts. See CI/CD Integration.
#Incremental Adoption on an Existing App
Create a baseline before fixing files so existing findings do not block adoption:
php artisan sheath:lint --generate-baseline
php artisan sheath:lint
php artisan sheath:lint --fix
php artisan sheath:lint --update-baseline
#See Also
- Configuration: available settings and presets
- Rules: built-in rule inventory
- Auto-fix: previewing and applying fixes
- Baseline: adopting Sheath with existing findings