- Notifications
You must be signed in to change notification settings - Fork1.7k
#"Sign up for GitHub">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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
In#19680 we added support for automatically ignoring files in the`outDir` directory as specified in the TSconfig compiler options (asthese files were likely duplicates of `.ts` file we were alreadyscanning).However, in some cases people put `outDir: "."` or even `outDir: ".."`in their configuration, which had the side effect of excluding _all_files, leading to a failed extraction.With the changes in this PR, we now ignore any `outDir`s that are notproperly contained within the source root of the code being scanned.This should prevent the files from being extracted, while still allowingus to not double-scan files in, say, a `.github` directory, as seen insome Actions workflows.
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 fixes an issue where the JavaScript extractor would incorrectly exclude all source files whenoutDir
intsconfig.json
points to the source root directory (.
) or parent directory (..
). The fix ensures that onlyoutDir
configurations that are proper subdirectories of the source root are used for file exclusion.
- Added validation to check if
outDir
is properly contained within the source root before excluding files - Enhanced test coverage with two new test cases for edge cases with
outDir
configuration - Updated change notes to document the fix
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java | Adds logic to validateoutDir is a proper subdirectory before excluding files |
javascript/extractor/test/com/semmle/js/extractor/test/AutoBuildTests.java | Adds test cases foroutDir pointing to parent and source root directories |
javascript/ql/lib/change-notes/2025-07-11-ignore-outdirs-that-would-exclude-everything.md | Documents the fix in release notes |
Uh oh!
There was an error while loading.Please reload this page.
Napalys left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
It might be silly but would it make sense to also add a test case whereoutDir
would besomeDir/../../
or similar?
Assuming theDCA
looks good and you don't think we need such test case
That's a good idea. I'll add an extra test. (And assuming it doesn't reveal a bug in the implementation, I'll refrain from rerunning DCA as I'm only changing a test.) |
d33cd71
intomainUh oh!
There was an error while loading.Please reload this page.
In#19680 we added support for automatically ignoring files in the
outDir
directory as specified in the TSconfig compiler options (as these files were likely duplicates of.ts
file we were already scanning).However, in some cases people put
outDir: "."
or evenoutDir: ".."
in their configuration, which had the side effect of excludingall files, leading to a failed extraction.With the changes in this PR, we now ignore any
outDir
s that are not properly contained within the source root of the code being scanned. This should prevent the files from being extracted, while still allowing us to not double-scan files in, say, a.github
directory, as seen in some Actions workflows.