-
Notifications
You must be signed in to change notification settings - Fork 663
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
Ignore line ending characters when matching code issues against baseline #5979
Comments
Hey @bdsl, can you reproduce the issue on https://psalm.dev ? |
@psalm-github-bot sorry, psalm.dev doesn't support baselines. |
Remind me how that works: you have CR LF line endings locally, but CR is stripped during commit and reinstated during checkout, right? So CR is never added to the repository and thus is missing on machines with autocrlf disabled? |
In my case I had LF endings locally on a linux machine and CR LF endings on the PHP files in the repo. Git with autocrlf=true converts the php files to my local format on checkout. Then when I generate a baseline file locally it doesn't match the files as they are in the repository, so Psalm reports errors in the CI environment where autocrlf is set to false. |
But if you don't have CRs locally how they ended up in the baseline ( |
Also, docs say |
Hmm, I'm not 100% sure now - looks like at list some of the files must have had CRLF on my local - quite possibly there was a mixture of both formats, maybe between files maybe even within one file. I'm not entirely sure - I just know that I fixed the issue by generating a new baseline within the CI executor and committing that, and the diff on that commit showed the removal of |
Hey, Here is an example of the linux baseline file vs the windows baseline file: |
@weirdan I'm happy to try and PR an implementation for this if you think it's the right thing to do for Psalm. |
@bdsl sure, please do |
Will try and get that in in the next few days. |
Part of work on issue vimeo#5979
…t baseline Should fix issue vimeo#5979 We could also trim code issues when writing to baseline, but I think that's a minor BC break, so probably shouldn't happen until Psalm 9.
…t baseline Should fix issue vimeo#5979 We could also trim code issues when writing to baseline, but I think that's a minor BC break, so probably shouldn't happen until Psalm 9.
@weirdan btw, is there a set policy on when to close Psalm issues? Might it make sense to leave it open until there's a release available with the fix? |
That would require some additional automation, while closing them when PR is merged is a Github's native functionality. |
I was puzzling over why my Psalm run was passing locally, but had many errors in CI. The answer was that I had autocrlf turned on in git settings, so my local PHP files were in a different format to those generated in the CI environment. Specifically I had many
<code>
elements in the baseline that ended with </code>
I wonder if it would be worth making Psalm ignore the
(carriage return), and also not add it when generating the baseline.The text was updated successfully, but these errors were encountered: