Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upanalyzing JS code with annotations #32
Comments
|
Pinging @github/codeql-javascript. |
Yes, add a file named
There's an unfortunate discrepancy between how
@hmakholm shouldn't
They use Flow syntax, which is different from TypeScript and doesn't have its own extension. |
It should, but unfortunately that's not implemented yet. The internal issue is github/codeql-coreql-team#333 -- which might receive greater priority now that there's an external complaint about it :-) |
|
Thanks -- creating the options file works for me. I have a follow-up question. First, some context: I created a test that contains some flow annotations. Then, in the directory containing the test, I ran "npm i flow-remove-types -SD" to install the annotation-remover --- this has the effect of installing many packages in a local node_modules subdirectory. Once that's installed, I can run "npm run flow:build" to strip away the annotations from the code, and the resulting stripped project is placed in a newly created subdirectory "lib". I can then run the JS code that is in this lib directory. Now, when I run my query, I have two problems:
So my question is: is there any way to inform "codeql test run" that it should only extract the code in the "src" directory? |
|
Try appending
|
|
Thanks! Are these options documented anywhere? (I was looking, but perhaps not in the right place) |
|
Hmm, the --exclude lib --exclude node_modules options doesn't seem to make any difference. The query is still extremely slow.. |
|
Hm, try |
|
Hi Asger, unfortunately this does not seem to work for me either. Any other suggestions? |
|
So, looking into this a bit, the reason that @asgerf's suggestion does not work is that (for historical reasons) There is a somewhat silly workaround: create a trivial
then |
|
Thanks, Max! I confirm that this works for me. -Frank |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

I've been trying to analyze some code from the lumo project. Some of the code contains annotations, see e.g.
https://github.com/anmonteiro/lumo/blob/master/src/js/util.js
which contains code like:
export function expandPath(somePath: string): string {
const tildeExpandedPath = somePath.startsWith('
')/, os.homedir())? somePath.replace(/^
: somePath;
return path.resolve(tildeExpandedPath);
}
I have no problem running queries against this project, but when I try to create a test that analyze some code fragments from this project, the extractor fails with a fatal error:
Could not extract a dataset in /Users/franktip/git/ApproximateCallGraphAnalysis/tests/testLumo: Extraction command /Users/franktip/codeql-home/codeql/tools/osx64/java/bin/java failed with status 1
Extraction command /Users/franktip/codeql-home/codeql/tools/osx64/java/bin/java failed with status 1
[1/1] FAILED(EXTRACTION) /Users/franktip/git/ApproximateCallGraphAnalysis/tests/testLumo/reachable.qlref
0 tests passed; 1 tests failed:
FAILED: /Users/franktip/git/ApproximateCallGraphAnalysis/tests/testLumo/reachable.qlref
I have a few questions: