Skip to content

Commit

Permalink
Merge pull request #7429 from ricardoboss/update-baseline-docs
Browse files Browse the repository at this point in the history
Added documentation for baseline files
  • Loading branch information
orklah committed Jan 19, 2022
2 parents cb976f8 + ae954f0 commit 4e57110
Showing 1 changed file with 29 additions and 1 deletion.
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

0 comments on commit 4e57110

Please sign in to comment.