-
Notifications
You must be signed in to change notification settings - Fork 79
support known files #156
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
support known files #156
Conversation
ec013c7 to
7cab4c9
Compare
|
My approach is somehow naive, I wish I could have supported things like But, that's not my today's fight |
|
@ccoVeille Need to think about this a bit. I like the idea but I'm not sure I want to maintain a list of well-known files within this project. |
|
I understand, no rush |
|
@kmk142789 reactivated this old PR. thanks. I had forgotten it @kehoecj is there anything blocking on this? |
|
@ccoVeille No, just a couple merge conflicts since it's so old. I think it's ready to get merged after those are resolved |
7cab4c9 to
9538576
Compare
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.
Pull request overview
This PR adds support for identifying configuration files by their well-known filenames (e.g., .editorconfig, Cargo.lock) in addition to file extensions, and refactors FileType struct initialization to use explicit field names for better readability.
- Adds
KnownFilesfield toFileTypestruct to support matching files by exact filename - Updates file matching logic to check both known filenames and extensions
- Refactors all FileType instances to use named field initialization
- Adds known filenames for YAML, TOML, and INI file types
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test/fixtures/.editorconfig |
Adds test fixture for validating known file detection |
pkg/filetype/file_type.go |
Adds KnownFiles field to FileType struct and populates known filenames for YAML, TOML, and INI types; refactors struct initialization to use named fields |
pkg/finder/fsfinder.go |
Updates file matching logic to check KnownFiles map before checking Extensions map |
pkg/finder/finder_test.go |
Adds test case to verify known files feature works correctly |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| files, err := fsFinder.Find() | ||
|
|
||
| if len(files) < 1 { | ||
| t.Errorf("Unable to find files") | ||
| } |
Copilot
AI
Dec 18, 2025
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.
The test should verify that the correct file (.editorconfig) was found, not just that at least one file was found. Consider adding an assertion to check that the found file's path contains ".editorconfig" or matches the expected file.
|
I'll fix the linting issues later. It's not as if there was an emergency to merge this 1 year old PR |
9538576 to
b0b797b
Compare
b0b797b to
83f31f9
Compare
|
it should be OK now |
Related to #135