-
Notifications
You must be signed in to change notification settings - Fork 60
feat: update default paths to exclude #462
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
feat: update default paths to exclude #462
Conversation
…ing systems Path declarations must allow `\` and /` to work on Windows and Unix systems.
…ault - NPM shrinkwrap: https://docs.npmjs.com/cli/v11/configuring-npm/package-lock-json#package-lockjson-vs-npm-shrinkwrapjson - pnpm lockfile: https://pnpm.io/git#lockfiles - Terraform & OpenTofu lockfile: https://developer.hashicorp.com/terraform/language/files/dependency-lock and https://opentofu.org/docs/language/files/dependency-lock/ - Go Modules: https://go.dev/doc/modules/managing-dependencies#enable_tracking - Gradle: https://docs.gradle.org/current/userguide/gradle_wrapper_basics.html#sec:view_the_wrapper and https://docs.gradle.org/current/userguide/dependency_locking.html#sec:lock-state - Maven: https://maven.apache.org/wrapper/maven-wrapper-plugin/usage.html - Pip: https://pipenv.pypa.io/en/latest/pipfile.html - Poetry: https://python-poetry.org/docs/basic-usage/#installing-dependencies - uv: https://docs.astral.sh/uv/concepts/projects/layout/#the-lockfile
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #462 +/- ##
==========================================
+ Coverage 86.72% 87.59% +0.86%
==========================================
Files 11 11
Lines 1017 1048 +31
==========================================
+ Hits 882 918 +36
+ Misses 102 99 -3
+ Partials 33 31 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
First of all: order is most definitely not important - everything on that list is excluded, ordering it "the right way" may shave off nanoseconds of the runtime on a directory with many excluded files.
I think this is mainly caused by the different people adding to this list over the years. We should probably do for unanchored, unless there is a reason to only consider files at the top level - which I think there is none.
Since I added
I would consider collapsed regexes beneficial - it requires less steps for the regex engine, so increases performance (theoretically) and definitely improves readability.
Yes to all, good catch. We should probably also exclude other known binary files that are likely to occur in source code directories - e.g. binaries produced by compilers like |
|
Sorry to blow up this PR, but https://github.com/sindresorhus/binary-extensions/blob/main/binary-extensions.json has a very complete collection of binary extensions. What would be the downside of simply including them all? Also, can we |
Oh, that is neat! We could add this repository as a git submodule, and goembed the json at compile time. This would reduce the list of excludes we need to maintain drastically, and would also be easy to communicate in the readme.
You are totally right - we already convert each file path in |
|
Okay, let me try to summarize the discussion and ensure I got everything:
I can take care of:
I propose separate PRs for:
Does that sound alright? |
This is not needed, since we already do this. Only the regexes need to be touched, so they only use |
As per editorconfig-checker#462 (comment) the paths are normalized to unix style (using `/`) before tested against the regexes so a test for `\` as path separator is unnecessary.
…-repos The `^` character forces files to be at the root of a directory tree in order to be excluded, however, in case of mono-repos for example, these files may be nested deeper in the structure and wouldn't have been excluded despite being e.g. lockfiles outside of user control. See editorconfig-checker#462 (comment)
Remove multiple regexes for the same semantic target and replace them with a unified, singular regex. See editorconfig-checker#462 (comment)
… files Removes unnecessary test arguments and instead uses the default excludes. See editorconfig-checker#462 (comment)
I didn't touch the leading |
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.
looks neat! Thanks a lot for the work you put in this!
I use editorconfig-checker in a variety of different project setups and noticed there's always something I have to ignore on my own. As a result adopting the checker into established projects effectively requires a config file increasing friction.
This gets repetitive very fast. As a result I propose to amend the default exclusions with additional lockfiles / package manager definitions that are outside user control and shouldn't be checked by editorconfig-checker.
To make maintenance (at least in my eyes) somewhat easier I tried sorting the entries and grouping them with inline comments. I can revert this, particularly if the original order had implications I am not aware of.
I have a couple of questions here and the list might need some updates based on that:
A lot of definitions start with the
^character, that forces an exact file name match and makes the default excludes impractical for e.g. mono-repos with nested structures. Is this intended behaviour? What is preferred here?The
node_modulesexclusion specifically starts with[\\/]. What is the purpose of this? Other folders, e.g..gitare not excluded this way but just use their name directly.Are collapsed or expanded regex definitions preferred? See
\\.jpeg$&\\.jpg$vs.\\.jpe?g$for example.The
main_test.goappears to have at least one obsoleteexcludedirective (see 1 and 2) where.gitis excluded manually but it has been part of the default exclude since #427. I guess it should be removed here? Additionally, it probably makes sense to add\\.exe$to the default exclude as its own pattern as well?