codeql-cli-binaries icon indicating copy to clipboard operation
codeql-cli-binaries copied to clipboard

including externs definitions in "codeql test"

Open franktip opened this issue 5 years ago • 5 comments

Would it be possible to give the “codeql test” command an option to include externs and/or make this something that one can specify in a config file? Right now, the approach we have taken is to copy/symlink externs definitions into the directory containing test files, but this solution seems unsatisfactory/fragile, particularly if one wants to use the standard externs definitions.

My question relates to JavaScript, but the same issue presumably arises for other languages.

franktip avatar Apr 30 '20 15:04 franktip

Currently we have very limited means for passing through options from the codeql command line to the language-specific parts of database creation. There's a design in the works to remedy that in a structured way, which will hopefully land over the summer.

For the specific point about externs, perhaps someone in @github/codeql-javascript can comment?

hmakholm avatar May 01 '20 12:05 hmakholm

I briefly discussed this with @github/codeql-javascript. It seems like we would like to assume the externs are always available in the database, and so I think we should make a pre-finalise script that extracts them.

p0 avatar May 06 '20 09:05 p0

Sorry for taking this long getting back to you @franktip. I'm afraid your workaround will have to do.

For a while we were considering extracting externs in tests by default, but have decided against it for two reasons:

  • Tests will take longer. Even a few seconds/test is noticable.
  • Tests will find results inside the externs, which is surprising, and many of our tests would need to be updated to exclude such results.

asgerf avatar Jun 02 '20 15:06 asgerf

Hi Asger,

I understand that you don't want to include the externs by default for performance reasons, but would it be possible to make it an option that users need to specify/enable explicitly in a config file? I would really appreciate it if you could come up with a solution so that I won't have to copy/symlink the externs definitions in my tests.

Let me know what you think.

best regards,

-Frank

franktip avatar Jun 02 '20 15:06 franktip

Right, adding an option for it would indeed be very useful. I'll re-open the issue, but resolution will unfortunately have to wait until the method for passing options has landed (see @hmakholm's comment above).

Currently we have very limited means for passing through options from the codeql command line to the language-specific parts of database creation. There's a design in the works to remedy that in a structured way, which will hopefully land over the summer.

asgerf avatar Jun 03 '20 11:06 asgerf