Expose config files from ProjectFiles#143
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17cdd8117a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (nextFile.isFile()) { | ||
| String content = FileUtils.readFileToString(nextFile, StandardCharsets.UTF_8); | ||
| this.insertFile(new ProjectFile(nextFile.getAbsolutePath(), content)); |
There was a problem hiding this comment.
Check file type before reading directory file content
ProjectFiles.initFilesFromDir now reads every file into memory (readFileToString) before insertFile decides whether it is a supported source/config file, so large binaries and unrelated assets in a repo are fully loaded even though they are immediately skipped. On real projects (e.g., node_modules, media files, build artifacts), this can cause major slowdowns or OOMs that did not occur when filtering by extension first.
Useful? React with 👍 / 👎.
| this.size -= 1; | ||
| LOGGER.debug("Removed config file at path: " + normalizedConfigPath + "."); |
There was a problem hiding this comment.
Prevent size underflow when removing zip-loaded config files
This decrement assumes every config entry was counted in size, but zip config files are still inserted via handlePotentialConfigFile without incrementing size. After this commit exposed config files/removal paths, a zip containing only tsconfig.json can produce size()==0 initially and then removeFile(...) drives it to -1, making size() inconsistent and incorrect.
Useful? React with 👍 / 👎.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #143 +/- ##
============================================
- Coverage 70.26% 70.16% -0.11%
- Complexity 625 642 +17
============================================
Files 59 59
Lines 3000 3043 +43
Branches 424 442 +18
============================================
+ Hits 2108 2135 +27
- Misses 620 623 +3
- Partials 272 285 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The change makes
ProjectFilesexpose config/support files throughfiles(), and also:insertFile()for themremoveFile()for themmatchingFilesByName()