-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix a bug when comparing ranged version to non-ranged version #5576
Fix a bug when comparing ranged version to non-ranged version #5576
Conversation
This logic requires some time to think it through. One thing I can say already: A comment explaining the motivation for '0' would be nice for anyone who looks at this in the future. |
Certainly! I picked “0” as the value because it’s a number that will be lower than any possible browser version, so it won’t cause any issues with any browsers/engines we’re recording beta versions for, like NodeJS. I was initially thinking “1” to indicate “the first browser release”, which would catch an issue where a feature’s |
Sorry, I meant a code comment would be useful, but thanks again for explaining it here as well. |
Oh, haha — yeah, sure thing, I’ll push a commit to add a comment in the code! |
It seems that #5950 is also suffering from this bug now... |
In #5950 this looked pretty funky to me, so I will need to think this through some more and if we should really allow this or not. (it was resolved there to not have ≤37 anymore) |
I'm not entirely sure why we would want to disallow these two cases...they both seem like valid cases to me? |
The problem with the linter is not currently blocking any PRs, right? The two mentioned in the description seem to have been merged with changes, but I wanted to make sure before editing. |
Yeah, luckily the two PRs this issue was blocking could be adjusted (one just had wrong data, and the other, an exact version could be determined). |
Ran into this problem again when working on #7542, specifically with a statement reading Edit: this came up two more times since, with basically the same data. |
This blocked #8349 so getting this resolved would be great. Is it just a matter of reviewing the code? |
OK, if this is blocking, I'll review this soon (probably not until after the new year though). Please feel free to @ me on this if I haven't taken action by January 7. |
@ddbeck Ping! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a lot nicer. Thank you! 🎉
This PR intends to fix a bug that was discovered during #5246, when a ranged version in
version_added
has the same number as a non-ranged version inversion_removed
, or vice versa. It was also found that because the linter just strips the≤
when one is a ranged value, then ifversion_added
was a ranged value andversion_removed
was a defined value within that range, the linter would fail.This PR updates the logic so that a ranged value for
version_added
is equivalent to "0" (basically the lowest value), and a ranged value forversion_removed
is equivalent to whatever that version is. (Example:"version_added": "≤37", "version_removed": "≤37"
translates to"version_added": "0", "version_removed": "37"
for the linter.)As an additional step to reduce the complexity of the code, this removes the special case when both values are ranged.
(Note: There is also #5501, which fixes the first bug (when
version_added
is a ranged value with the number equivalent toversion_removed
), however the author of that PR showed no interest in updating that PR to include the fix for the second bug found (version_removed
is less than the version number ofversion_added
). This fix, however, simplifies the code and makes the other PR's code completely redundant -- as such, this PR closes #5501.)