1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00
psalm/docs/running_psalm/command_line_usage.md
Bruce Weirdan 0aa4f2044c
Use separate exit code to indicate Psalm finding issues (#5087)
* Use separate exit code to indicate Psalm finding issues

This will allow to distinguish successful run that found some issues
from crashes.

* Fix e2e test expectations

* Documented exit statuses
2021-01-29 11:47:35 +01:00

48 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Running Psalm
Once you've set up your config file, you can run Psalm from your project's root directory with
```bash
./vendor/bin/psalm
```
and Psalm will scan all files in the project referenced by `<projectFiles>`.
If you want to run on specific files, use
```bash
./vendor/bin/psalm file1.php [file2.php...]
```
## Command-line options
Run with `--help` to see a list of options that Psalm supports.
## Exit status
Psalm exits with status `0` when it successfully completed and found no issues,
`1` when there was a problem running Psalm and `2` when it completed
successfully but found some issues. Any exit status apart from those indicate
some internal problem.
## Shepherd
Psalm currently offers some GitHub integration with public projects.
Add `--shepherd` to send information about your build to https://shepherd.dev.
Currently, Shepherd tracks type coverage (the percentage of types Psalm can infer) on `master` branches.
## Running Psalm faster
Psalm has a couple of command-line options that will result in faster builds:
- `--threads=[n]` to run Psalms analysis in a number of threads
- `--diff` which only checks files youve updated since the last run (and their dependents).
In Psalm 4 `--diff` is turned on by default (you can disable it with `--no-diff`).
Data from the last run is stored in the *cache directory*, which may be set in [configuration](./configuration.md).
If you are running Psalm on a build server, you may want to configure the server to ensure that the cache directory
is preserved between runs.
Running them together (e.g. `--threads=8 --diff`) will result in the fastest possible Psalm run.