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

Bug: --update-baseline does not remove duplicated entries #9477

Open
djmetzle opened this issue Mar 9, 2023 · 2 comments
Open

Bug: --update-baseline does not remove duplicated entries #9477

djmetzle opened this issue Mar 9, 2023 · 2 comments

Comments

@djmetzle
Copy link

djmetzle commented Mar 9, 2023

We have been experiencing trouble with the most recent versions of psalm.

We're currently running on 5.7.7, but we walked back recent upgrades, and it appears that 5.2 does not have the problem, but our upgrade to 5.6 seems to bring back the problem. This may also be related to the addition of UnusedBaselineEntry, which we've recently enabled. Version 5.5 seems to be the relevant release that changed this behavior for us.

Also, removing the occurrence attribute also may have exposed the problem.
It appears that the ErrorBaseline code:

public static function update(
FileProvider $fileProvider,
string $baselineFile,
array $issues,
bool $include_php_versions
): array {
$existingIssues = self::read($fileProvider, $baselineFile);
$newIssues = self::countIssueTypesByFile($issues);

as well as the test cases, are concerned still with absolute number of occurrences. This could be confusing the issue.

We have a test case created that seems to reproduce the problem we are seeing:
iFixit@477e0a2

Notice that in our example/testcase we are avoiding encoding the occurrences field in the example baseline XML:
https://github.com/iFixit/psalm/blob/477e0a26bb8dff7772f055da83343909af686679/tests/ErrorBaselineTest.php#L498
but that the remain test cases are still using occurrences.

Specifically, if we have duplicated <code> blocks in our baseline, fixing only one of them does not correctly remove the second instance from the baseline as expected.

Please advise.

CC @jarstelfox @ardelato @sctice-ifixit

@psalm-github-bot
Copy link

Hey @djmetzle, can you reproduce the issue on https://psalm.dev ?

@djmetzle
Copy link
Author

djmetzle commented Mar 9, 2023

@psalm-github-bot
This issue deals with baseline handling, and is most likely not reproducible in the online checker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant