|
1 | 1 | # CodeQL: SAP JavaScript frameworks
|
2 | 2 |
|
| 3 | +[cloud-cap-samples]: https://github.com/SAP-samples/cloud-cap-samples |
| 4 | + |
3 | 5 | This repository contains [CodeQL](https://codeql.github.com/) models and queries for SAP JavaScript frameworks:
|
4 | 6 |
|
5 | 7 | - [CAP](javascript/frameworks/cap) [https://cap.cloud.sap](https://cap.cloud.sap/)
|
@@ -109,14 +111,28 @@ codeql database analyze <DB_NAME> --format=sarif-latest --output=<OUTPUT_FILE> \
|
109 | 111 |
|
110 | 112 | The following example invocation of `codeql database create` includes the `--command` option to invoke the CDS extractor as an extension of the `javascript` extractor, which is used by `codeql` to create the database. The `pre-finalize.sh` script is a minimal wrapper around the `codeql database index-files` command, which we expect to run the `extractors/cds/tools/index-files.js` script to index the JSON files pre-generated by the CDS extractor.
|
111 | 113 |
|
| 114 | +The below example assumes that: |
| 115 | + |
| 116 | +- The [`SAP-samples/cloud-cap-samples`][cloud-cap-samples] repository has been cloned to a sibling directory of the one containing the this repository. |
| 117 | +- The [`SAP-samples/cloud-cap-samples`][cloud-cap-samples] repository is intended as the source code root (i.e. target project) for the database. |
| 118 | +- The database directory (e.g., `~/codeql-home/databases/cloud-cap-samples-real`) is either absent or empty. |
| 119 | + |
112 | 120 | ```shell
|
113 |
| -codeql database create \ |
114 |
| - --search-path ./extractors/ \ |
115 |
| - --language javascript \ |
116 |
| - --command "./extractors/javascript/tools/pre-finalize.sh" \ |
117 |
| - ~/codeql-home/databases/cloud-cap-samples-real |
| 121 | +_d="$(pwd)" && codeql database create \ |
| 122 | + --command="${_d}/extractors/javascript/tools/pre-finalize.sh" \ |
| 123 | + --language="javascript" \ |
| 124 | + --search-path="${_d}/extractors/" \ |
| 125 | + --source-root="${_d}/../cloud-cap-samples/" \ |
| 126 | + -- ~/codeql-home/databases/cloud-cap-samples-real |
118 | 127 | ```
|
119 | 128 |
|
| 129 | +NOTES: |
| 130 | + |
| 131 | +- The `--source-root` option must be adjusted to match the actual location of the target project (e.g., GitHub repository). |
| 132 | +- The database directory path (last argument) must be adjusted to match the desired location of the created database. |
| 133 | +- Running the above command multiple times with the same database directory will result in an error. The `--overwrite` command-line option can be used to avoid this error. |
| 134 | +- See `codeql database create -h -v` for verbose command help. |
| 135 | + |
120 | 136 | ## License
|
121 | 137 |
|
122 | 138 | This project is licensed under the terms of the MIT open source license. Please refer to [MIT](LICENSE.txt) for the full terms.
|
|
0 commit comments