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

Glob specification is not clear #528

Open
Conaclos opened this issue Oct 3, 2024 · 5 comments
Open

Glob specification is not clear #528

Conaclos opened this issue Oct 3, 2024 · 5 comments

Comments

@Conaclos
Copy link

Conaclos commented Oct 3, 2024

This is related to editorconfig/specification#45.

When reading the Glob Expression section of the specification, I have several questions unanswered:

  1. Are globs unicode-aware?
    Globs from .gitIgnore are not unicode-aware.
    This means that the globs [é] and ? don't match é.
  2. How is handled three or more stars ***?
    Usually glob libraries treat it as a single star, or as an invalid glob expression.
  3. Can character class match against /?
    Usually glob libraries don't allow that.
  4. Can {s1,s2,s3} contain nested glob expressions? e.g. {*.json,*.toml}.
  5. Can {s1,s2,s3} contain empty strings? e.g. {*.gen,}.json.
  6. Does {num1..num2} allow reversed ranges such as {1..0}?
  7. Does {num1..num2} allow numbers with leading zeros such as {01..02}
    If yes, is this equivalent to [12] or 0[12]?
  8. Does {num1..num2} allow numbers with a + sign? e.g. {+1..2}?

Thanks!

@florianb
Copy link
Member

florianb commented Oct 3, 2024

@Conaclos thanks for bringing this to our attention. I think the specification is unclear at that point because I'm fact two separate technologies seem to apply: glob and brace expansion.

I need to do further research on that topic.

@Conaclos
Copy link
Author

Conaclos commented Oct 3, 2024

Feel free to tag me if you need a review or some help.

@cr7pt0gr4ph7
Copy link

The editorconfig/editorconfig-core-test library provides a set of tests that is used for the editorconfig-core-c, editorconfig-core-ruby, editorconfig-core-py etc. libraries.

The behavior specified through the glob and filetree tests, which also include comments, is probably the closest there currently is to an official specification. It should be possible to to turn these into an offical specification, or at least add a (normative or non-normative) reference to them in the spec.

Maybe @cxw42 knows more, as they were the last to modify those tests.

@cxw42
Copy link
Member

cxw42 commented Nov 24, 2024

Are globs unicode-aware?

I don't think we test for unicode, so it depends on the regex engine used by your core. I agree it would be good to specify this and add tests.

How is handled three or more stars ***?

Another we don't test for, so it's core-specific. In the C core (reference implementation), it's treated like ** followed by *.

Can character class match against /?

Yes, and we do test for this. [/] matches that literal sequence of three characters. It appears that is not adequately documented in the spec.

Can {s1,s2,s3} contain nested glob expressions? e.g. {.json,.toml}.

Yes

Can {s1,s2,s3} contain empty strings? e.g. {*.gen,}.json.

Yes

Does {num1..num2} allow reversed ranges such as {1..0}?

Not in the C core, but I don't see that we test for that.

Does {num1..num2} allow numbers with leading zeros such as {01..02}

Not in the C core, but I don't see that we test for that.

Does {num1..num2} allow numbers with a + sign? e.g. {+1..2}?

Yes, in the C core, but I don't see that we test for that.

Re. numeric ranges, see #371 for more discussion.

@cxw42
Copy link
Member

cxw42 commented Nov 24, 2024

Moving to the main issue tracker for visibility.

@cxw42 cxw42 transferred this issue from editorconfig/specification Nov 24, 2024
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

4 participants