From 1c3d15f5df9a619e021018413986e57f5a2e71fa Mon Sep 17 00:00:00 2001 From: Ricardo Boss Date: Wed, 19 Jan 2022 12:07:20 +0100 Subject: [PATCH 1/3] Added documentation for baseline files --- .../running_psalm/dealing_with_code_issues.md | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/running_psalm/dealing_with_code_issues.md b/docs/running_psalm/dealing_with_code_issues.md index 37ac5322d1e..a21abbf6d37 100644 --- a/docs/running_psalm/dealing_with_code_issues.md +++ b/docs/running_psalm/dealing_with_code_issues.md @@ -99,7 +99,27 @@ 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 + + + ... + +``` + +To update that baseline file (to remove references to things that have been fixed), use ``` vendor/bin/psalm --update-baseline @@ -107,6 +127,12 @@ vendor/bin/psalm --update-baseline Baseline files are a great way to gradually improve a codebase. +In case you want to run psalm without the baseline, run + +``` +vendor/bin/psalm --ignore-baseline +``` + ## Using a plugin If you want something more custom, like suppressing a certain type of error on classes that implement a particular interface, you can use a plugin that implements `AfterClassLikeVisitInterface` From bd1385df723044488b790cb31cab99610a027b64 Mon Sep 17 00:00:00 2001 From: Ricardo Boss Date: Wed, 19 Jan 2022 13:32:47 +0100 Subject: [PATCH 2/3] Added context for updating the baseline files --- docs/running_psalm/dealing_with_code_issues.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/running_psalm/dealing_with_code_issues.md b/docs/running_psalm/dealing_with_code_issues.md index a21abbf6d37..6a2e7ada321 100644 --- a/docs/running_psalm/dealing_with_code_issues.md +++ b/docs/running_psalm/dealing_with_code_issues.md @@ -119,13 +119,13 @@ or using the configuration: ``` -To update that baseline file (to remove references to things that have been fixed), use +To update that baseline file, use ``` vendor/bin/psalm --update-baseline ``` -Baseline files are a great way to gradually improve a codebase. +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 @@ -133,6 +133,8 @@ 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 If you want something more custom, like suppressing a certain type of error on classes that implement a particular interface, you can use a plugin that implements `AfterClassLikeVisitInterface` From ae954f0cdcd2e4fba6d897c6cb93f1c98ad89deb Mon Sep 17 00:00:00 2001 From: Ricardo Boss Date: Wed, 19 Jan 2022 13:34:51 +0100 Subject: [PATCH 3/3] Update dealing_with_code_issues.md --- docs/running_psalm/dealing_with_code_issues.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/running_psalm/dealing_with_code_issues.md b/docs/running_psalm/dealing_with_code_issues.md index 6a2e7ada321..3563820c319 100644 --- a/docs/running_psalm/dealing_with_code_issues.md +++ b/docs/running_psalm/dealing_with_code_issues.md @@ -125,7 +125,7 @@ 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`. +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