Closed lcartey closed 1 week ago
Another question: Does the end user lose the capability of firing the chain of database init --language
through database finalize
with a codeql database create --language=cds
if database init
and database finalize
require different values for their --language
flags?
I don't think this is a significant downside since the user has to run pre-finalize.sh
for the options anyways.
This pull requests adds a native CodeQL extractor for the cds service description files from SAP's cap framework.
The cds extractor supports the following scripts:
index-files.sh
- this script enables indexing a specified list of cds files. It works by:@sap/cds-dk
tool that provides thecds compile
command. It installs the package in each directory with apackage.json
file which depends on the@sap/cds
package, and will install a version compatible with the declared versions in thepackage.json file
npx cds compile -2 json --locations -o <...> ...
for each provided cds file, to produce a JSON output file representing the AST for the file..cds.json
files generated by the compiler.autobuild.sh
- this provides an autobuilder which detects all.cds
files that don't exists outsidenode_modules
, and calls thecodeql database index-files --language cds
command to index them.In addition to the cds extractor, I've also added the following:
pre-finalize.sh
script that can be injected into an existing instance of the JavaScript extractor, that enables automatic extraction of CDS files. This is most useful with a custom bundle as generated by the CodeQL Development Toolkit (qlt). The script also recognises theCODEQL_EXTRACTOR_CDS_SKIP_EXTRACTION
flag, which can be set to skip extraction of CDS files.cds-compile.sh
script that can be used with the--command
option to acodeql database create --language javascript
call to add compilation of CDS files manually.Finally, I've updated the Code Scanning workflow to use/test the new CDS extractor.
Some follow up tasks I would look at as separate PRs are:
index-files
only contains.cds
files, and ~we don't optimize how often we install the@sap/cds-dk
package in a large monorepo with only a subset~ EDIT: this second part is now done.