2018-02-18 01:53:17 +01:00
|
|
|
|
# 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
|
|
|
|
|
```
|
|
|
|
|
|
2019-02-12 23:35:28 +01:00
|
|
|
|
and Psalm will scan all files in the project referenced by `<projectFiles>`.
|
2018-02-18 01:53:17 +01:00
|
|
|
|
|
|
|
|
|
If you want to run on specific files, use
|
|
|
|
|
```bash
|
|
|
|
|
./vendor/bin/psalm file1.php [file2.php...]
|
|
|
|
|
```
|
|
|
|
|
|
2018-09-30 17:13:12 +02:00
|
|
|
|
## Command-line options
|
2018-02-18 01:53:17 +01:00
|
|
|
|
|
|
|
|
|
Run with `--help` to see a list of options that Psalm supports.
|
2018-09-30 17:13:12 +02:00
|
|
|
|
|
2021-01-24 19:30:35 +01:00
|
|
|
|
## 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.
|
|
|
|
|
|
2019-12-03 15:53:37 +01:00
|
|
|
|
## 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.
|
|
|
|
|
|
2020-03-22 23:42:19 +01:00
|
|
|
|
## Running Psalm faster
|
2018-09-30 17:13:12 +02:00
|
|
|
|
|
|
|
|
|
Psalm has a couple of command-line options that will result in faster builds:
|
|
|
|
|
|
2018-09-30 22:05:42 +02:00
|
|
|
|
- `--threads=[n]` to run Psalm’s analysis in a number of threads
|
2020-01-25 16:50:11 +01:00
|
|
|
|
- `--diff` which only checks files you’ve updated since the last run (and their dependents).
|
2020-10-19 05:28:05 +02:00
|
|
|
|
|
|
|
|
|
In Psalm 4 `--diff` is turned on by default (you can disable it with `--no-diff`).
|
2020-01-25 16:50:11 +01:00
|
|
|
|
|
|
|
|
|
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.
|
2018-09-30 22:05:42 +02:00
|
|
|
|
|
2020-10-19 05:28:05 +02:00
|
|
|
|
Running them together (e.g. `--threads=8 --diff`) will result in the fastest possible Psalm run.
|