Comments (7)
The draft looks good to me!
from specification.
I agree. However, I don't think this is about *
. bar.py
will also match foo/bar.py
. The issue sounds like not clarifying that if /
is present, then it would match the final component of the file path.
from specification.
One question is: Does bar/baz.py
match foo/bar/baz.py
? That's something the spec isn't clear about.
from specification.
It seems our specification is "nearer" to the known behaviour of glob than the c implementation.
The implicit expansion with **/
fixes to the matching of the last part while the original "glob" command would apply the pattern to each part of the path and our spec suggests a behaviour alike (with less words).
https://en.wikipedia.org/wiki/Glob_(programming)
https://man7.org/linux/man-pages/man7/glob.7.html
from specification.
For comparision, gitignore
's semantics are, in relevant part:
If there is a separator at the beginning or middle (or both) of the pattern, then the pattern is relative to the directory level of the particular .gitignore file itself. Otherwise the pattern may also match at any level below the .gitignore level.
If we followed that, glob bar/baz.py
would not apply to file foo/bar/baz.py
.
I looked at editorconfig-core-test.
glob/
does not appear to have any test cases for this.filetree/path_separator.in
appears to have a test for this:nested_path_separator
tries to matchnested/path/separator
against globpath/separator
. The expectation is that it does not match.:given# Tests path separator match below top of path new_ec_test(nested_path_separator path_separator.in nested/path/separator "^[ \t\n\r]*$")
path_separator.in
contents:[path/separator] key1=value1
from specification.
@cxw42 Thanks for the awesome summary -- Now looks like what's unclear in the spec is:
Section names in EditorConfig files are filepath globs, similar to the format accepted by
.gitignore
.
We should make this a bit more formal somehow, but it seems tricky to formulate proper language. I'm thinking maybe it's easier to clarify in the *
row after all.
from specification.
Here's an initial draft --- it's not great, so please respond with improvements :)
Section names ... accepted by .gitignore.
They support pattern matching through Unix shell-style wildcards.
+
+A section name that does not contain a `/` matches the last component
+of the path at any depth below the EditorConfig file.
+E.g., `[*.py]` matches `foo.py` and `subdir/bar.py`.
+A section name that does contain a `/` matches that section name
+relative to the directory containing that EditorConfig file.
+E.g., `[dir/*.py]` matches `dir/foo.py` but not `dir/subdir/foo.py`.
+
These filepath globs recognize the following as special characters for wildcard matching:
(Separately, I realized we should also add tests and spec stating that a section name may not end with a /
. Edit that is now open at editorconfig/editorconfig#493)
from specification.
Related Issues (20)
- Versioning with SemVer HOT 2
- Introduce AST + validation errors HOT 21
- Clarification on insert_final_newline behavior for empty files HOT 3
- Clarify the behavior of leading slash in section title HOT 2
- Clarify behavior of trim_trailing_whitespace HOT 6
- Clarify behavior of ; and # within values HOT 14
- max_line_length is not specified HOT 15
- Readthedocs link mentioned in README.md not available HOT 4
- [Title]
- Tell IDE to ignore files HOT 3
- Odd grammatical syntax at supported-properties/root HOT 1
- Use editorconfig.org subdomain HOT 3
- How to have a multiline value HOT 2
- Clarify 'key containing whitespace' case HOT 8
- Table of Content HOT 6
- version tags? HOT 1
- Clarify that spelling_language strings must be exactly two or five characters HOT 2
- Enhancement: Light comment style preference HOT 2
- Clarify behavior of formatting (non-"root") properties at top level HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from specification.