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: 0 is not considered a valid number for {num1..num2} #102

Closed
uap-universe opened this issue Feb 8, 2024 · 2 comments
Closed

Bug: 0 is not considered a valid number for {num1..num2} #102

uap-universe opened this issue Feb 8, 2024 · 2 comments

Comments

@uap-universe
Copy link

/* we don't consider 0digits such as 010 as matched */
if (*substring_start == '0')
break;

This does not only discard numbers like "010", but also the "0" itself.

That means, the following pattern

*.orig.{0..9}

does not match the file

data.txt.orig.0
@greut
Copy link
Member

greut commented Feb 9, 2024

You're looking at a specific implementation here, I sort of agree that the above pattern should be part of the test suite: https://github.com/editorconfig/editorconfig-core-test/blob/master/glob/braces.in#L65-L67

@cxw42
Copy link
Member

cxw42 commented Feb 11, 2024

Indeed, the spec says

{num1..num2}

any integer numbers between num1 and num2, where num1 and num2 can be either positive or negative

which would imply zero should be allowed.

I am closing this in favor of the spec issue at editorconfig/editorconfig#371 . Once that issue is resolved, we will update the core tests and the cores will all need to be updated accordingly.

@cxw42 cxw42 closed this as completed Feb 11, 2024
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

3 participants