Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added documentation for baseline files #7429

Merged
merged 3 commits into from Jan 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 29 additions & 1 deletion docs/running_psalm/dealing_with_code_issues.md
Expand Up @@ -99,12 +99,40 @@ If you have a bunch of errors and you don't want to fix them all at once, Psalm
vendor/bin/psalm --set-baseline=your-baseline.xml
```

will generate a file containing the current errors. You can commit that generated file so that Psalm running in other places (e.g. CI) won't complain about those errors either, and you can update that baseline file (to remove references to things that have been fixed) with
will generate a file containing the current errors. You should commit that generated file so that Psalm can use it when running in other places (e.g. CI). It won't complain about those errors either.

You have two options to use the generated baseline when running psalm:

```
vendor/bin/psalm --use-baseline=your-baseline.xml
```

or using the configuration:

```xml
<?xml version="1.0"?>
<psalm
...
errorBaseline="./path/to/your-baseline.xml"
>
...
</psalm>
```

To update that baseline file, use

```
vendor/bin/psalm --update-baseline
```

This will remove fixed issues, but will _not_ add new issues. To add new issues, use `--set-baseline=...`.

In case you want to run psalm without the baseline, run

```
vendor/bin/psalm --ignore-baseline
```

Baseline files are a great way to gradually improve a codebase.

## Using a plugin
Expand Down