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

Semver parsing does not handle missing minor on .0 release #2216

Closed
Firehed opened this issue Jan 16, 2019 · 1 comment
Closed

Semver parsing does not handle missing minor on .0 release #2216

Firehed opened this issue Jan 16, 2019 · 1 comment

Comments

@Firehed
Copy link
Contributor

Firehed commented Jan 16, 2019

Information

VIM version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Aug 17 2018 15:22:29)
Included patches: 1-503, 505-680, 682-1283

Operating System: macOS 10.14

ALE @ d1fc084

What went wrong

After updating PHPStan to the latest version (0.11), errors in files being edited stopped being reported via ALE.

Doing some digging, I've found it's due to ale#semver#GetVersion receiving 'PHPStan - PHP Static Analysis Tool 0.11 as the input string - note that the implicit minor version of 0 is not present (I was previously on 0.10.3 or something). As a result, the parsing fails and use of the version in the actual linter fails causing a bunch of cascading problems resulting in the linter not running.

In practice, this is actually the package's fault for not correctly tagging the x.y.0 release and should fix itself in the next release. I'll ping the maintainers of phpstan to let them know about this as well.

However, I think it would be reasonable to adjust the semver parser to also look for x.y and, if found, return [x, y, 0] - this should be fairly safe since only linters that are using semver-based tools are likely to be using the version parser in the first place. If you think this is a decent solution, I am happy to submit a patch which I already have working locally and can confirm fixes the immediate issue. Let me know how you think is best to proceed!

@w0rp
Copy link
Member

w0rp commented Jan 27, 2019

phpstan didn't follow the spec, because you must always write .0 for a patch version, but I'll implement this anyway, because real things don't follow specs.

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

No branches or pull requests

2 participants