mirror of
https://github.com/github/codeql-action.git
synced 2025-12-17 12:59:20 +08:00
Compare commits
38 Commits
codeql-bun
...
v3.24.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8893c57a1 | ||
|
|
78d6c8e84d | ||
|
|
2db0327171 | ||
|
|
f9dea84e29 | ||
|
|
81eb6b2bf4 | ||
|
|
483bef1dab | ||
|
|
b58c2f67a6 | ||
|
|
f7d53249e3 | ||
|
|
254b53d999 | ||
|
|
e34513334c | ||
|
|
463930c71f | ||
|
|
d982a14465 | ||
|
|
55c1fd5777 | ||
|
|
0166a8a567 | ||
|
|
401f9d6286 | ||
|
|
d2e867f3be | ||
|
|
ec42edcaab | ||
|
|
8c22ec9e5d | ||
|
|
68d348377f | ||
|
|
e33271d071 | ||
|
|
eab49d76a3 | ||
|
|
202c383f78 | ||
|
|
cfefe3a7e8 | ||
|
|
25f779c0f2 | ||
|
|
738d232550 | ||
|
|
5c9716f453 | ||
|
|
a2c5130ffd | ||
|
|
b7bf0a3ed3 | ||
|
|
9a9b0e4a8f | ||
|
|
33e354b34b | ||
|
|
f4cfe8904c | ||
|
|
61bf02577c | ||
|
|
16150320c5 | ||
|
|
bd67d8d6b2 | ||
|
|
a2619f68c8 | ||
|
|
666e2f9edf | ||
|
|
d43ae36a63 | ||
|
|
75af1f5948 |
85
.github/workflows/__build-mode-none.yml
generated
vendored
Normal file
85
.github/workflows/__build-mode-none.yml
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# Warning: This file is generated automatically, and should not be modified.
|
||||||
|
# Instead, please modify the template in the pr-checks directory and run:
|
||||||
|
# (cd pr-checks; pip install ruamel.yaml@0.17.31 && python3 sync.py)
|
||||||
|
# to regenerate this file.
|
||||||
|
|
||||||
|
name: PR Check - Build mode none
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GO111MODULE: auto
|
||||||
|
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/v*
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
workflow_dispatch: {}
|
||||||
|
jobs:
|
||||||
|
build-mode-none:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: latest
|
||||||
|
- os: ubuntu-latest
|
||||||
|
version: nightly-latest
|
||||||
|
name: Build mode none
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
timeout-minutes: 45
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Setup Python on MacOS
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
if: >-
|
||||||
|
matrix.os == 'macos-latest' && (
|
||||||
|
|
||||||
|
matrix.version == 'stable-20221211' ||
|
||||||
|
|
||||||
|
matrix.version == 'stable-20230418' ||
|
||||||
|
|
||||||
|
matrix.version == 'stable-v2.13.5' ||
|
||||||
|
|
||||||
|
matrix.version == 'stable-v2.14.6')
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Prepare test
|
||||||
|
id: prepare-test
|
||||||
|
uses: ./.github/actions/prepare-test
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.version }}
|
||||||
|
use-all-platform-bundle: 'false'
|
||||||
|
- name: Set environment variable for Swift enablement
|
||||||
|
if: runner.os != 'Windows' && matrix.version == '20221211'
|
||||||
|
shell: bash
|
||||||
|
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||||
|
- uses: ./../action/init
|
||||||
|
id: init
|
||||||
|
with:
|
||||||
|
build-mode: none
|
||||||
|
db-location: ${{ runner.temp }}/customDbLocation
|
||||||
|
languages: java
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
||||||
|
- name: Validate database build mode
|
||||||
|
run: |
|
||||||
|
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
|
||||||
|
build_mode=$(yq eval '.buildMode' "$metadata_path")
|
||||||
|
if [[ "$build_mode" != "none" ]]; then
|
||||||
|
echo "Expected build mode to be 'none' but was $build_mode"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- uses: ./../action/autobuild
|
||||||
|
- uses: ./../action/analyze
|
||||||
|
env:
|
||||||
|
CODEQL_ACTION_TEST_MODE: true
|
||||||
@@ -4,9 +4,14 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
|
|||||||
|
|
||||||
Note that the only difference between `v2` and `v3` of the CodeQL Action is the node version they support, with `v3` running on node 20 while we continue to release `v2` to support running on node 16. For example `3.22.11` was the first `v3` release and is functionally identical to `2.22.11`. This approach ensures an easy way to track exactly which features are included in different versions, indicated by the minor and patch version numbers.
|
Note that the only difference between `v2` and `v3` of the CodeQL Action is the node version they support, with `v3` running on node 20 while we continue to release `v2` to support running on node 16. For example `3.22.11` was the first `v3` release and is functionally identical to `2.22.11`. This approach ensures an easy way to track exactly which features are included in different versions, indicated by the minor and patch version numbers.
|
||||||
|
|
||||||
## [UNRELEASED]
|
## 3.24.0 - 02 Feb 2024
|
||||||
|
|
||||||
- On Linux, the maximum possible value for the `--threads` option now respects the CPU count as specified in `cgroup` files to more accurately reflect the number of available cores when running in containers.
|
- CodeQL Python analysis will no longer install dependencies on GitHub Enterprise Server, as is already the case for GitHub.com. See [release notes for 3.23.0](#3230---08-jan-2024) for more details. [#2106](https://github.com/github/codeql-action/pull/2106)
|
||||||
|
|
||||||
|
## 3.23.2 - 26 Jan 2024
|
||||||
|
|
||||||
|
- On Linux, the maximum possible value for the `--threads` option now respects the CPU count as specified in `cgroup` files to more accurately reflect the number of available cores when running in containers. [#2083](https://github.com/github/codeql-action/pull/2083)
|
||||||
|
- Update default CodeQL bundle version to 2.16.1. [#2096](https://github.com/github/codeql-action/pull/2096)
|
||||||
|
|
||||||
## 3.23.1 - 17 Jan 2024
|
## 3.23.1 - 17 Jan 2024
|
||||||
|
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -16,6 +16,19 @@ We recommend using default setup to configure CodeQL analysis for your repositor
|
|||||||
|
|
||||||
You can also configure advanced setup for a repository to find security vulnerabilities in your code using a highly customizable code scanning configuration. For more information, see "[Configuring advanced setup for code scanning](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/configuring-advanced-setup-for-code-scanning)" and "[Customizing your advanced setup for code scanning](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning)."
|
You can also configure advanced setup for a repository to find security vulnerabilities in your code using a highly customizable code scanning configuration. For more information, see "[Configuring advanced setup for code scanning](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/configuring-advanced-setup-for-code-scanning)" and "[Customizing your advanced setup for code scanning](https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning)."
|
||||||
|
|
||||||
|
## Supported versions of the CodeQL Action
|
||||||
|
|
||||||
|
The following versions of the CodeQL Action are currently supported:
|
||||||
|
|
||||||
|
- v3 (latest)
|
||||||
|
- v2 (deprecated, support will end on December 5th, 2024)
|
||||||
|
|
||||||
|
The only difference between CodeQL Action v2 and v3 is the version of Node.js on which they run. CodeQL Action v3 runs on Node 20, while CodeQL Action v2 runs on Node 16.
|
||||||
|
|
||||||
|
To provide the best experience to customers using older versions of GitHub Enterprise Server, we will continue to release CodeQL Action v2 so that these customers can continue to run the latest version of CodeQL as long as their version of GitHub Enterprise Server is supported. For example CodeQL Action v3.22.11 was the first release of CodeQL Action v3 and is functionally identical to v2.22.11. This approach provides an easy way to track exactly which features are included in different versions by looking at the minor and patch version numbers.
|
||||||
|
|
||||||
|
For more information, see ["Code scanning: deprecation of CodeQL Action v2."](https://github.blog/changelog/2024-01-12-code-scanning-deprecation-of-codeql-action-v2/).
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
Read about [troubleshooting code scanning](https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning).
|
Read about [troubleshooting code scanning](https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning).
|
||||||
|
|||||||
@@ -52,10 +52,10 @@ inputs:
|
|||||||
# If changing this, make sure to update workflow.ts accordingly.
|
# If changing this, make sure to update workflow.ts accordingly.
|
||||||
default: ${{ github.workspace }}
|
default: ${{ github.workspace }}
|
||||||
ref:
|
ref:
|
||||||
description: "The ref where results will be uploaded. If not provided, the Action will use the GITHUB_REF environment variable. If provided, the sha input must be provided as well. This input is not available in pull requests from forks."
|
description: "The ref where results will be uploaded. If not provided, the Action will use the GITHUB_REF environment variable. If provided, the sha input must be provided as well. This input is ignored for pull requests from forks."
|
||||||
required: false
|
required: false
|
||||||
sha:
|
sha:
|
||||||
description: "The sha of the HEAD of the ref where results will be uploaded. If not provided, the Action will use the GITHUB_SHA environment variable. If provided, the ref input must be provided as well. This input is not available in pull requests from forks."
|
description: "The sha of the HEAD of the ref where results will be uploaded. If not provided, the Action will use the GITHUB_SHA environment variable. If provided, the ref input must be provided as well. This input is ignored for pull requests from forks."
|
||||||
required: false
|
required: false
|
||||||
category:
|
category:
|
||||||
description: String used by Code Scanning for matching the analyses
|
description: String used by Code Scanning for matching the analyses
|
||||||
|
|||||||
@@ -10,6 +10,23 @@ inputs:
|
|||||||
description: |
|
description: |
|
||||||
A comma-separated value of the languages to be analysed e.g. python,javascript
|
A comma-separated value of the languages to be analysed e.g. python,javascript
|
||||||
required: false
|
required: false
|
||||||
|
build-mode:
|
||||||
|
description: >-
|
||||||
|
[Experimental, for internal testing only] The build mode that will be used to analyze the language.
|
||||||
|
This input is only available in single-language analyses.
|
||||||
|
|
||||||
|
Available build modes will differ based on the language being analyzed. One of:
|
||||||
|
|
||||||
|
- none: The database will be created without building the source code.
|
||||||
|
Available for all interpreted languages and some compiled languages.
|
||||||
|
- autobuild: The database will be created by attempting to automatically build the source code.
|
||||||
|
To use this build mode, ensure that your workflow calls the `autobuild` action
|
||||||
|
between the `init` and `analyze` steps.
|
||||||
|
Available for all compiled languages.
|
||||||
|
- manual: The database will be created by building the source code using a manually specified
|
||||||
|
build command. To use this build mode, specify manual build steps in your workflow
|
||||||
|
between the `init` and `analyze` steps. Available for all compiled languages.
|
||||||
|
required: false
|
||||||
token:
|
token:
|
||||||
description: GitHub token to use for authenticating with this instance of GitHub. To download custom packs from multiple registries, use the registries input.
|
description: GitHub token to use for authenticating with this instance of GitHub. To download custom packs from multiple registries, use the registries input.
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
|
|||||||
18
lib/analyze.test.js
generated
18
lib/analyze.test.js
generated
@@ -95,25 +95,11 @@ const util = __importStar(require("./util"));
|
|||||||
},
|
},
|
||||||
databasePrintBaseline: async () => "",
|
databasePrintBaseline: async () => "",
|
||||||
});
|
});
|
||||||
const config = {
|
const config = (0, testing_utils_1.createTestConfig)({
|
||||||
languages: [language],
|
languages: [language],
|
||||||
originalUserInput: {},
|
|
||||||
tempDir: tmpDir,
|
tempDir: tmpDir,
|
||||||
codeQLCmd: "",
|
|
||||||
gitHubVersion: {
|
|
||||||
type: util.GitHubVariant.DOTCOM,
|
|
||||||
},
|
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||||
debugMode: false,
|
});
|
||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: {
|
|
||||||
packsInputCombines: false,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
},
|
|
||||||
trapCaches: {},
|
|
||||||
trapCacheDownloadTime: 0,
|
|
||||||
};
|
|
||||||
fs.mkdirSync(util.getCodeQLDatabasePath(config, language), {
|
fs.mkdirSync(util.getCodeQLDatabasePath(config, language), {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"analyze.test.js","sourceRoot":"","sources":["../src/analyze.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,8CAAuB;AACvB,6CAA+B;AAE/B,uCAAuC;AACvC,qCAAqC;AAErC,mDAA0C;AAC1C,2CAAuC;AACvC,uCAA4C;AAC5C,mDAA+E;AAC/E,wDAA0C;AAC1C,6CAA+B;AAE/B,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB;;;;;GAKG;AACH,IAAA,aAAI,EAAC,sBAAsB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IACvC,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC5C,IAAA,gCAAgB,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEjC,MAAM,UAAU,GAAG,EAAE,CAAC;QACtB,MAAM,eAAe,GAAG,EAAE,CAAC;QAC3B,MAAM,WAAW,GAAG,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC;QAEjD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,oBAAQ,CAAC,EAAE,CAAC;YAC/C,IAAA,kBAAS,EAAC;gBACR,kBAAkB,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;gBAClC,YAAY,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;gBACzC,wBAAwB,EAAE,KAAK,EAC7B,GAAW,EAC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AAM,GAAG,IAAA,gCAAgB,EAAC;gBAC9B,SAAS,EAAE,CAAC,QAAQ,CAAC;gBACrB,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,kBAAkB,CAAC;aACrD,CAAC,CAAC;YACH,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE;gBACzD,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;YAEH,MAAM,YAAY,GAAG,MAAM,IAAA,oBAAU,EACnC,MAAM,EACN,UAAU,EACV,eAAe,EACf,WAAW,EACX,SAAS,EACT,MAAM,EACN,IAAA,yBAAe,EAAC,IAAI,CAAC,EACrB,IAAA,8BAAc,EAAC,CAAC,uBAAO,CAAC,kBAAkB,CAAC,CAAC,CAC7C,CAAC;YACF,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,EAAE;gBAC5C,2BAA2B,QAAQ,cAAc;gBACjD,eAAe;gBACf,qBAAqB,QAAQ,cAAc;aAC5C,CAAC,CAAC;YACH,KAAK,MAAM,WAAW,IAAI,YAAY,CAAC,aAAc,EAAE,CAAC;gBACtD,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,mCAAmC,CAAC,CAAC;gBACpE,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,WAAW,CAAC,CAAC;gBACpC,CAAC,CAAC,IAAI,CAAC,aAAa,IAAI,WAAW,CAAC,UAAW,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||||
14
lib/codeql.js
generated
14
lib/codeql.js
generated
@@ -35,6 +35,7 @@ const environment_1 = require("./environment");
|
|||||||
const feature_flags_1 = require("./feature-flags");
|
const feature_flags_1 = require("./feature-flags");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const setupCodeql = __importStar(require("./setup-codeql"));
|
const setupCodeql = __importStar(require("./setup-codeql"));
|
||||||
|
const tools_features_1 = require("./tools-features");
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
class CommandInvocationError extends Error {
|
class CommandInvocationError extends Error {
|
||||||
@@ -201,10 +202,12 @@ function resolveFunction(partialCodeql, methodName, defaultImplementation) {
|
|||||||
function setCodeQL(partialCodeql) {
|
function setCodeQL(partialCodeql) {
|
||||||
cachedCodeQL = {
|
cachedCodeQL = {
|
||||||
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
|
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
|
||||||
getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve({
|
getVersion: resolveFunction(partialCodeql, "getVersion", async () => ({
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
}))),
|
})),
|
||||||
printVersion: resolveFunction(partialCodeql, "printVersion"),
|
printVersion: resolveFunction(partialCodeql, "printVersion"),
|
||||||
|
supportsFeature: resolveFunction(partialCodeql, "supportsFeature", async (feature) => !!partialCodeql.getVersion &&
|
||||||
|
(0, tools_features_1.isSupportedToolsFeature)(await partialCodeql.getVersion(), feature)),
|
||||||
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
|
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
|
||||||
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
|
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
|
||||||
extractScannedLanguage: resolveFunction(partialCodeql, "extractScannedLanguage"),
|
extractScannedLanguage: resolveFunction(partialCodeql, "extractScannedLanguage"),
|
||||||
@@ -279,6 +282,9 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
async printVersion() {
|
async printVersion() {
|
||||||
await runTool(cmd, ["version", "--format=json"]);
|
await runTool(cmd, ["version", "--format=json"]);
|
||||||
},
|
},
|
||||||
|
async supportsFeature(feature) {
|
||||||
|
return (0, tools_features_1.isSupportedToolsFeature)(await this.getVersion(), feature);
|
||||||
|
},
|
||||||
async databaseInitCluster(config, sourceRoot, processName, qlconfigFile, logger) {
|
async databaseInitCluster(config, sourceRoot, processName, qlconfigFile, logger) {
|
||||||
const extraArgs = config.languages.map((language) => `--language=${language}`);
|
const extraArgs = config.languages.map((language) => `--language=${language}`);
|
||||||
if (config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l)).length > 0) {
|
if (config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l)).length > 0) {
|
||||||
@@ -292,6 +298,10 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
|||||||
if (externalRepositoryToken) {
|
if (externalRepositoryToken) {
|
||||||
extraArgs.push("--external-repository-token-stdin");
|
extraArgs.push("--external-repository-token-stdin");
|
||||||
}
|
}
|
||||||
|
if (config.buildMode !== undefined &&
|
||||||
|
(await this.supportsFeature(tools_features_1.ToolsFeature.BuildModeOption))) {
|
||||||
|
extraArgs.push(`--build-mode=${config.buildMode}`);
|
||||||
|
}
|
||||||
if (qlconfigFile !== undefined &&
|
if (qlconfigFile !== undefined &&
|
||||||
(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_INIT_WITH_QLCONFIG))) {
|
(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_INIT_WITH_QLCONFIG))) {
|
||||||
extraArgs.push(`--qlconfig-file=${qlconfigFile}`);
|
extraArgs.push(`--qlconfig-file=${qlconfigFile}`);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
20
lib/codeql.test.js
generated
20
lib/codeql.test.js
generated
@@ -49,25 +49,9 @@ const util_1 = require("./util");
|
|||||||
let stubConfig;
|
let stubConfig;
|
||||||
ava_1.default.beforeEach(() => {
|
ava_1.default.beforeEach(() => {
|
||||||
(0, util_1.initializeEnvironment)("1.2.3");
|
(0, util_1.initializeEnvironment)("1.2.3");
|
||||||
stubConfig = {
|
stubConfig = (0, testing_utils_1.createTestConfig)({
|
||||||
languages: [languages_1.Language.cpp],
|
languages: [languages_1.Language.cpp],
|
||||||
originalUserInput: {},
|
});
|
||||||
tempDir: "",
|
|
||||||
codeQLCmd: "",
|
|
||||||
gitHubVersion: {
|
|
||||||
type: util.GitHubVariant.DOTCOM,
|
|
||||||
},
|
|
||||||
dbLocation: "",
|
|
||||||
debugMode: false,
|
|
||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: {
|
|
||||||
packsInputCombines: false,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
},
|
|
||||||
trapCaches: {},
|
|
||||||
trapCacheDownloadTime: 0,
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
async function installIntoToolcache({ apiDetails = testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, cliVersion, isPinned, tagName, tmpDir, }) {
|
async function installIntoToolcache({ apiDetails = testing_utils_1.SAMPLE_DOTCOM_API_DETAILS, cliVersion, isPinned, tagName, tmpDir, }) {
|
||||||
const url = (0, testing_utils_1.mockBundleDownloadApi)({ apiDetails, isPinned, tagName });
|
const url = (0, testing_utils_1.mockBundleDownloadApi)({ apiDetails, isPinned, tagName });
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
46
lib/config-utils.js
generated
46
lib/config-utils.js
generated
@@ -212,16 +212,17 @@ exports.getRawLanguages = getRawLanguages;
|
|||||||
/**
|
/**
|
||||||
* Get the default config for when the user has not supplied one.
|
* Get the default config for when the user has not supplied one.
|
||||||
*/
|
*/
|
||||||
async function getDefaultConfig(languagesInput, rawQueriesInput, rawPacksInput, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, gitHubVersion, logger) {
|
async function getDefaultConfig({ languagesInput, queriesInput, packsInput, buildModeInput, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeql, githubVersion, logger, }) {
|
||||||
const languages = await getLanguages(codeQL, languagesInput, repository, logger);
|
const languages = await getLanguages(codeql, languagesInput, repository, logger);
|
||||||
const augmentationProperties = calculateAugmentation(rawPacksInput, rawQueriesInput, languages);
|
const augmentationProperties = calculateAugmentation(packsInput, queriesInput, languages);
|
||||||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logger);
|
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeql, languages, logger);
|
||||||
return {
|
return {
|
||||||
languages,
|
languages,
|
||||||
|
buildMode: buildModeInput,
|
||||||
originalUserInput: {},
|
originalUserInput: {},
|
||||||
tempDir,
|
tempDir,
|
||||||
codeQLCmd: codeQL.getPath(),
|
codeQLCmd: codeql.getPath(),
|
||||||
gitHubVersion,
|
gitHubVersion: githubVersion,
|
||||||
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
||||||
debugMode,
|
debugMode,
|
||||||
debugArtifactName,
|
debugArtifactName,
|
||||||
@@ -245,7 +246,7 @@ async function downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logg
|
|||||||
/**
|
/**
|
||||||
* Load the config from the given file.
|
* Load the config from the given file.
|
||||||
*/
|
*/
|
||||||
async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, configFile, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger) {
|
async function loadConfig({ languagesInput, queriesInput, packsInput, buildModeInput, configFile, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeql, workspacePath, githubVersion, apiDetails, logger, }) {
|
||||||
let parsedYAML;
|
let parsedYAML;
|
||||||
if (isLocal(configFile)) {
|
if (isLocal(configFile)) {
|
||||||
// Treat the config file as relative to the workspace
|
// Treat the config file as relative to the workspace
|
||||||
@@ -255,15 +256,16 @@ async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, config
|
|||||||
else {
|
else {
|
||||||
parsedYAML = await getRemoteConfig(configFile, apiDetails);
|
parsedYAML = await getRemoteConfig(configFile, apiDetails);
|
||||||
}
|
}
|
||||||
const languages = await getLanguages(codeQL, languagesInput, repository, logger);
|
const languages = await getLanguages(codeql, languagesInput, repository, logger);
|
||||||
const augmentationProperties = calculateAugmentation(rawPacksInput, rawQueriesInput, languages);
|
const augmentationProperties = calculateAugmentation(packsInput, queriesInput, languages);
|
||||||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logger);
|
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeql, languages, logger);
|
||||||
return {
|
return {
|
||||||
languages,
|
languages,
|
||||||
|
buildMode: buildModeInput,
|
||||||
originalUserInput: parsedYAML,
|
originalUserInput: parsedYAML,
|
||||||
tempDir,
|
tempDir,
|
||||||
codeQLCmd: codeQL.getPath(),
|
codeQLCmd: codeql.getPath(),
|
||||||
gitHubVersion,
|
gitHubVersion: githubVersion,
|
||||||
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
||||||
debugMode,
|
debugMode,
|
||||||
debugArtifactName,
|
debugArtifactName,
|
||||||
@@ -452,24 +454,26 @@ function dbLocationOrDefault(dbLocation, tempDir) {
|
|||||||
* This will parse the config from the user input if present, or generate
|
* This will parse the config from the user input if present, or generate
|
||||||
* a default config. The parsed config is then stored to a known location.
|
* a default config. The parsed config is then stored to a known location.
|
||||||
*/
|
*/
|
||||||
async function initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, configInput, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger) {
|
async function initConfig(inputs) {
|
||||||
let config;
|
let config;
|
||||||
|
const { logger, workspacePath } = inputs;
|
||||||
// if configInput is set, it takes precedence over configFile
|
// if configInput is set, it takes precedence over configFile
|
||||||
if (configInput) {
|
if (inputs.configInput) {
|
||||||
if (configFile) {
|
if (inputs.configFile) {
|
||||||
logger.warning(`Both a config file and config input were provided. Ignoring config file.`);
|
logger.warning(`Both a config file and config input were provided. Ignoring config file.`);
|
||||||
}
|
}
|
||||||
configFile = path.resolve(workspacePath, "user-config-from-action.yml");
|
inputs.configFile = path.resolve(workspacePath, "user-config-from-action.yml");
|
||||||
fs.writeFileSync(configFile, configInput);
|
fs.writeFileSync(inputs.configFile, inputs.configInput);
|
||||||
logger.debug(`Using config from action input: ${configFile}`);
|
logger.debug(`Using config from action input: ${inputs.configFile}`);
|
||||||
}
|
}
|
||||||
// If no config file was provided create an empty one
|
// If no config file was provided create an empty one
|
||||||
if (!configFile) {
|
if (!inputs.configFile) {
|
||||||
logger.debug("No configuration file was provided");
|
logger.debug("No configuration file was provided");
|
||||||
config = await getDefaultConfig(languagesInput, queriesInput, packsInput, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, gitHubVersion, logger);
|
config = await getDefaultConfig(inputs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
config = await loadConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger);
|
// Convince the type checker that inputs.configFile is defined.
|
||||||
|
config = await loadConfig({ ...inputs, configFile: inputs.configFile });
|
||||||
}
|
}
|
||||||
// Save the config so we can easily access it again in the future
|
// Save the config so we can easily access it again in the future
|
||||||
await saveConfig(config, logger);
|
await saveConfig(config, logger);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
220
lib/config-utils.test.js
generated
220
lib/config-utils.test.js
generated
@@ -41,14 +41,35 @@ const repository_1 = require("./repository");
|
|||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||||
const sampleApiDetails = {
|
const githubVersion = { type: util_1.GitHubVariant.DOTCOM };
|
||||||
auth: "token",
|
function createTestInitConfigInputs(overrides) {
|
||||||
externalRepoAuth: "token",
|
return Object.assign({}, {
|
||||||
url: "https://github.example.com",
|
languagesInput: undefined,
|
||||||
apiURL: undefined,
|
queriesInput: undefined,
|
||||||
registriesAuthTokens: undefined,
|
packsInput: undefined,
|
||||||
};
|
configFile: undefined,
|
||||||
const gitHubVersion = { type: util_1.GitHubVariant.DOTCOM };
|
dbLocation: undefined,
|
||||||
|
configInput: undefined,
|
||||||
|
buildModeInput: undefined,
|
||||||
|
trapCachingEnabled: false,
|
||||||
|
debugMode: false,
|
||||||
|
debugArtifactName: "",
|
||||||
|
debugDatabaseName: "",
|
||||||
|
repository: { owner: "github", repo: "example" },
|
||||||
|
tempDir: "",
|
||||||
|
codeql: {},
|
||||||
|
workspacePath: "",
|
||||||
|
githubVersion,
|
||||||
|
apiDetails: {
|
||||||
|
auth: "token",
|
||||||
|
externalRepoAuth: "token",
|
||||||
|
url: "https://github.example.com",
|
||||||
|
apiURL: undefined,
|
||||||
|
registriesAuthTokens: undefined,
|
||||||
|
},
|
||||||
|
logger: (0, logging_1.getRunnerLogger)(true),
|
||||||
|
}, overrides);
|
||||||
|
}
|
||||||
// Returns the filepath of the newly-created file
|
// Returns the filepath of the newly-created file
|
||||||
function createConfigFile(inputFileContents, tmpDir) {
|
function createConfigFile(inputFileContents, tmpDir) {
|
||||||
const configFilePath = path.join(tmpDir, "input");
|
const configFilePath = path.join(tmpDir, "input");
|
||||||
@@ -83,10 +104,10 @@ function mockListLanguages(languages) {
|
|||||||
sinon.stub(api, "getApiClient").value(() => client);
|
sinon.stub(api, "getApiClient").value(() => client);
|
||||||
}
|
}
|
||||||
(0, ava_1.default)("load empty config", async (t) => {
|
(0, ava_1.default)("load empty config", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||||
const languages = "javascript,python";
|
const languages = "javascript,python";
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
const codeql = (0, codeql_1.setCodeQL)({
|
||||||
async resolveQueries() {
|
async resolveQueries() {
|
||||||
return {
|
return {
|
||||||
byLanguage: {
|
byLanguage: {
|
||||||
@@ -101,14 +122,25 @@ function mockListLanguages(languages) {
|
|||||||
return { packs: [] };
|
return { packs: [] };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logger);
|
const config = await configUtils.initConfig(createTestInitConfigInputs({
|
||||||
t.deepEqual(config, await configUtils.getDefaultConfig(languages, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, gitHubVersion, logger));
|
languagesInput: languages,
|
||||||
|
repository: { owner: "github", repo: "example" },
|
||||||
|
tempDir,
|
||||||
|
codeql,
|
||||||
|
logger,
|
||||||
|
}));
|
||||||
|
t.deepEqual(config, await configUtils.getDefaultConfig(createTestInitConfigInputs({
|
||||||
|
languagesInput: languages,
|
||||||
|
tempDir,
|
||||||
|
codeql,
|
||||||
|
logger,
|
||||||
|
})));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("loading config saves config", async (t) => {
|
(0, ava_1.default)("loading config saves config", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
const codeql = (0, codeql_1.setCodeQL)({
|
||||||
async resolveQueries() {
|
async resolveQueries() {
|
||||||
return {
|
return {
|
||||||
byLanguage: {
|
byLanguage: {
|
||||||
@@ -124,14 +156,20 @@ function mockListLanguages(languages) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
// Sanity check the saved config file does not already exist
|
// Sanity check the saved config file does not already exist
|
||||||
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tempDir)));
|
||||||
// Sanity check that getConfig returns undefined before we have called initConfig
|
// Sanity check that getConfig returns undefined before we have called initConfig
|
||||||
t.deepEqual(await configUtils.getConfig(tmpDir, logger), undefined);
|
t.deepEqual(await configUtils.getConfig(tempDir, logger), undefined);
|
||||||
const config1 = await configUtils.initConfig("javascript,python", undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logger);
|
const config1 = await configUtils.initConfig(createTestInitConfigInputs({
|
||||||
|
languagesInput: "javascript,python",
|
||||||
|
tempDir,
|
||||||
|
codeql,
|
||||||
|
workspacePath: tempDir,
|
||||||
|
logger,
|
||||||
|
}));
|
||||||
// The saved config file should now exist
|
// The saved config file should now exist
|
||||||
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tempDir)));
|
||||||
// And that same newly-initialised config should now be returned by getConfig
|
// And that same newly-initialised config should now be returned by getConfig
|
||||||
const config2 = await configUtils.getConfig(tmpDir, logger);
|
const config2 = await configUtils.getConfig(tempDir, logger);
|
||||||
t.not(config2, undefined);
|
t.not(config2, undefined);
|
||||||
if (config2 !== undefined) {
|
if (config2 !== undefined) {
|
||||||
// removes properties assigned to undefined.
|
// removes properties assigned to undefined.
|
||||||
@@ -141,22 +179,32 @@ function mockListLanguages(languages) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("load input outside of workspace", async (t) => {
|
(0, ava_1.default)("load input outside of workspace", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, "../input", undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(createTestInitConfigInputs({
|
||||||
|
configFile: "../input",
|
||||||
|
tempDir,
|
||||||
|
codeql: (0, codeql_1.getCachedCodeQL)(),
|
||||||
|
workspacePath: tempDir,
|
||||||
|
}));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileOutsideWorkspaceErrorMessage(path.join(tmpDir, "../input"))));
|
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileOutsideWorkspaceErrorMessage(path.join(tempDir, "../input"))));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("load non-local input with invalid repo syntax", async (t) => {
|
(0, ava_1.default)("load non-local input with invalid repo syntax", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||||
// no filename given, just a repo
|
// no filename given, just a repo
|
||||||
const configFile = "octo-org/codeql-config@main";
|
const configFile = "octo-org/codeql-config@main";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, configFile, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(createTestInitConfigInputs({
|
||||||
|
configFile,
|
||||||
|
tempDir,
|
||||||
|
codeql: (0, codeql_1.getCachedCodeQL)(),
|
||||||
|
workspacePath: tempDir,
|
||||||
|
}));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -165,22 +213,28 @@ function mockListLanguages(languages) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("load non-existent input", async (t) => {
|
(0, ava_1.default)("load non-existent input", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||||
const languages = "javascript";
|
const languagesInput = "javascript";
|
||||||
const configFile = "input";
|
const configFile = "input";
|
||||||
t.false(fs.existsSync(path.join(tmpDir, configFile)));
|
t.false(fs.existsSync(path.join(tempDir, configFile)));
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(createTestInitConfigInputs({
|
||||||
|
languagesInput,
|
||||||
|
configFile,
|
||||||
|
tempDir,
|
||||||
|
codeql: (0, codeql_1.getCachedCodeQL)(),
|
||||||
|
workspacePath: tempDir,
|
||||||
|
}));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileDoesNotExistErrorMessage(path.join(tmpDir, "input"))));
|
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileDoesNotExistErrorMessage(path.join(tempDir, "input"))));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("load non-empty input", async (t) => {
|
(0, ava_1.default)("load non-empty input", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
const codeql = (0, codeql_1.setCodeQL)({
|
||||||
async resolveQueries() {
|
async resolveQueries() {
|
||||||
return {
|
return {
|
||||||
byLanguage: {
|
byLanguage: {
|
||||||
@@ -208,10 +262,11 @@ function mockListLanguages(languages) {
|
|||||||
- b
|
- b
|
||||||
paths:
|
paths:
|
||||||
- c/d`;
|
- c/d`;
|
||||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
fs.mkdirSync(path.join(tempDir, "foo"));
|
||||||
// And the config we expect it to parse to
|
// And the config we expect it to parse to
|
||||||
const expectedConfig = {
|
const expectedConfig = {
|
||||||
languages: [languages_1.Language.javascript],
|
languages: [languages_1.Language.javascript],
|
||||||
|
buildMode: "none",
|
||||||
originalUserInput: {
|
originalUserInput: {
|
||||||
name: "my config",
|
name: "my config",
|
||||||
"disable-default-queries": true,
|
"disable-default-queries": true,
|
||||||
@@ -219,10 +274,10 @@ function mockListLanguages(languages) {
|
|||||||
"paths-ignore": ["a", "b"],
|
"paths-ignore": ["a", "b"],
|
||||||
paths: ["c/d"],
|
paths: ["c/d"],
|
||||||
},
|
},
|
||||||
tempDir: tmpDir,
|
tempDir,
|
||||||
codeQLCmd: codeQL.getPath(),
|
codeQLCmd: codeql.getPath(),
|
||||||
gitHubVersion,
|
gitHubVersion: githubVersion,
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
debugArtifactName: "my-artifact",
|
debugArtifactName: "my-artifact",
|
||||||
debugDatabaseName: "my-db",
|
debugDatabaseName: "my-db",
|
||||||
@@ -230,9 +285,18 @@ function mockListLanguages(languages) {
|
|||||||
trapCaches: {},
|
trapCaches: {},
|
||||||
trapCacheDownloadTime: 0,
|
trapCacheDownloadTime: 0,
|
||||||
};
|
};
|
||||||
const languages = "javascript";
|
const languagesInput = "javascript";
|
||||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tempDir);
|
||||||
const actualConfig = await configUtils.initConfig(languages, undefined, undefined, configFilePath, undefined, undefined, false, false, "my-artifact", "my-db", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, logging_1.getRunnerLogger)(true));
|
const actualConfig = await configUtils.initConfig(createTestInitConfigInputs({
|
||||||
|
languagesInput,
|
||||||
|
buildModeInput: "none",
|
||||||
|
configFile: configFilePath,
|
||||||
|
debugArtifactName: "my-artifact",
|
||||||
|
debugDatabaseName: "my-db",
|
||||||
|
tempDir,
|
||||||
|
codeql,
|
||||||
|
workspacePath: tempDir,
|
||||||
|
}));
|
||||||
// Should exactly equal the object we constructed earlier
|
// Should exactly equal the object we constructed earlier
|
||||||
t.deepEqual(actualConfig, expectedConfig);
|
t.deepEqual(actualConfig, expectedConfig);
|
||||||
});
|
});
|
||||||
@@ -256,14 +320,14 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
(0, ava_1.default)("Using config input and file together, config input should be used.", async (t) => {
|
(0, ava_1.default)("Using config input and file together, config input should be used.", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||||
process.env["RUNNER_TEMP"] = tmpDir;
|
process.env["RUNNER_TEMP"] = tempDir;
|
||||||
process.env["GITHUB_WORKSPACE"] = tmpDir;
|
process.env["GITHUB_WORKSPACE"] = tempDir;
|
||||||
const inputFileContents = `
|
const inputFileContents = `
|
||||||
name: my config
|
name: my config
|
||||||
queries:
|
queries:
|
||||||
- uses: ./foo_file`;
|
- uses: ./foo_file`;
|
||||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tempDir);
|
||||||
const configInput = `
|
const configInput = `
|
||||||
name: my config
|
name: my config
|
||||||
queries:
|
queries:
|
||||||
@@ -274,9 +338,9 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
python:
|
python:
|
||||||
- c/d@1.2.3
|
- c/d@1.2.3
|
||||||
`;
|
`;
|
||||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
fs.mkdirSync(path.join(tempDir, "foo"));
|
||||||
const resolveQueriesArgs = [];
|
const resolveQueriesArgs = [];
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
const codeql = (0, codeql_1.setCodeQL)({
|
||||||
async resolveQueries(queries, extraSearchPath) {
|
async resolveQueries(queries, extraSearchPath) {
|
||||||
resolveQueriesArgs.push({ queries, extraSearchPath });
|
resolveQueriesArgs.push({ queries, extraSearchPath });
|
||||||
return queriesToResolvedQueryForm(queries);
|
return queriesToResolvedQueryForm(queries);
|
||||||
@@ -286,14 +350,21 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
// Only JS, python packs will be ignored
|
// Only JS, python packs will be ignored
|
||||||
const languages = "javascript";
|
const languagesInput = "javascript";
|
||||||
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, configFilePath, configInput, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, logging_1.getRunnerLogger)(true));
|
const config = await configUtils.initConfig(createTestInitConfigInputs({
|
||||||
|
languagesInput,
|
||||||
|
configFile: configFilePath,
|
||||||
|
configInput,
|
||||||
|
tempDir,
|
||||||
|
codeql,
|
||||||
|
workspacePath: tempDir,
|
||||||
|
}));
|
||||||
t.deepEqual(config.originalUserInput, yaml.load(configInput));
|
t.deepEqual(config.originalUserInput, yaml.load(configInput));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("API client used when reading remote config", async (t) => {
|
(0, ava_1.default)("API client used when reading remote config", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
const codeql = (0, codeql_1.setCodeQL)({
|
||||||
async resolveQueries() {
|
async resolveQueries() {
|
||||||
return {
|
return {
|
||||||
byLanguage: {
|
byLanguage: {
|
||||||
@@ -326,20 +397,31 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
};
|
};
|
||||||
const spyGetContents = mockGetContents(dummyResponse);
|
const spyGetContents = mockGetContents(dummyResponse);
|
||||||
// Create checkout directory for remote queries repository
|
// Create checkout directory for remote queries repository
|
||||||
fs.mkdirSync(path.join(tmpDir, "foo/bar/dev"), { recursive: true });
|
fs.mkdirSync(path.join(tempDir, "foo/bar/dev"), { recursive: true });
|
||||||
const configFile = "octo-org/codeql-config/config.yaml@main";
|
const configFile = "octo-org/codeql-config/config.yaml@main";
|
||||||
const languages = "javascript";
|
const languagesInput = "javascript";
|
||||||
await configUtils.initConfig(languages, undefined, undefined, configFile, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(createTestInitConfigInputs({
|
||||||
|
languagesInput,
|
||||||
|
configFile,
|
||||||
|
tempDir,
|
||||||
|
codeql,
|
||||||
|
workspacePath: tempDir,
|
||||||
|
}));
|
||||||
t.assert(spyGetContents.called);
|
t.assert(spyGetContents.called);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("Remote config handles the case where a directory is provided", async (t) => {
|
(0, ava_1.default)("Remote config handles the case where a directory is provided", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||||
const dummyResponse = []; // directories are returned as arrays
|
const dummyResponse = []; // directories are returned as arrays
|
||||||
mockGetContents(dummyResponse);
|
mockGetContents(dummyResponse);
|
||||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, repoReference, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(createTestInitConfigInputs({
|
||||||
|
configFile: repoReference,
|
||||||
|
tempDir,
|
||||||
|
codeql: (0, codeql_1.getCachedCodeQL)(),
|
||||||
|
workspacePath: tempDir,
|
||||||
|
}));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -348,14 +430,19 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("Invalid format of remote config handled correctly", async (t) => {
|
(0, ava_1.default)("Invalid format of remote config handled correctly", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||||
const dummyResponse = {
|
const dummyResponse = {
|
||||||
// note no "content" property here
|
// note no "content" property here
|
||||||
};
|
};
|
||||||
mockGetContents(dummyResponse);
|
mockGetContents(dummyResponse);
|
||||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, repoReference, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(createTestInitConfigInputs({
|
||||||
|
configFile: repoReference,
|
||||||
|
tempDir,
|
||||||
|
codeql: (0, codeql_1.getCachedCodeQL)(),
|
||||||
|
workspacePath: tempDir,
|
||||||
|
}));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -364,9 +451,9 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("No detected languages", async (t) => {
|
(0, ava_1.default)("No detected languages", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||||
mockListLanguages([]);
|
mockListLanguages([]);
|
||||||
const codeQL = (0, codeql_1.setCodeQL)({
|
const codeql = (0, codeql_1.setCodeQL)({
|
||||||
async resolveLanguages() {
|
async resolveLanguages() {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
@@ -375,7 +462,11 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(undefined, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(createTestInitConfigInputs({
|
||||||
|
tempDir,
|
||||||
|
codeql,
|
||||||
|
workspacePath: tempDir,
|
||||||
|
}));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -384,10 +475,15 @@ function queriesToResolvedQueryForm(queries) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("Unknown languages", async (t) => {
|
(0, ava_1.default)("Unknown languages", async (t) => {
|
||||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||||
const languages = "rubbish,english";
|
const languagesInput = "rubbish,english";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, (0, codeql_1.getCachedCodeQL)(), tmpDir, gitHubVersion, sampleApiDetails, (0, logging_1.getRunnerLogger)(true));
|
await configUtils.initConfig(createTestInitConfigInputs({
|
||||||
|
languagesInput,
|
||||||
|
tempDir,
|
||||||
|
codeql: (0, codeql_1.getCachedCodeQL)(),
|
||||||
|
workspacePath: tempDir,
|
||||||
|
}));
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
15
lib/database-upload.test.js
generated
15
lib/database-upload.test.js
generated
@@ -33,7 +33,6 @@ const sinon = __importStar(require("sinon"));
|
|||||||
const actionsUtil = __importStar(require("./actions-util"));
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
const apiClient = __importStar(require("./api-client"));
|
const apiClient = __importStar(require("./api-client"));
|
||||||
const codeql_1 = require("./codeql");
|
const codeql_1 = require("./codeql");
|
||||||
const config_utils_1 = require("./config-utils");
|
|
||||||
const database_upload_1 = require("./database-upload");
|
const database_upload_1 = require("./database-upload");
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
@@ -49,20 +48,10 @@ const testApiDetails = {
|
|||||||
apiURL: undefined,
|
apiURL: undefined,
|
||||||
};
|
};
|
||||||
function getTestConfig(tmpDir) {
|
function getTestConfig(tmpDir) {
|
||||||
return {
|
return (0, testing_utils_1.createTestConfig)({
|
||||||
languages: [languages_1.Language.javascript],
|
languages: [languages_1.Language.javascript],
|
||||||
originalUserInput: {},
|
|
||||||
tempDir: tmpDir,
|
|
||||||
codeQLCmd: "foo",
|
|
||||||
gitHubVersion: { type: util_1.GitHubVariant.DOTCOM },
|
|
||||||
dbLocation: tmpDir,
|
dbLocation: tmpDir,
|
||||||
debugMode: false,
|
});
|
||||||
debugArtifactName: util_1.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: util_1.DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: config_utils_1.defaultAugmentationProperties,
|
|
||||||
trapCaches: {},
|
|
||||||
trapCacheDownloadTime: 0,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
async function mockHttpRequests(databaseUploadStatusCode) {
|
async function mockHttpRequests(databaseUploadStatusCode) {
|
||||||
// Passing an auth token is required, so we just use a dummy value
|
// Passing an auth token is required, so we just use a dummy value
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"bundleVersion": "codeql-bundle-v2.16.0",
|
"bundleVersion": "codeql-bundle-v2.16.1",
|
||||||
"cliVersion": "2.16.0",
|
"cliVersion": "2.16.1",
|
||||||
"priorBundleVersion": "codeql-bundle-v2.15.5",
|
"priorBundleVersion": "codeql-bundle-v2.16.0",
|
||||||
"priorCliVersion": "2.15.5"
|
"priorCliVersion": "2.16.0"
|
||||||
}
|
}
|
||||||
|
|||||||
8
lib/environment.js
generated
8
lib/environment.js
generated
@@ -1,6 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.EnvVar = void 0;
|
exports.EnvVar = void 0;
|
||||||
|
/**
|
||||||
|
* Environment variables used by the CodeQL Action.
|
||||||
|
*
|
||||||
|
* We recommend prefixing environment variables with `CODEQL_ACTION_`
|
||||||
|
* to reduce the risk that they are overwritten by other steps.
|
||||||
|
*/
|
||||||
var EnvVar;
|
var EnvVar;
|
||||||
(function (EnvVar) {
|
(function (EnvVar) {
|
||||||
/** Whether the `analyze` Action completes successfully. */
|
/** Whether the `analyze` Action completes successfully. */
|
||||||
@@ -30,6 +36,8 @@ var EnvVar;
|
|||||||
EnvVar["HAS_WARNED_ABOUT_DISK_SPACE"] = "CODEQL_ACTION_HAS_WARNED_ABOUT_DISK_SPACE";
|
EnvVar["HAS_WARNED_ABOUT_DISK_SPACE"] = "CODEQL_ACTION_HAS_WARNED_ABOUT_DISK_SPACE";
|
||||||
/** UUID representing the current job run. */
|
/** UUID representing the current job run. */
|
||||||
EnvVar["JOB_RUN_UUID"] = "JOB_RUN_UUID";
|
EnvVar["JOB_RUN_UUID"] = "JOB_RUN_UUID";
|
||||||
|
/** Status for the entire job, submitted to the status report in `init-post` */
|
||||||
|
EnvVar["JOB_STATUS"] = "CODEQL_ACTION_JOB_STATUS";
|
||||||
EnvVar["ODASA_TRACER_CONFIGURATION"] = "ODASA_TRACER_CONFIGURATION";
|
EnvVar["ODASA_TRACER_CONFIGURATION"] = "ODASA_TRACER_CONFIGURATION";
|
||||||
/**
|
/**
|
||||||
* What percentage of the total amount of RAM over 8 GB that the Action should reserve for the
|
* What percentage of the total amount of RAM over 8 GB that the Action should reserve for the
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAsEX;AAtED,WAAY,MAAM;IAChB,2DAA2D;IAC3D,+FAAqF,CAAA;IAErF,gEAAgE;IAChE,qEAA2D,CAAA;IAE3D;;;OAGG;IACH,yFAA+E,CAAA;IAE/E;;;OAGG;IACH,yEAA+D,CAAA;IAE/D,gFAAgF;IAChF,6DAAmD,CAAA;IAEnD;;;OAGG;IACH,uEAA6D,CAAA;IAE7D,gEAAgE;IAChE,mEAAyD,CAAA;IAEzD,kFAAkF;IAClF,mFAAyE,CAAA;IAEzE,6CAA6C;IAC7C,uCAA6B,CAAA;IAE7B,mEAAyD,CAAA;IAEzD;;;OAGG;IACH,2FAAiF,CAAA;IAEjF,mFAAmF;IACnF,6FAAmF,CAAA;IAEnF,qFAAqF;IACrF,+CAAqC,CAAA;IAErC,mEAAyD,CAAA;IAEzD,kEAAkE;IAClE,2CAAiC,CAAA;IAEjC;;;;;;OAMG;IACH,4DAAkD,CAAA;IAElD;;;OAGG;IACH,wDAA8C,CAAA;AAChD,CAAC,EAtEW,MAAM,sBAAN,MAAM,QAsEjB"}
|
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,IAAY,MAyEX;AAzED,WAAY,MAAM;IAChB,2DAA2D;IAC3D,+FAAqF,CAAA;IAErF,gEAAgE;IAChE,qEAA2D,CAAA;IAE3D;;;OAGG;IACH,yFAA+E,CAAA;IAE/E;;;OAGG;IACH,yEAA+D,CAAA;IAE/D,gFAAgF;IAChF,6DAAmD,CAAA;IAEnD;;;OAGG;IACH,uEAA6D,CAAA;IAE7D,gEAAgE;IAChE,mEAAyD,CAAA;IAEzD,kFAAkF;IAClF,mFAAyE,CAAA;IAEzE,6CAA6C;IAC7C,uCAA6B,CAAA;IAE7B,+EAA+E;IAC/E,iDAAuC,CAAA;IAEvC,mEAAyD,CAAA;IAEzD;;;OAGG;IACH,2FAAiF,CAAA;IAEjF,mFAAmF;IACnF,6FAAmF,CAAA;IAEnF,qFAAqF;IACrF,+CAAqC,CAAA;IAErC,mEAAyD,CAAA;IAEzD,kEAAkE;IAClE,2CAAiC,CAAA;IAEjC;;;;;;OAMG;IACH,4DAAkD,CAAA;IAElD;;;OAGG;IACH,wDAA8C,CAAA;AAChD,CAAC,EAzEW,MAAM,sBAAN,MAAM,QAyEjB"}
|
||||||
2
lib/feature-flags.js
generated
2
lib/feature-flags.js
generated
@@ -105,7 +105,7 @@ exports.featureConfig = {
|
|||||||
// here!
|
// here!
|
||||||
envVar: "CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION",
|
envVar: "CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION",
|
||||||
minimumVersion: "2.16.0",
|
minimumVersion: "2.16.0",
|
||||||
defaultValue: false,
|
defaultValue: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
exports.FEATURE_FLAGS_FILE_NAME = "cached-feature-flags.json";
|
exports.FEATURE_FLAGS_FILE_NAME = "cached-feature-flags.json";
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
26
lib/init-action-post-helper.js
generated
26
lib/init-action-post-helper.js
generated
@@ -23,7 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.run = exports.tryUploadSarifIfRunFailed = void 0;
|
exports.getFinalJobStatus = exports.run = exports.tryUploadSarifIfRunFailed = void 0;
|
||||||
|
const core = __importStar(require("@actions/core"));
|
||||||
const github = __importStar(require("@actions/github"));
|
const github = __importStar(require("@actions/github"));
|
||||||
const actionsUtil = __importStar(require("./actions-util"));
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
const api_client_1 = require("./api-client");
|
const api_client_1 = require("./api-client");
|
||||||
@@ -32,6 +33,7 @@ const config_utils_1 = require("./config-utils");
|
|||||||
const environment_1 = require("./environment");
|
const environment_1 = require("./environment");
|
||||||
const feature_flags_1 = require("./feature-flags");
|
const feature_flags_1 = require("./feature-flags");
|
||||||
const repository_1 = require("./repository");
|
const repository_1 = require("./repository");
|
||||||
|
const status_report_1 = require("./status-report");
|
||||||
const uploadLib = __importStar(require("./upload-lib"));
|
const uploadLib = __importStar(require("./upload-lib"));
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
const workflow_1 = require("./workflow");
|
const workflow_1 = require("./workflow");
|
||||||
@@ -81,6 +83,12 @@ async function maybeUploadFailedSarif(config, repositoryNwo, features, logger) {
|
|||||||
}
|
}
|
||||||
async function tryUploadSarifIfRunFailed(config, repositoryNwo, features, logger) {
|
async function tryUploadSarifIfRunFailed(config, repositoryNwo, features, logger) {
|
||||||
if (process.env[environment_1.EnvVar.ANALYZE_DID_COMPLETE_SUCCESSFULLY] !== "true") {
|
if (process.env[environment_1.EnvVar.ANALYZE_DID_COMPLETE_SUCCESSFULLY] !== "true") {
|
||||||
|
// If analyze didn't complete successfully and the job status hasn't
|
||||||
|
// already been set to Failure/ConfigurationError previously, this
|
||||||
|
// means that something along the way failed in a step that is not
|
||||||
|
// owned by the Action, for example a manual build step. We
|
||||||
|
// consider this a configuration error.
|
||||||
|
core.exportVariable(environment_1.EnvVar.JOB_STATUS, process.env[environment_1.EnvVar.JOB_STATUS] ?? status_report_1.JobStatus.ConfigurationError);
|
||||||
try {
|
try {
|
||||||
return await maybeUploadFailedSarif(config, repositoryNwo, features, logger);
|
return await maybeUploadFailedSarif(config, repositoryNwo, features, logger);
|
||||||
}
|
}
|
||||||
@@ -90,6 +98,7 @@ async function tryUploadSarifIfRunFailed(config, repositoryNwo, features, logger
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
core.exportVariable(environment_1.EnvVar.JOB_STATUS, process.env[environment_1.EnvVar.JOB_STATUS] ?? status_report_1.JobStatus.Success);
|
||||||
return {
|
return {
|
||||||
upload_failed_run_skipped_because: "Analyze Action completed successfully",
|
upload_failed_run_skipped_because: "Analyze Action completed successfully",
|
||||||
};
|
};
|
||||||
@@ -185,4 +194,19 @@ async function removeUploadedSarif(uploadFailedSarifResult, logger) {
|
|||||||
logger.warning("Could not delete the uploaded SARIF analysis because a SARIF ID wasn't provided by the API when uploading the SARIF file.");
|
logger.warning("Could not delete the uploaded SARIF analysis because a SARIF ID wasn't provided by the API when uploading the SARIF file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns the final job status sent in the `init-post` Action, based on the
|
||||||
|
* current value of the JOB_STATUS environment variable. If the variable is
|
||||||
|
* unset, or if its value is not one of the JobStatus enum values, returns
|
||||||
|
* Unknown. Otherwise it returns the status set in the environment variable.
|
||||||
|
*/
|
||||||
|
function getFinalJobStatus() {
|
||||||
|
const jobStatusFromEnvironment = process.env[environment_1.EnvVar.JOB_STATUS];
|
||||||
|
if (!jobStatusFromEnvironment ||
|
||||||
|
!Object.values(status_report_1.JobStatus).includes(jobStatusFromEnvironment)) {
|
||||||
|
return status_report_1.JobStatus.Unknown;
|
||||||
|
}
|
||||||
|
return jobStatusFromEnvironment;
|
||||||
|
}
|
||||||
|
exports.getFinalJobStatus = getFinalJobStatus;
|
||||||
//# sourceMappingURL=init-action-post-helper.js.map
|
//# sourceMappingURL=init-action-post-helper.js.map
|
||||||
File diff suppressed because one or more lines are too long
1
lib/init-action-post.js
generated
1
lib/init-action-post.js
generated
@@ -59,6 +59,7 @@ async function runWrapper() {
|
|||||||
const statusReport = {
|
const statusReport = {
|
||||||
...statusReportBase,
|
...statusReportBase,
|
||||||
...uploadFailedSarifResult,
|
...uploadFailedSarifResult,
|
||||||
|
job_status: initActionPostHelper.getFinalJobStatus(),
|
||||||
};
|
};
|
||||||
await (0, status_report_1.sendStatusReport)(statusReport);
|
await (0, status_report_1.sendStatusReport)(statusReport);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"init-action-post.js","sourceRoot":"","sources":["../src/init-action-post.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,oDAAsC;AAEtC,iDAAuE;AACvE,6CAAgD;AAChD,kEAAoD;AACpD,mDAA2C;AAC3C,gFAAkE;AAClE,uCAA6C;AAC7C,6CAAkD;AAClD,mDAKyB;AACzB,iCAKgB;AAMhB,KAAK,UAAU,UAAU;IACvB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IAAI,uBAES,CAAC;IACd,IAAI,CAAC;QACH,MAAM,M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,CACF,CAAC;QACF,OAAO;IACT,CAAC;IACD,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,WAAW,EACX,SAAS,EACT,SAAS,EACT,MAAM,IAAA,qBAAc,GAAE,CACvB,CAAC;IACF,MAAM,YAAY,GAAyB;QACzC,GAAG,gBAAgB;QACnB,GAAG,uBAAuB;QAC1B,UAAU,EAAE,oBAAoB,CAAC,iBAAiB,EAAE;KACrD,CAAC;IACF,MAAM,IAAA,gCAAgB,EAAC,YAAY,CAAC,CAAC;AACvC,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||||
34
lib/init-action.js
generated
34
lib/init-action.js
generated
@@ -137,12 +137,30 @@ async function run() {
|
|||||||
logger.info("Detected no issues with the code scanning workflow.");
|
logger.info("Detected no issues with the code scanning workflow.");
|
||||||
}
|
}
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
config = await (0, init_1.initConfig)((0, actions_util_1.getOptionalInput)("languages"), (0, actions_util_1.getOptionalInput)("queries"), (0, actions_util_1.getOptionalInput)("packs"), (0, actions_util_1.getOptionalInput)("config-file"), (0, actions_util_1.getOptionalInput)("db-location"), (0, actions_util_1.getOptionalInput)("config"), getTrapCachingEnabled(),
|
config = await (0, init_1.initConfig)({
|
||||||
// Debug mode is enabled if:
|
languagesInput: (0, actions_util_1.getOptionalInput)("languages"),
|
||||||
// - The `init` Action is passed `debug: true`.
|
queriesInput: (0, actions_util_1.getOptionalInput)("queries"),
|
||||||
// - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow),
|
packsInput: (0, actions_util_1.getOptionalInput)("packs"),
|
||||||
// or by setting the `ACTIONS_STEP_DEBUG` secret to `true`).
|
buildModeInput: (0, actions_util_1.getOptionalInput)("build-mode"),
|
||||||
(0, actions_util_1.getOptionalInput)("debug") === "true" || core.isDebug(), (0, actions_util_1.getOptionalInput)("debug-artifact-name") || util_1.DEFAULT_DEBUG_ARTIFACT_NAME, (0, actions_util_1.getOptionalInput)("debug-database-name") || util_1.DEFAULT_DEBUG_DATABASE_NAME, repositoryNwo, (0, actions_util_1.getTemporaryDirectory)(), codeql, (0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"), gitHubVersion, apiDetails, logger);
|
configFile: (0, actions_util_1.getOptionalInput)("config-file"),
|
||||||
|
dbLocation: (0, actions_util_1.getOptionalInput)("db-location"),
|
||||||
|
configInput: (0, actions_util_1.getOptionalInput)("config"),
|
||||||
|
trapCachingEnabled: getTrapCachingEnabled(),
|
||||||
|
// Debug mode is enabled if:
|
||||||
|
// - The `init` Action is passed `debug: true`.
|
||||||
|
// - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow),
|
||||||
|
// or by setting the `ACTIONS_STEP_DEBUG` secret to `true`).
|
||||||
|
debugMode: (0, actions_util_1.getOptionalInput)("debug") === "true" || core.isDebug(),
|
||||||
|
debugArtifactName: (0, actions_util_1.getOptionalInput)("debug-artifact-name") || util_1.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: (0, actions_util_1.getOptionalInput)("debug-database-name") || util_1.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
|
repository: repositoryNwo,
|
||||||
|
tempDir: (0, actions_util_1.getTemporaryDirectory)(),
|
||||||
|
codeql,
|
||||||
|
workspacePath: (0, util_1.getRequiredEnvParam)("GITHUB_WORKSPACE"),
|
||||||
|
githubVersion: gitHubVersion,
|
||||||
|
apiDetails,
|
||||||
|
logger,
|
||||||
|
});
|
||||||
await (0, init_1.checkInstallPython311)(config.languages, codeql);
|
await (0, init_1.checkInstallPython311)(config.languages, codeql);
|
||||||
if (config.languages.includes(languages_1.Language.python) &&
|
if (config.languages.includes(languages_1.Language.python) &&
|
||||||
(0, actions_util_1.getRequiredInput)("setup-python-dependencies") === "true") {
|
(0, actions_util_1.getRequiredInput)("setup-python-dependencies") === "true") {
|
||||||
@@ -167,8 +185,6 @@ async function run() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// Query CLI for supported features
|
|
||||||
const versionInfo = await codeql.getVersion();
|
|
||||||
// Forward Go flags
|
// Forward Go flags
|
||||||
const goFlags = process.env["GOFLAGS"];
|
const goFlags = process.env["GOFLAGS"];
|
||||||
if (goFlags) {
|
if (goFlags) {
|
||||||
@@ -185,7 +201,7 @@ async function run() {
|
|||||||
// replacing the `go` binary with a shell script that invokes the actual `go` binary. Since the shell is
|
// replacing the `go` binary with a shell script that invokes the actual `go` binary. Since the shell is
|
||||||
// typically dynamically linked, this provides a suitable entry point for the CodeQL tracer.
|
// typically dynamically linked, this provides a suitable entry point for the CodeQL tracer.
|
||||||
if (fileOutput.includes("statically linked") &&
|
if (fileOutput.includes("statically linked") &&
|
||||||
!(0, tools_features_1.isSupportedToolsFeature)(versionInfo, tools_features_1.ToolsFeature.IndirectTracingSupportsStaticBinaries)) {
|
!(await codeql.supportsFeature(tools_features_1.ToolsFeature.IndirectTracingSupportsStaticBinaries))) {
|
||||||
try {
|
try {
|
||||||
logger.debug(`Applying static binary workaround for Go`);
|
logger.debug(`Applying static binary workaround for Go`);
|
||||||
// Create a directory that we can add to the system PATH.
|
// Create a directory that we can add to the system PATH.
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
7
lib/init.js
generated
7
lib/init.js
generated
@@ -41,9 +41,10 @@ async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVe
|
|||||||
return { codeql, toolsDownloadDurationMs, toolsSource, toolsVersion };
|
return { codeql, toolsDownloadDurationMs, toolsSource, toolsVersion };
|
||||||
}
|
}
|
||||||
exports.initCodeQL = initCodeQL;
|
exports.initCodeQL = initCodeQL;
|
||||||
async function initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, configInput, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger) {
|
async function initConfig(inputs) {
|
||||||
|
const logger = inputs.logger;
|
||||||
logger.startGroup("Load language configuration");
|
logger.startGroup("Load language configuration");
|
||||||
const config = await configUtils.initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, configInput, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger);
|
const config = await configUtils.initConfig(inputs);
|
||||||
printPathFiltersWarning(config, logger);
|
printPathFiltersWarning(config, logger);
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
return config;
|
return config;
|
||||||
@@ -63,7 +64,7 @@ async function runInit(codeql, config, sourceRoot, processName, registriesInput,
|
|||||||
catch (e) {
|
catch (e) {
|
||||||
throw processError(e);
|
throw processError(e);
|
||||||
}
|
}
|
||||||
return await (0, tracer_config_1.getCombinedTracerConfig)(await codeql.getVersion(), config);
|
return await (0, tracer_config_1.getCombinedTracerConfig)(codeql, config);
|
||||||
}
|
}
|
||||||
exports.runInit = runInit;
|
exports.runInit = runInit;
|
||||||
function printPathFiltersWarning(config, logger) {
|
function printPathFiltersWarning(config, logger) {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,yEAA2D;AAC3D,kEAAoD;AAGpD,qCAA+C;AAC/C,4DAA8C;AAE9C,2CAA0D;AAI1D,mDAAwE;AACxE,6CAA+B;AAExB,KAAK,UAAU,UAAU,CAC9B,UAA8B,EAC9B,UAA4B,EAC5B,OAAe,EACf,OAA2B,EAC3B,iBAA2C,EAC3C,MAAc;IAOd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,uBAAuB,EAAE,WAAW,E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AC;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAzCD,8CAyCC"}
|
||||||
30
lib/status-report.js
generated
30
lib/status-report.js
generated
@@ -23,13 +23,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.sendStatusReport = exports.createStatusReportBase = exports.getActionsStatus = void 0;
|
exports.sendStatusReport = exports.createStatusReportBase = exports.getActionsStatus = exports.JobStatus = void 0;
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const actions_util_1 = require("./actions-util");
|
const actions_util_1 = require("./actions-util");
|
||||||
const api_client_1 = require("./api-client");
|
const api_client_1 = require("./api-client");
|
||||||
const environment_1 = require("./environment");
|
const environment_1 = require("./environment");
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
|
/** Overall status of the entire job. String values match the Hydro schema. */
|
||||||
|
var JobStatus;
|
||||||
|
(function (JobStatus) {
|
||||||
|
JobStatus["Unknown"] = "JOB_STATUS_UNKNOWN";
|
||||||
|
JobStatus["Success"] = "JOB_STATUS_SUCCESS";
|
||||||
|
JobStatus["Failure"] = "JOB_STATUS_FAILURE";
|
||||||
|
JobStatus["ConfigurationError"] = "JOB_STATUS_CONFIGURATION_ERROR";
|
||||||
|
})(JobStatus || (exports.JobStatus = JobStatus = {}));
|
||||||
function getActionsStatus(error, otherFailureCause) {
|
function getActionsStatus(error, otherFailureCause) {
|
||||||
if (error || otherFailureCause) {
|
if (error || otherFailureCause) {
|
||||||
return error instanceof util_1.UserError ? "user-error" : "failure";
|
return error instanceof util_1.UserError ? "user-error" : "failure";
|
||||||
@@ -39,6 +47,19 @@ function getActionsStatus(error, otherFailureCause) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.getActionsStatus = getActionsStatus;
|
exports.getActionsStatus = getActionsStatus;
|
||||||
|
/**
|
||||||
|
* Sets the overall job status environment variable to configuration error
|
||||||
|
* or failure, unless it's already been set to one of these values in a
|
||||||
|
* previous step.
|
||||||
|
*/
|
||||||
|
function setJobStatusIfUnsuccessful(actionStatus) {
|
||||||
|
if (actionStatus === "user-error") {
|
||||||
|
core.exportVariable(environment_1.EnvVar.JOB_STATUS, process.env[environment_1.EnvVar.JOB_STATUS] ?? JobStatus.ConfigurationError);
|
||||||
|
}
|
||||||
|
else if (actionStatus === "failure" || actionStatus === "aborted") {
|
||||||
|
core.exportVariable(environment_1.EnvVar.JOB_STATUS, process.env[environment_1.EnvVar.JOB_STATUS] ?? JobStatus.Failure);
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Compose a StatusReport.
|
* Compose a StatusReport.
|
||||||
*
|
*
|
||||||
@@ -82,9 +103,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, diskI
|
|||||||
job_name: jobName,
|
job_name: jobName,
|
||||||
job_run_uuid: jobRunUUID,
|
job_run_uuid: jobRunUUID,
|
||||||
ref,
|
ref,
|
||||||
runner_available_disk_space_bytes: diskInfo.numAvailableBytes,
|
|
||||||
runner_os: runnerOs,
|
runner_os: runnerOs,
|
||||||
runner_total_disk_space_bytes: diskInfo.numTotalBytes,
|
|
||||||
started_at: workflowStartedAt,
|
started_at: workflowStartedAt,
|
||||||
status,
|
status,
|
||||||
testing_environment: testingEnvironment,
|
testing_environment: testingEnvironment,
|
||||||
@@ -92,6 +111,10 @@ async function createStatusReportBase(actionName, status, actionStartedAt, diskI
|
|||||||
workflow_run_attempt: workflowRunAttempt,
|
workflow_run_attempt: workflowRunAttempt,
|
||||||
workflow_run_id: workflowRunID,
|
workflow_run_id: workflowRunID,
|
||||||
};
|
};
|
||||||
|
if (diskInfo) {
|
||||||
|
statusReport.runner_available_disk_space_bytes = diskInfo.numAvailableBytes;
|
||||||
|
statusReport.runner_total_disk_space_bytes = diskInfo.numTotalBytes;
|
||||||
|
}
|
||||||
// Add optional parameters
|
// Add optional parameters
|
||||||
if (cause) {
|
if (cause) {
|
||||||
statusReport.cause = cause;
|
statusReport.cause = cause;
|
||||||
@@ -141,6 +164,7 @@ const INCOMPATIBLE_MSG = "CodeQL Action version is incompatible with the code sc
|
|||||||
* Returns whether sending the status report was successful of not.
|
* Returns whether sending the status report was successful of not.
|
||||||
*/
|
*/
|
||||||
async function sendStatusReport(statusReport) {
|
async function sendStatusReport(statusReport) {
|
||||||
|
setJobStatusIfUnsuccessful(statusReport.status);
|
||||||
const statusReportJSON = JSON.stringify(statusReport);
|
const statusReportJSON = JSON.stringify(statusReport);
|
||||||
core.debug(`Sending status report: ${statusReportJSON}`);
|
core.debug(`Sending status report: ${statusReportJSON}`);
|
||||||
// If in test mode we don't want to upload the results
|
// If in test mode we don't want to upload the results
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
33
lib/testing-utils.js
generated
33
lib/testing-utils.js
generated
@@ -26,14 +26,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.mockBundleDownloadApi = exports.createFeatures = exports.mockCodeQLVersion = exports.makeVersionInfo = exports.mockLanguagesInRepo = exports.mockFeatureFlagApiEndpoint = exports.getRecordingLogger = exports.setupActionsVars = exports.setupTests = exports.SAMPLE_DEFAULT_CLI_VERSION = exports.SAMPLE_DOTCOM_API_DETAILS = void 0;
|
exports.createTestConfig = exports.mockBundleDownloadApi = exports.createFeatures = exports.mockCodeQLVersion = exports.makeVersionInfo = exports.mockLanguagesInRepo = exports.mockFeatureFlagApiEndpoint = exports.getRecordingLogger = exports.setupActionsVars = exports.setupTests = exports.SAMPLE_DEFAULT_CLI_VERSION = exports.SAMPLE_DOTCOM_API_DETAILS = void 0;
|
||||||
const node_util_1 = require("node:util");
|
const node_util_1 = require("node:util");
|
||||||
const path_1 = __importDefault(require("path"));
|
const path_1 = __importDefault(require("path"));
|
||||||
const github = __importStar(require("@actions/github"));
|
const github = __importStar(require("@actions/github"));
|
||||||
const nock_1 = __importDefault(require("nock"));
|
const nock_1 = __importDefault(require("nock"));
|
||||||
const sinon = __importStar(require("sinon"));
|
const sinon = __importStar(require("sinon"));
|
||||||
const apiClient = __importStar(require("./api-client"));
|
const apiClient = __importStar(require("./api-client"));
|
||||||
const CodeQL = __importStar(require("./codeql"));
|
const codeql = __importStar(require("./codeql"));
|
||||||
const util_1 = require("./util");
|
const util_1 = require("./util");
|
||||||
exports.SAMPLE_DOTCOM_API_DETAILS = {
|
exports.SAMPLE_DOTCOM_API_DETAILS = {
|
||||||
auth: "token",
|
auth: "token",
|
||||||
@@ -74,7 +74,7 @@ function setupTests(test) {
|
|||||||
typedTest.beforeEach((t) => {
|
typedTest.beforeEach((t) => {
|
||||||
// Set an empty CodeQL object so that all method calls will fail
|
// Set an empty CodeQL object so that all method calls will fail
|
||||||
// unless the test explicitly sets one up.
|
// unless the test explicitly sets one up.
|
||||||
CodeQL.setCodeQL({});
|
codeql.setCodeQL({});
|
||||||
// Replace stdout and stderr so we can record output during tests
|
// Replace stdout and stderr so we can record output during tests
|
||||||
t.context.testOutput = "";
|
t.context.testOutput = "";
|
||||||
const processStdoutWrite = process.stdout.write.bind(process.stdout);
|
const processStdoutWrite = process.stdout.write.bind(process.stdout);
|
||||||
@@ -196,11 +196,11 @@ const makeVersionInfo = (version, features) => ({
|
|||||||
});
|
});
|
||||||
exports.makeVersionInfo = makeVersionInfo;
|
exports.makeVersionInfo = makeVersionInfo;
|
||||||
function mockCodeQLVersion(version, features) {
|
function mockCodeQLVersion(version, features) {
|
||||||
return {
|
return codeql.setCodeQL({
|
||||||
async getVersion() {
|
async getVersion() {
|
||||||
return (0, exports.makeVersionInfo)(version, features);
|
return (0, exports.makeVersionInfo)(version, features);
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
exports.mockCodeQLVersion = mockCodeQLVersion;
|
exports.mockCodeQLVersion = mockCodeQLVersion;
|
||||||
/**
|
/**
|
||||||
@@ -241,4 +241,27 @@ function mockBundleDownloadApi({ apiDetails = exports.SAMPLE_DOTCOM_API_DETAILS,
|
|||||||
return `${baseUrl}${relativeUrl}`;
|
return `${baseUrl}${relativeUrl}`;
|
||||||
}
|
}
|
||||||
exports.mockBundleDownloadApi = mockBundleDownloadApi;
|
exports.mockBundleDownloadApi = mockBundleDownloadApi;
|
||||||
|
function createTestConfig(overrides) {
|
||||||
|
return Object.assign({}, {
|
||||||
|
languages: [],
|
||||||
|
buildMode: undefined,
|
||||||
|
originalUserInput: {},
|
||||||
|
tempDir: "",
|
||||||
|
codeQLCmd: "",
|
||||||
|
gitHubVersion: {
|
||||||
|
type: util_1.GitHubVariant.DOTCOM,
|
||||||
|
},
|
||||||
|
dbLocation: "",
|
||||||
|
debugMode: false,
|
||||||
|
debugArtifactName: util_1.DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: util_1.DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
|
augmentationProperties: {
|
||||||
|
packsInputCombines: false,
|
||||||
|
queriesInputCombines: false,
|
||||||
|
},
|
||||||
|
trapCaches: {},
|
||||||
|
trapCacheDownloadTime: 0,
|
||||||
|
}, overrides);
|
||||||
|
}
|
||||||
|
exports.createTestConfig = createTestConfig;
|
||||||
//# sourceMappingURL=testing-utils.js.map
|
//# sourceMappingURL=testing-utils.js.map
|
||||||
File diff suppressed because one or more lines are too long
1
lib/tools-features.js
generated
1
lib/tools-features.js
generated
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
exports.isSupportedToolsFeature = exports.ToolsFeature = void 0;
|
exports.isSupportedToolsFeature = exports.ToolsFeature = void 0;
|
||||||
var ToolsFeature;
|
var ToolsFeature;
|
||||||
(function (ToolsFeature) {
|
(function (ToolsFeature) {
|
||||||
|
ToolsFeature["BuildModeOption"] = "buildModeOption";
|
||||||
ToolsFeature["IndirectTracingSupportsStaticBinaries"] = "indirectTracingSupportsStaticBinaries";
|
ToolsFeature["IndirectTracingSupportsStaticBinaries"] = "indirectTracingSupportsStaticBinaries";
|
||||||
ToolsFeature["SetsCodeqlRunnerEnvVar"] = "setsCodeqlRunnerEnvVar";
|
ToolsFeature["SetsCodeqlRunnerEnvVar"] = "setsCodeqlRunnerEnvVar";
|
||||||
})(ToolsFeature || (exports.ToolsFeature = ToolsFeature = {}));
|
})(ToolsFeature || (exports.ToolsFeature = ToolsFeature = {}));
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"tools-features.js","sourceRoot":"","sources":["../src/tools-features.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,+FAA+E,CAAA;IAC/E,iEAAiD,CAAA;AACnD,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CACrC,WAAwB,EACxB,OAAqB;IAErB,OAAO,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AALD,0DAKC"}
|
{"version":3,"file":"tools-features.js","sourceRoot":"","sources":["../src/tools-features.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,mDAAmC,CAAA;IACnC,+FAA+E,CAAA;IAC/E,iEAAiD,CAAA;AACnD,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CACrC,WAAwB,EACxB,OAAqB;IAErB,OAAO,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AALD,0DAKC"}
|
||||||
4
lib/tracer-config.js
generated
4
lib/tracer-config.js
generated
@@ -59,7 +59,7 @@ async function getTracerConfigForCluster(config) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
exports.getTracerConfigForCluster = getTracerConfigForCluster;
|
exports.getTracerConfigForCluster = getTracerConfigForCluster;
|
||||||
async function getCombinedTracerConfig(versionInfo, config) {
|
async function getCombinedTracerConfig(codeql, config) {
|
||||||
// Abort if there are no traced languages as there's nothing to do
|
// Abort if there are no traced languages as there's nothing to do
|
||||||
const tracedLanguages = config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l));
|
const tracedLanguages = config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l));
|
||||||
if (tracedLanguages.length === 0) {
|
if (tracedLanguages.length === 0) {
|
||||||
@@ -68,7 +68,7 @@ async function getCombinedTracerConfig(versionInfo, config) {
|
|||||||
const mainTracerConfig = await getTracerConfigForCluster(config);
|
const mainTracerConfig = await getTracerConfigForCluster(config);
|
||||||
// If the CLI doesn't yet support setting the CODEQL_RUNNER environment variable to
|
// If the CLI doesn't yet support setting the CODEQL_RUNNER environment variable to
|
||||||
// the runner executable path, we set it here in the Action.
|
// the runner executable path, we set it here in the Action.
|
||||||
if (!(0, tools_features_1.isSupportedToolsFeature)(versionInfo, tools_features_1.ToolsFeature.SetsCodeqlRunnerEnvVar)) {
|
if (!(await codeql.supportsFeature(tools_features_1.ToolsFeature.SetsCodeqlRunnerEnvVar))) {
|
||||||
// On MacOS when System Integrity Protection is enabled, it's necessary to prefix
|
// On MacOS when System Integrity Protection is enabled, it's necessary to prefix
|
||||||
// the build command with the runner executable for indirect tracing, so we expose
|
// the build command with the runner executable for indirect tracing, so we expose
|
||||||
// it here via the CODEQL_RUNNER environment variable.
|
// it here via the CODEQL_RUNNER environment variable.
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"tracer-config.js","sourceRoot":"","sources":["../src/tracer-config.ts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F,CAAC;IACF,OAAO;QACL,GAAG,EAAE,mBAAmB;KACzB,CAAC;AACJ,CAAC;AAfD,8DAeC;AAEM,KAAK,UAAU,uBAAuB,CAC3C,MAAc,EACd,MAA0B;IAE1B,kEAAkE;IAClE,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,4BAAgB,EAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,gBAAgB,GAAG,MAAM,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAEjE,mFAAmF;IACnF,4DAA4D;IAC5D,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,eAAe,CAAC,6BAAY,CAAC,sBAAsB,CAAC,CAAC,EAAE,CAAC;QACzE,iFAAiF;QACjF,kFAAkF;QAClF,sDAAsD;QACtD,iFAAiF;QACjF,gCAAgC;QAChC,MAAM,aAAa,GACjB,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;QACzD,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,IAAI,CAC/C,gBAAgB,CAAC,GAAG,CAAC,aAAa,CAAC,EACnC,OAAO,EACP,gBAAgB,CAAC,GAAG,CAAC,iBAAiB,CAAC,EACvC,aAAa,CACd,CAAC;IACJ,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AA/BD,0DA+BC"}
|
||||||
26
lib/tracer-config.test.js
generated
26
lib/tracer-config.test.js
generated
@@ -29,34 +29,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const ava_1 = __importDefault(require("ava"));
|
const ava_1 = __importDefault(require("ava"));
|
||||||
const configUtils = __importStar(require("./config-utils"));
|
|
||||||
const languages_1 = require("./languages");
|
const languages_1 = require("./languages");
|
||||||
const testing_utils_1 = require("./testing-utils");
|
const testing_utils_1 = require("./testing-utils");
|
||||||
const tracer_config_1 = require("./tracer-config");
|
const tracer_config_1 = require("./tracer-config");
|
||||||
const util = __importStar(require("./util"));
|
const util = __importStar(require("./util"));
|
||||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||||
function getTestConfig(tmpDir) {
|
function getTestConfig(tempDir) {
|
||||||
return {
|
return (0, testing_utils_1.createTestConfig)({
|
||||||
languages: [languages_1.Language.java],
|
languages: [languages_1.Language.java],
|
||||||
originalUserInput: {},
|
tempDir,
|
||||||
tempDir: tmpDir,
|
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||||
codeQLCmd: "",
|
});
|
||||||
gitHubVersion: { type: util.GitHubVariant.DOTCOM },
|
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
|
||||||
debugMode: false,
|
|
||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: configUtils.defaultAugmentationProperties,
|
|
||||||
trapCaches: {},
|
|
||||||
trapCacheDownloadTime: 0,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
(0, ava_1.default)("getCombinedTracerConfig - return undefined when no languages are traced languages", async (t) => {
|
(0, ava_1.default)("getCombinedTracerConfig - return undefined when no languages are traced languages", async (t) => {
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
const config = getTestConfig(tmpDir);
|
const config = getTestConfig(tmpDir);
|
||||||
// No traced languages
|
// No traced languages
|
||||||
config.languages = [languages_1.Language.javascript, languages_1.Language.python];
|
config.languages = [languages_1.Language.javascript, languages_1.Language.python];
|
||||||
t.deepEqual(await (0, tracer_config_1.getCombinedTracerConfig)((0, testing_utils_1.makeVersionInfo)("1.0.0"), config), undefined);
|
t.deepEqual(await (0, tracer_config_1.getCombinedTracerConfig)((0, testing_utils_1.mockCodeQLVersion)("1.0.0"), config), undefined);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
(0, ava_1.default)("getCombinedTracerConfig - with start-tracing.json environment file", async (t) => {
|
(0, ava_1.default)("getCombinedTracerConfig - with start-tracing.json environment file", async (t) => {
|
||||||
@@ -77,7 +67,7 @@ function getTestConfig(tmpDir) {
|
|||||||
fs.mkdirSync(tracingEnvironmentDir, { recursive: true });
|
fs.mkdirSync(tracingEnvironmentDir, { recursive: true });
|
||||||
const startTracingJson = path.join(tracingEnvironmentDir, "start-tracing.json");
|
const startTracingJson = path.join(tracingEnvironmentDir, "start-tracing.json");
|
||||||
fs.writeFileSync(startTracingJson, JSON.stringify(startTracingEnv));
|
fs.writeFileSync(startTracingJson, JSON.stringify(startTracingEnv));
|
||||||
const result = await (0, tracer_config_1.getCombinedTracerConfig)((0, testing_utils_1.makeVersionInfo)("1.0.0"), config);
|
const result = await (0, tracer_config_1.getCombinedTracerConfig)((0, testing_utils_1.mockCodeQLVersion)("1.0.0"), config);
|
||||||
t.notDeepEqual(result, undefined);
|
t.notDeepEqual(result, undefined);
|
||||||
const expectedEnv = startTracingEnv;
|
const expectedEnv = startTracingEnv;
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
@@ -112,7 +102,7 @@ function getTestConfig(tmpDir) {
|
|||||||
fs.mkdirSync(tracingEnvironmentDir, { recursive: true });
|
fs.mkdirSync(tracingEnvironmentDir, { recursive: true });
|
||||||
const startTracingJson = path.join(tracingEnvironmentDir, "start-tracing.json");
|
const startTracingJson = path.join(tracingEnvironmentDir, "start-tracing.json");
|
||||||
fs.writeFileSync(startTracingJson, JSON.stringify(startTracingEnv));
|
fs.writeFileSync(startTracingJson, JSON.stringify(startTracingEnv));
|
||||||
const result = await (0, tracer_config_1.getCombinedTracerConfig)((0, testing_utils_1.makeVersionInfo)("1.0.0", { setsCodeqlRunnerEnvVar: true }), config);
|
const result = await (0, tracer_config_1.getCombinedTracerConfig)((0, testing_utils_1.mockCodeQLVersion)("1.0.0", { setsCodeqlRunnerEnvVar: true }), config);
|
||||||
t.notDeepEqual(result, undefined);
|
t.notDeepEqual(result, undefined);
|
||||||
t.false(Object.prototype.hasOwnProperty.call(result?.env, "CODEQL_RUNNER"));
|
t.false(Object.prototype.hasOwnProperty.call(result?.env, "CODEQL_RUNNER"));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"tracer-config.test.js","sourceRoot":"","sources":["../src/tracer-config.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,8CAAuB;AAEvB,4DAA8C;AAC9C,2CAAuC;AACvC,mDAA8D;AAC9D,mDAA0D;AAC1D,6CAA+B;AAE/B,IAAA,0BAAU,EAAC,aAAI,CAAC,CAAC;AAEjB,SAAS,aAAa,CAAC,MAAc;IACnC,OAAO;QACL,SAAS,EAAE,CAAC,oBAAQ,CAAC,IAAI,CAAC;QAC1B,iBAAiB,EAAE,EAAE;QACrB,OAAO,EAAE,MAAM;QACf,SAAS,EAAE,EAAE;QACb,aAAa,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAwB;QACxE,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,kBAAkB,CAAC;QACpD,SAAS,EAAE,KAAK;QAChB,iBAAiB,EAAE,IAAI,CAAC,2BAA2B;QACnD,iBAAiB,EAAE,IAAI,CAAC,2BAA2B;QACnD,sBAAsB,EAAE,WAAW,CAAC,6BAA6B;QACjE,UAAU,EAAE,EAAE;QACd,qBAAqB,EAAE,CAAC;KACzB,CAAC;AACJ,CAAC;AAED,IAAA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;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||||
44
lib/trap-caching.test.js
generated
44
lib/trap-caching.test.js
generated
@@ -78,48 +78,22 @@ const stubCodeql = (0, codeql_1.setCodeQL)({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const testConfigWithoutTmpDir = {
|
const testConfigWithoutTmpDir = (0, testing_utils_1.createTestConfig)({
|
||||||
languages: [languages_1.Language.javascript, languages_1.Language.cpp],
|
languages: [languages_1.Language.javascript, languages_1.Language.cpp],
|
||||||
originalUserInput: {},
|
|
||||||
tempDir: "",
|
|
||||||
codeQLCmd: "",
|
|
||||||
gitHubVersion: {
|
|
||||||
type: util.GitHubVariant.DOTCOM,
|
|
||||||
},
|
|
||||||
dbLocation: "",
|
|
||||||
debugMode: false,
|
|
||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: {
|
|
||||||
packsInputCombines: false,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
},
|
|
||||||
trapCaches: {
|
trapCaches: {
|
||||||
javascript: "/some/cache/dir",
|
javascript: "/some/cache/dir",
|
||||||
},
|
},
|
||||||
trapCacheDownloadTime: 0,
|
});
|
||||||
};
|
function getTestConfigWithTempDir(tempDir) {
|
||||||
function getTestConfigWithTempDir(tmpDir) {
|
return (0, testing_utils_1.createTestConfig)({
|
||||||
return {
|
|
||||||
languages: [languages_1.Language.javascript, languages_1.Language.ruby],
|
languages: [languages_1.Language.javascript, languages_1.Language.ruby],
|
||||||
originalUserInput: {},
|
tempDir,
|
||||||
tempDir: tmpDir,
|
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||||
codeQLCmd: "",
|
|
||||||
gitHubVersion: { type: util.GitHubVariant.DOTCOM },
|
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
|
||||||
debugMode: false,
|
|
||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: {
|
|
||||||
packsInputCombines: false,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
},
|
|
||||||
trapCaches: {
|
trapCaches: {
|
||||||
javascript: path.resolve(tmpDir, "jsCache"),
|
javascript: path.resolve(tempDir, "jsCache"),
|
||||||
ruby: path.resolve(tmpDir, "rubyCache"),
|
ruby: path.resolve(tempDir, "rubyCache"),
|
||||||
},
|
},
|
||||||
trapCacheDownloadTime: 0,
|
});
|
||||||
};
|
|
||||||
}
|
}
|
||||||
(0, ava_1.default)("check flags for JS, analyzing default branch", async (t) => {
|
(0, ava_1.default)("check flags for JS, analyzing default branch", async (t) => {
|
||||||
await util.withTmpDir(async (tmpDir) => {
|
await util.withTmpDir(async (tmpDir) => {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
38
lib/util.js
generated
38
lib/util.js
generated
@@ -789,23 +789,31 @@ function prettyPrintPack(pack) {
|
|||||||
}
|
}
|
||||||
exports.prettyPrintPack = prettyPrintPack;
|
exports.prettyPrintPack = prettyPrintPack;
|
||||||
async function checkDiskUsage(logger) {
|
async function checkDiskUsage(logger) {
|
||||||
const diskUsage = await (0, check_disk_space_1.default)(getRequiredEnvParam("GITHUB_WORKSPACE"));
|
try {
|
||||||
const gbInBytes = 1024 * 1024 * 1024;
|
const diskUsage = await (0, check_disk_space_1.default)(getRequiredEnvParam("GITHUB_WORKSPACE"));
|
||||||
if (logger && diskUsage.free < 2 * gbInBytes) {
|
const gbInBytes = 1024 * 1024 * 1024;
|
||||||
const message = "The Actions runner is running low on disk space " +
|
if (logger && diskUsage.free < 2 * gbInBytes) {
|
||||||
`(${(diskUsage.free / gbInBytes).toPrecision(4)} GB available).`;
|
const message = "The Actions runner is running low on disk space " +
|
||||||
if (process.env[environment_1.EnvVar.HAS_WARNED_ABOUT_DISK_SPACE] !== "true") {
|
`(${(diskUsage.free / gbInBytes).toPrecision(4)} GB available).`;
|
||||||
logger.warning(message);
|
if (process.env[environment_1.EnvVar.HAS_WARNED_ABOUT_DISK_SPACE] !== "true") {
|
||||||
|
logger.warning(message);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
logger.debug(message);
|
||||||
|
}
|
||||||
|
core.exportVariable(environment_1.EnvVar.HAS_WARNED_ABOUT_DISK_SPACE, "true");
|
||||||
}
|
}
|
||||||
else {
|
return {
|
||||||
logger.debug(message);
|
numAvailableBytes: diskUsage.free,
|
||||||
}
|
numTotalBytes: diskUsage.size,
|
||||||
core.exportVariable(environment_1.EnvVar.HAS_WARNED_ABOUT_DISK_SPACE, "true");
|
};
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
if (logger) {
|
||||||
|
logger.warning(`Failed to check available disk space: ${getErrorMessage(error)}`);
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
return {
|
|
||||||
numAvailableBytes: diskUsage.free,
|
|
||||||
numTotalBytes: diskUsage.size,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
exports.checkDiskUsage = checkDiskUsage;
|
exports.checkDiskUsage = checkDiskUsage;
|
||||||
/**
|
/**
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
98
node_modules/.package-lock.json
generated
vendored
98
node_modules/.package-lock.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "3.23.2",
|
"version": "3.24.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
@@ -955,21 +955,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/uuid": {
|
"node_modules/@types/uuid": {
|
||||||
"version": "9.0.7",
|
"version": "9.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz",
|
||||||
"integrity": "sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g=="
|
"integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.20.0.tgz",
|
||||||
"integrity": "sha512-roQScUGFruWod9CEyoV5KlCYrubC/fvG8/1zXuT0WTcxX87GnMMmnksMwSg99lo1xiKrBzw2icsJPMAw1OtKxg==",
|
"integrity": "sha512-fTwGQUnjhoYHeSF6m5pWNkzmDDdsKELYrOBxhjMrofPqCkoC2k3B2wvGHFxa1CTIqkEn88nlW1HVMztjo2K8Hg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/regexpp": "^4.5.1",
|
"@eslint-community/regexpp": "^4.5.1",
|
||||||
"@typescript-eslint/scope-manager": "6.19.1",
|
"@typescript-eslint/scope-manager": "6.20.0",
|
||||||
"@typescript-eslint/type-utils": "6.19.1",
|
"@typescript-eslint/type-utils": "6.20.0",
|
||||||
"@typescript-eslint/utils": "6.19.1",
|
"@typescript-eslint/utils": "6.20.0",
|
||||||
"@typescript-eslint/visitor-keys": "6.19.1",
|
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"graphemer": "^1.4.0",
|
"graphemer": "^1.4.0",
|
||||||
"ignore": "^5.2.4",
|
"ignore": "^5.2.4",
|
||||||
@@ -995,15 +995,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser": {
|
"node_modules/@typescript-eslint/parser": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz",
|
||||||
"integrity": "sha512-WEfX22ziAh6pRE9jnbkkLGp/4RhTpffr2ZK5bJ18M8mIfA8A+k97U9ZyaXCEJRlmMHh7R9MJZWXp/r73DzINVQ==",
|
"integrity": "sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "6.19.1",
|
"@typescript-eslint/scope-manager": "6.20.0",
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"@typescript-eslint/typescript-estree": "6.19.1",
|
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||||
"@typescript-eslint/visitor-keys": "6.19.1",
|
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||||
"debug": "^4.3.4"
|
"debug": "^4.3.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -1023,13 +1023,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/scope-manager": {
|
"node_modules/@typescript-eslint/scope-manager": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.20.0.tgz",
|
||||||
"integrity": "sha512-4CdXYjKf6/6aKNMSly/BP4iCSOpvMmqtDzRtqFyyAae3z5kkqEjKndR5vDHL8rSuMIIWP8u4Mw4VxLyxZW6D5w==",
|
"integrity": "sha512-p4rvHQRDTI1tGGMDFQm+GtxP1ZHyAh64WANVoyEcNMpaTFn3ox/3CcgtIlELnRfKzSs/DwYlDccJEtr3O6qBvA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"@typescript-eslint/visitor-keys": "6.19.1"
|
"@typescript-eslint/visitor-keys": "6.20.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^16.0.0 || >=18.0.0"
|
"node": "^16.0.0 || >=18.0.0"
|
||||||
@@ -1040,13 +1040,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/type-utils": {
|
"node_modules/@typescript-eslint/type-utils": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.20.0.tgz",
|
||||||
"integrity": "sha512-0vdyld3ecfxJuddDjACUvlAeYNrHP/pDeQk2pWBR2ESeEzQhg52DF53AbI9QCBkYE23lgkhLCZNkHn2hEXXYIg==",
|
"integrity": "sha512-qnSobiJQb1F5JjN0YDRPHruQTrX7ICsmltXhkV536mp4idGAYrIyr47zF/JmkJtEcAVnIz4gUYJ7gOZa6SmN4g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/typescript-estree": "6.19.1",
|
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||||
"@typescript-eslint/utils": "6.19.1",
|
"@typescript-eslint/utils": "6.20.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"ts-api-utils": "^1.0.1"
|
"ts-api-utils": "^1.0.1"
|
||||||
},
|
},
|
||||||
@@ -1067,9 +1067,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/types": {
|
"node_modules/@typescript-eslint/types": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz",
|
||||||
"integrity": "sha512-6+bk6FEtBhvfYvpHsDgAL3uo4BfvnTnoge5LrrCj2eJN8g3IJdLTD4B/jK3Q6vo4Ql/Hoip9I8aB6fF+6RfDqg==",
|
"integrity": "sha512-MM9mfZMAhiN4cOEcUOEx+0HmuaW3WBfukBZPCfwSqFnQy0grXYtngKCqpQN339X3RrwtzspWJrpbrupKYUSBXQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^16.0.0 || >=18.0.0"
|
"node": "^16.0.0 || >=18.0.0"
|
||||||
@@ -1080,13 +1080,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/typescript-estree": {
|
"node_modules/@typescript-eslint/typescript-estree": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.20.0.tgz",
|
||||||
"integrity": "sha512-aFdAxuhzBFRWhy+H20nYu19+Km+gFfwNO4TEqyszkMcgBDYQjmPJ61erHxuT2ESJXhlhrO7I5EFIlZ+qGR8oVA==",
|
"integrity": "sha512-RnRya9q5m6YYSpBN7IzKu9FmLcYtErkDkc8/dKv81I9QiLLtVBHrjz+Ev/crAqgMNW2FCsoZF4g2QUylMnJz+g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"@typescript-eslint/visitor-keys": "6.19.1",
|
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"globby": "^11.1.0",
|
"globby": "^11.1.0",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
@@ -1132,17 +1132,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/utils": {
|
"node_modules/@typescript-eslint/utils": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.20.0.tgz",
|
||||||
"integrity": "sha512-JvjfEZuP5WoMqwh9SPAPDSHSg9FBHHGhjPugSRxu5jMfjvBpq5/sGTD+9M9aQ5sh6iJ8AY/Kk/oUYVEMAPwi7w==",
|
"integrity": "sha512-/EKuw+kRu2vAqCoDwDCBtDRU6CTKbUmwwI7SH7AashZ+W+7o8eiyy6V2cdOqN49KsTcASWsC5QeghYuRDTyOOg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.4.0",
|
"@eslint-community/eslint-utils": "^4.4.0",
|
||||||
"@types/json-schema": "^7.0.12",
|
"@types/json-schema": "^7.0.12",
|
||||||
"@types/semver": "^7.5.0",
|
"@types/semver": "^7.5.0",
|
||||||
"@typescript-eslint/scope-manager": "6.19.1",
|
"@typescript-eslint/scope-manager": "6.20.0",
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"@typescript-eslint/typescript-estree": "6.19.1",
|
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||||
"semver": "^7.5.4"
|
"semver": "^7.5.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -1157,12 +1157,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/visitor-keys": {
|
"node_modules/@typescript-eslint/visitor-keys": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.20.0.tgz",
|
||||||
"integrity": "sha512-gkdtIO+xSO/SmI0W68DBg4u1KElmIUo3vXzgHyGPs6cxgB0sa3TlptRAAE0hUY1hM6FcDKEv7aIwiTGm76cXfQ==",
|
"integrity": "sha512-E8Cp98kRe4gKHjJD4NExXKz/zOJ1A2hhZc+IMVD6i7w4yjIvh6VyuRI0gRtxAsXtoC35uGMaQ9rjI2zJaXDEAw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"eslint-visitor-keys": "^3.4.1"
|
"eslint-visitor-keys": "^3.4.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -4564,9 +4564,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/nock": {
|
"node_modules/nock": {
|
||||||
"version": "13.5.0",
|
"version": "13.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/nock/-/nock-13.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/nock/-/nock-13.5.1.tgz",
|
||||||
"integrity": "sha512-9hc1eCS2HtOz+sE9W7JQw/tXJktg0zoPSu48s/pYe73e25JW9ywiowbqnUSd7iZPeVawLcVpPZeZS312fwSY+g==",
|
"integrity": "sha512-+s7b73fzj5KnxbKH4Oaqz07tQ8degcMilU4rrmnKvI//b0JMBU4wEXFQ8zqr+3+L4eWSfU3H/UoIVGUV0tue1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "^4.1.0",
|
"debug": "^4.1.0",
|
||||||
|
|||||||
2
node_modules/@types/uuid/README.md
generated
vendored
2
node_modules/@types/uuid/README.md
generated
vendored
@@ -8,7 +8,7 @@ This package contains type definitions for uuid (https://github.com/uuidjs/uuid)
|
|||||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uuid.
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uuid.
|
||||||
|
|
||||||
### Additional Details
|
### Additional Details
|
||||||
* Last updated: Tue, 07 Nov 2023 20:08:00 GMT
|
* Last updated: Thu, 25 Jan 2024 23:07:19 GMT
|
||||||
* Dependencies: none
|
* Dependencies: none
|
||||||
|
|
||||||
# Credits
|
# Credits
|
||||||
|
|||||||
2
node_modules/@types/uuid/index.d.mts
generated
vendored
2
node_modules/@types/uuid/index.d.mts
generated
vendored
@@ -8,3 +8,5 @@ export import version = uuid.version;
|
|||||||
export import validate = uuid.validate;
|
export import validate = uuid.validate;
|
||||||
export import stringify = uuid.stringify;
|
export import stringify = uuid.stringify;
|
||||||
export import parse = uuid.parse;
|
export import parse = uuid.parse;
|
||||||
|
export import V1Options = uuid.V1Options;
|
||||||
|
export import V4Options = uuid.V4Options;
|
||||||
|
|||||||
6
node_modules/@types/uuid/package.json
generated
vendored
6
node_modules/@types/uuid/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@types/uuid",
|
"name": "@types/uuid",
|
||||||
"version": "9.0.7",
|
"version": "9.0.8",
|
||||||
"description": "TypeScript definitions for uuid",
|
"description": "TypeScript definitions for uuid",
|
||||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uuid",
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uuid",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -49,6 +49,6 @@
|
|||||||
},
|
},
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"typesPublisherContentHash": "71fc550147b942c5824c8f2b1b9d6788b5342357a90b8f7d76e60260d05180c0",
|
"typesPublisherContentHash": "ee6ba7ad17fbbead7a508faf213a9ad0f49c12929e8c6b0f05fb35129bc72d61",
|
||||||
"typeScriptVersion": "4.5"
|
"typeScriptVersion": "4.6"
|
||||||
}
|
}
|
||||||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-methods-use-this.js
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-methods-use-this.js
generated
vendored
@@ -32,7 +32,7 @@ exports.default = (0, util_1.createRule)({
|
|||||||
},
|
},
|
||||||
ignoreOverrideMethods: {
|
ignoreOverrideMethods: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description: 'Ingore members marked with the `override` modifier',
|
description: 'Ignore members marked with the `override` modifier',
|
||||||
},
|
},
|
||||||
ignoreClassesThatImplementAnInterface: {
|
ignoreClassesThatImplementAnInterface: {
|
||||||
oneOf: [
|
oneOf: [
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ exports.default = (0, util_1.createRule)({
|
|||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
},
|
},
|
||||||
allowTypedFunctionExpressions: {
|
allowTypedFunctionExpressions: {
|
||||||
description: 'Whether to ignore type annotations on the variable of a function expresion.',
|
description: 'Whether to ignore type annotations on the variable of a function expression.',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
4
node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js
generated
vendored
4
node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js
generated
vendored
@@ -537,7 +537,9 @@ exports.default = (0, util_1.createRule)({
|
|||||||
},
|
},
|
||||||
defaultOptions: [
|
defaultOptions: [
|
||||||
{
|
{
|
||||||
default: exports.defaultOrder,
|
default: {
|
||||||
|
memberTypes: exports.defaultOrder,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
create(context, [options]) {
|
create(context, [options]) {
|
||||||
|
|||||||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js.map
generated
vendored
File diff suppressed because one or more lines are too long
27
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-useless-template-literals.js
generated
vendored
27
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-useless-template-literals.js
generated
vendored
@@ -57,6 +57,17 @@ exports.default = (0, util_1.createRule)({
|
|||||||
}
|
}
|
||||||
return isString(type);
|
return isString(type);
|
||||||
}
|
}
|
||||||
|
function isLiteral(expression) {
|
||||||
|
return expression.type === utils_1.AST_NODE_TYPES.Literal;
|
||||||
|
}
|
||||||
|
function isInfinityIdentifier(expression) {
|
||||||
|
return (expression.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||||
|
expression.name === 'Infinity');
|
||||||
|
}
|
||||||
|
function isNaNIdentifier(expression) {
|
||||||
|
return (expression.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||||
|
expression.name === 'NaN');
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
TemplateLiteral(node) {
|
TemplateLiteral(node) {
|
||||||
if (node.parent.type === utils_1.AST_NODE_TYPES.TaggedTemplateExpression) {
|
if (node.parent.type === utils_1.AST_NODE_TYPES.TaggedTemplateExpression) {
|
||||||
@@ -88,9 +99,11 @@ exports.default = (0, util_1.createRule)({
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const literalsOrUndefinedExpressions = node.expressions.filter((expression) => expression.type === utils_1.AST_NODE_TYPES.Literal ||
|
const fixableExpressions = node.expressions.filter((expression) => isLiteral(expression) ||
|
||||||
(0, util_1.isUndefinedIdentifier)(expression));
|
(0, util_1.isUndefinedIdentifier)(expression) ||
|
||||||
literalsOrUndefinedExpressions.forEach(expression => {
|
isInfinityIdentifier(expression) ||
|
||||||
|
isNaNIdentifier(expression));
|
||||||
|
fixableExpressions.forEach(expression => {
|
||||||
context.report({
|
context.report({
|
||||||
node: expression,
|
node: expression,
|
||||||
messageId: 'noUselessTemplateLiteral',
|
messageId: 'noUselessTemplateLiteral',
|
||||||
@@ -109,11 +122,9 @@ exports.default = (0, util_1.createRule)({
|
|||||||
nextQuasi.range[0] + 1,
|
nextQuasi.range[0] + 1,
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
// Remove quotes for string literals (i.e. `'a'` will become `a`).
|
const stringValue = (0, util_1.getStaticStringValue)(expression);
|
||||||
const isStringLiteral = isUnderlyingTypeString(expression) &&
|
if (stringValue != null) {
|
||||||
expression.type === utils_1.AST_NODE_TYPES.Literal;
|
const escapedValue = stringValue.replace(/([`$\\])/g, '\\$1');
|
||||||
if (isStringLiteral) {
|
|
||||||
const escapedValue = expression.value.replace(/([`$\\])/g, '\\$1');
|
|
||||||
fixes.push(fixer.replaceText(expression, escapedValue));
|
fixes.push(fixer.replaceText(expression, escapedValue));
|
||||||
}
|
}
|
||||||
return fixes;
|
return fixes;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"no-useless-template-literals.js","sourceRoot":"","sources":["../../src/rules/no-useless-template-literals.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAA0D;AAC1D,+CAAiC;AAEjC,kCAMiB;AAIjB,kBAAe,IAAA,iBAAU,EAAgB;IACvC,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAA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BACP,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;4BACnD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;4BACrC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;4BAEzC,uEAAuE;4BACvE,MAAM,KAAK,GAAG;gCACZ,KAAK,CAAC,WAAW,CAAC;oCAChB,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;oCACtB,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;iCACpB,CAAC;gCAEF,KAAK,CAAC,WAAW,CAAC;oCAChB,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;oCACnB,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;iCACvB,CAAC;6BACH,CAAC;4BAEF,kEAAkE;4BAClE,MAAM,eAAe,GACnB,sBAAsB,CAAC,UAAU,CAAC;gCAClC,UAAU,CAAC,IAAI,KAAK,sBAAc,CAAC,OAAO,CAAC;4BAE7C,IAAI,eAAe,EAAE,CAAC;gCACpB,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,CAC3C,WAAW,EACX,MAAM,CACP,CAAC;gCAEF,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC;4BAC1D,CAAC;4BAED,OAAO,KAAK,CAAC;wBACf,CAAC;qBACF,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
{"version":3,"file":"no-useless-template-literals.js","sourceRoot":"","sources":["../../src/rules/no-useless-template-literals.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAA0D;AAC1D,+CAAiC;AAEjC,kCAOiB;AAIjB,kBAAe,IAAA,iBAAU,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AW,EAAE,MAAM,CAAC,CAAC;gCAE9D,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC;4BAC1D,CAAC;4BAED,OAAO,KAAK,CAAC;wBACf,CAAC;qBACF,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||||
@@ -350,7 +350,7 @@ function verifyForAlways(context, prevNode, nextNode, paddingLines) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
}) || nextNode;
|
}) ?? nextNode;
|
||||||
const insertText = (0, util_1.isTokenOnSameLine)(prevToken, nextToken)
|
const insertText = (0, util_1.isTokenOnSameLine)(prevToken, nextToken)
|
||||||
? '\n\n'
|
? '\n\n'
|
||||||
: '\n';
|
: '\n';
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ exports.default = (0, util_1.createRule)({
|
|||||||
'LogicalExpression[operator = "||"]'(node) {
|
'LogicalExpression[operator = "||"]'(node) {
|
||||||
const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);
|
const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);
|
||||||
const type = checker.getTypeAtLocation(tsNode.left);
|
const type = checker.getTypeAtLocation(tsNode.left);
|
||||||
if (!(0, util_1.isNullableType)(type)) {
|
if (!(0, util_1.isTypeFlagSet)(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ignoreConditionalTests === true && isConditionalTest(node)) {
|
if (ignoreConditionalTests === true && isConditionalTest(node)) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-readonly.js
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-readonly.js
generated
vendored
@@ -211,7 +211,7 @@ class ClassScope {
|
|||||||
addDeclaredVariable(node) {
|
addDeclaredVariable(node) {
|
||||||
if (!(tsutils.isModifierFlagSet(node, ts.ModifierFlags.Private) ||
|
if (!(tsutils.isModifierFlagSet(node, ts.ModifierFlags.Private) ||
|
||||||
node.name.kind === ts.SyntaxKind.PrivateIdentifier) ||
|
node.name.kind === ts.SyntaxKind.PrivateIdentifier) ||
|
||||||
tsutils.isModifierFlagSet(node, ts.ModifierFlags.Readonly) ||
|
tsutils.isModifierFlagSet(node, ts.ModifierFlags.Accessor | ts.ModifierFlags.Readonly) ||
|
||||||
ts.isComputedPropertyName(node.name)) {
|
ts.isComputedPropertyName(node.name)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-readonly.js.map
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-readonly.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/@typescript-eslint/eslint-plugin/dist/rules/unified-signatures.js
generated
vendored
4
node_modules/@typescript-eslint/eslint-plugin/dist/rules/unified-signatures.js
generated
vendored
@@ -222,7 +222,7 @@ exports.default = (0, util_1.createRule)({
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return typeContainsTypeParameter(type.typeAnnotation ||
|
return typeContainsTypeParameter(type.typeAnnotation ??
|
||||||
type.elementType);
|
type.elementType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,7 +308,7 @@ exports.default = (0, util_1.createRule)({
|
|||||||
function addOverload(signature, key, containingNode) {
|
function addOverload(signature, key, containingNode) {
|
||||||
key ??= getOverloadKey(signature);
|
key ??= getOverloadKey(signature);
|
||||||
if (currentScope &&
|
if (currentScope &&
|
||||||
(containingNode || signature).parent === currentScope.parent) {
|
(containingNode ?? signature).parent === currentScope.parent) {
|
||||||
const overloads = currentScope.overloads.get(key);
|
const overloads = currentScope.overloads.get(key);
|
||||||
if (overloads !== undefined) {
|
if (overloads !== undefined) {
|
||||||
overloads.push(signature);
|
overloads.push(signature);
|
||||||
|
|||||||
333
node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md
generated
vendored
333
node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md
generated
vendored
@@ -25,7 +25,7 @@ type OrderConfig = MemberType[] | SortedOrderConfig | 'never';
|
|||||||
interface SortedOrderConfig {
|
interface SortedOrderConfig {
|
||||||
memberTypes?: MemberType[] | 'never';
|
memberTypes?: MemberType[] | 'never';
|
||||||
optionalityOrder?: 'optional-first' | 'required-first';
|
optionalityOrder?: 'optional-first' | 'required-first';
|
||||||
order:
|
order?:
|
||||||
| 'alphabetically'
|
| 'alphabetically'
|
||||||
| 'alphabetically-case-insensitive'
|
| 'alphabetically-case-insensitive'
|
||||||
| 'as-written'
|
| 'as-written'
|
||||||
@@ -80,176 +80,178 @@ The default configuration looks as follows:
|
|||||||
|
|
||||||
```jsonc
|
```jsonc
|
||||||
{
|
{
|
||||||
"default": [
|
"default": {
|
||||||
// Index signature
|
"memberTypes": [
|
||||||
"signature",
|
// Index signature
|
||||||
"call-signature",
|
"signature",
|
||||||
|
"call-signature",
|
||||||
|
|
||||||
// Fields
|
// Fields
|
||||||
"public-static-field",
|
"public-static-field",
|
||||||
"protected-static-field",
|
"protected-static-field",
|
||||||
"private-static-field",
|
"private-static-field",
|
||||||
"#private-static-field",
|
"#private-static-field",
|
||||||
|
|
||||||
"public-decorated-field",
|
"public-decorated-field",
|
||||||
"protected-decorated-field",
|
"protected-decorated-field",
|
||||||
"private-decorated-field",
|
"private-decorated-field",
|
||||||
|
|
||||||
"public-instance-field",
|
"public-instance-field",
|
||||||
"protected-instance-field",
|
"protected-instance-field",
|
||||||
"private-instance-field",
|
"private-instance-field",
|
||||||
"#private-instance-field",
|
"#private-instance-field",
|
||||||
|
|
||||||
"public-abstract-field",
|
"public-abstract-field",
|
||||||
"protected-abstract-field",
|
"protected-abstract-field",
|
||||||
|
|
||||||
"public-field",
|
"public-field",
|
||||||
"protected-field",
|
"protected-field",
|
||||||
"private-field",
|
"private-field",
|
||||||
"#private-field",
|
"#private-field",
|
||||||
|
|
||||||
"static-field",
|
"static-field",
|
||||||
"instance-field",
|
"instance-field",
|
||||||
"abstract-field",
|
"abstract-field",
|
||||||
|
|
||||||
"decorated-field",
|
"decorated-field",
|
||||||
|
|
||||||
"field",
|
"field",
|
||||||
|
|
||||||
// Static initialization
|
// Static initialization
|
||||||
"static-initialization",
|
"static-initialization",
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
"public-constructor",
|
"public-constructor",
|
||||||
"protected-constructor",
|
"protected-constructor",
|
||||||
"private-constructor",
|
"private-constructor",
|
||||||
|
|
||||||
"constructor",
|
"constructor",
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
"public-static-accessor",
|
"public-static-accessor",
|
||||||
"protected-static-accessor",
|
"protected-static-accessor",
|
||||||
"private-static-accessor",
|
"private-static-accessor",
|
||||||
"#private-static-accessor",
|
"#private-static-accessor",
|
||||||
|
|
||||||
"public-decorated-accessor",
|
"public-decorated-accessor",
|
||||||
"protected-decorated-accessor",
|
"protected-decorated-accessor",
|
||||||
"private-decorated-accessor",
|
"private-decorated-accessor",
|
||||||
|
|
||||||
"public-instance-accessor",
|
"public-instance-accessor",
|
||||||
"protected-instance-accessor",
|
"protected-instance-accessor",
|
||||||
"private-instance-accessor",
|
"private-instance-accessor",
|
||||||
"#private-instance-accessor",
|
"#private-instance-accessor",
|
||||||
|
|
||||||
"public-abstract-accessor",
|
"public-abstract-accessor",
|
||||||
"protected-abstract-accessor",
|
"protected-abstract-accessor",
|
||||||
|
|
||||||
"public-accessor",
|
"public-accessor",
|
||||||
"protected-accessor",
|
"protected-accessor",
|
||||||
"private-accessor",
|
"private-accessor",
|
||||||
"#private-accessor",
|
"#private-accessor",
|
||||||
|
|
||||||
"static-accessor",
|
"static-accessor",
|
||||||
"instance-accessor",
|
"instance-accessor",
|
||||||
"abstract-accessor",
|
"abstract-accessor",
|
||||||
|
|
||||||
"decorated-accessor",
|
"decorated-accessor",
|
||||||
|
|
||||||
"accessor",
|
"accessor",
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
"public-static-get",
|
"public-static-get",
|
||||||
"protected-static-get",
|
"protected-static-get",
|
||||||
"private-static-get",
|
"private-static-get",
|
||||||
"#private-static-get",
|
"#private-static-get",
|
||||||
|
|
||||||
"public-decorated-get",
|
"public-decorated-get",
|
||||||
"protected-decorated-get",
|
"protected-decorated-get",
|
||||||
"private-decorated-get",
|
"private-decorated-get",
|
||||||
|
|
||||||
"public-instance-get",
|
"public-instance-get",
|
||||||
"protected-instance-get",
|
"protected-instance-get",
|
||||||
"private-instance-get",
|
"private-instance-get",
|
||||||
"#private-instance-get",
|
"#private-instance-get",
|
||||||
|
|
||||||
"public-abstract-get",
|
"public-abstract-get",
|
||||||
"protected-abstract-get",
|
"protected-abstract-get",
|
||||||
|
|
||||||
"public-get",
|
"public-get",
|
||||||
"protected-get",
|
"protected-get",
|
||||||
"private-get",
|
"private-get",
|
||||||
"#private-get",
|
"#private-get",
|
||||||
|
|
||||||
"static-get",
|
"static-get",
|
||||||
"instance-get",
|
"instance-get",
|
||||||
"abstract-get",
|
"abstract-get",
|
||||||
|
|
||||||
"decorated-get",
|
"decorated-get",
|
||||||
|
|
||||||
"get",
|
"get",
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
"public-static-set",
|
"public-static-set",
|
||||||
"protected-static-set",
|
"protected-static-set",
|
||||||
"private-static-set",
|
"private-static-set",
|
||||||
"#private-static-set",
|
"#private-static-set",
|
||||||
|
|
||||||
"public-decorated-set",
|
"public-decorated-set",
|
||||||
"protected-decorated-set",
|
"protected-decorated-set",
|
||||||
"private-decorated-set",
|
"private-decorated-set",
|
||||||
|
|
||||||
"public-instance-set",
|
"public-instance-set",
|
||||||
"protected-instance-set",
|
"protected-instance-set",
|
||||||
"private-instance-set",
|
"private-instance-set",
|
||||||
"#private-instance-set",
|
"#private-instance-set",
|
||||||
|
|
||||||
"public-abstract-set",
|
"public-abstract-set",
|
||||||
"protected-abstract-set",
|
"protected-abstract-set",
|
||||||
|
|
||||||
"public-set",
|
"public-set",
|
||||||
"protected-set",
|
"protected-set",
|
||||||
"private-set",
|
"private-set",
|
||||||
"#private-set",
|
"#private-set",
|
||||||
|
|
||||||
"static-set",
|
"static-set",
|
||||||
"instance-set",
|
"instance-set",
|
||||||
"abstract-set",
|
"abstract-set",
|
||||||
|
|
||||||
"decorated-set",
|
"decorated-set",
|
||||||
|
|
||||||
"set",
|
"set",
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
"public-static-method",
|
"public-static-method",
|
||||||
"protected-static-method",
|
"protected-static-method",
|
||||||
"private-static-method",
|
"private-static-method",
|
||||||
"#private-static-method",
|
"#private-static-method",
|
||||||
|
|
||||||
"public-decorated-method",
|
"public-decorated-method",
|
||||||
"protected-decorated-method",
|
"protected-decorated-method",
|
||||||
"private-decorated-method",
|
"private-decorated-method",
|
||||||
|
|
||||||
"public-instance-method",
|
"public-instance-method",
|
||||||
"protected-instance-method",
|
"protected-instance-method",
|
||||||
"private-instance-method",
|
"private-instance-method",
|
||||||
"#private-instance-method",
|
"#private-instance-method",
|
||||||
|
|
||||||
"public-abstract-method",
|
"public-abstract-method",
|
||||||
"protected-abstract-method",
|
"protected-abstract-method",
|
||||||
|
|
||||||
"public-method",
|
"public-method",
|
||||||
"protected-method",
|
"protected-method",
|
||||||
"private-method",
|
"private-method",
|
||||||
"#private-method",
|
"#private-method",
|
||||||
|
|
||||||
"static-method",
|
"static-method",
|
||||||
"instance-method",
|
"instance-method",
|
||||||
"abstract-method",
|
"abstract-method",
|
||||||
|
|
||||||
"decorated-method",
|
"decorated-method",
|
||||||
|
|
||||||
"method"
|
"method"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -792,7 +794,8 @@ type Foo = {
|
|||||||
#### Sorting Alphabetically Within Member Groups
|
#### Sorting Alphabetically Within Member Groups
|
||||||
|
|
||||||
This config specifies that within each `memberTypes` group, members are in an alphabetic case-sensitive order.
|
This config specifies that within each `memberTypes` group, members are in an alphabetic case-sensitive order.
|
||||||
You can copy and paste the default order from [Default Configuration](#default-configuration).
|
The default member order will be applied if `memberTypes` is not specified.
|
||||||
|
You can see the default order in [Default Configuration](#default-configuration).
|
||||||
|
|
||||||
```jsonc
|
```jsonc
|
||||||
// .eslintrc.json
|
// .eslintrc.json
|
||||||
@@ -802,9 +805,6 @@ You can copy and paste the default order from [Default Configuration](#default-c
|
|||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"default": {
|
"default": {
|
||||||
"memberTypes": [
|
|
||||||
/* <Default Order> */
|
|
||||||
],
|
|
||||||
"order": "alphabetically"
|
"order": "alphabetically"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -817,7 +817,7 @@ You can copy and paste the default order from [Default Configuration](#default-c
|
|||||||
|
|
||||||
##### ❌ Incorrect
|
##### ❌ Incorrect
|
||||||
|
|
||||||
```ts option='{"default":{"memberTypes":["signature","call-signature","public-static-field","protected-static-field","private-static-field","#private-static-field","public-decorated-field","protected-decorated-field","private-decorated-field","public-instance-field","protected-instance-field","private-instance-field","#private-instance-field","public-abstract-field","protected-abstract-field","public-field","protected-field","private-field","#private-field","static-field","instance-field","abstract-field","decorated-field","field","static-initialization","public-constructor","protected-constructor","private-constructor","constructor","public-static-get","protected-static-get","private-static-get","#private-static-get","public-decorated-get","protected-decorated-get","private-decorated-get","public-instance-get","protected-instance-get","private-instance-get","#private-instance-get","public-abstract-get","protected-abstract-get","public-get","protected-get","private-get","#private-get","static-get","instance-get","abstract-get","decorated-get","get","public-static-set","protected-static-set","private-static-set","#private-static-set","public-decorated-set","protected-decorated-set","private-decorated-set","public-instance-set","protected-instance-set","private-instance-set","#private-instance-set","public-abstract-set","protected-abstract-set","public-set","protected-set","private-set","#private-set","static-set","instance-set","abstract-set","decorated-set","set","public-static-method","protected-static-method","private-static-method","#private-static-method","public-decorated-method","protected-decorated-method","private-decorated-method","public-instance-method","protected-instance-method","private-instance-method","#private-instance-method","public-abstract-method","protected-abstract-method","public-method","protected-method","private-method","#private-method","static-method","instance-method","abstract-method","decorated-method","method"],"order":"alphabetically"}}'
|
```ts option='{"default":{"order":"alphabetically"}}'
|
||||||
interface Foo {
|
interface Foo {
|
||||||
a: x;
|
a: x;
|
||||||
B: x;
|
B: x;
|
||||||
@@ -831,7 +831,7 @@ interface Foo {
|
|||||||
|
|
||||||
##### ✅ Correct
|
##### ✅ Correct
|
||||||
|
|
||||||
```ts option='{"default":{"memberTypes":["signature","call-signature","public-static-field","protected-static-field","private-static-field","#private-static-field","public-decorated-field","protected-decorated-field","private-decorated-field","public-instance-field","protected-instance-field","private-instance-field","#private-instance-field","public-abstract-field","protected-abstract-field","public-field","protected-field","private-field","#private-field","static-field","instance-field","abstract-field","decorated-field","field","static-initialization","public-constructor","protected-constructor","private-constructor","constructor","public-static-get","protected-static-get","private-static-get","#private-static-get","public-decorated-get","protected-decorated-get","private-decorated-get","public-instance-get","protected-instance-get","private-instance-get","#private-instance-get","public-abstract-get","protected-abstract-get","public-get","protected-get","private-get","#private-get","static-get","instance-get","abstract-get","decorated-get","get","public-static-set","protected-static-set","private-static-set","#private-static-set","public-decorated-set","protected-decorated-set","private-decorated-set","public-instance-set","protected-instance-set","private-instance-set","#private-instance-set","public-abstract-set","protected-abstract-set","public-set","protected-set","private-set","#private-set","static-set","instance-set","abstract-set","decorated-set","set","public-static-method","protected-static-method","private-static-method","#private-static-method","public-decorated-method","protected-decorated-method","private-decorated-method","public-instance-method","protected-instance-method","private-instance-method","#private-instance-method","public-abstract-method","protected-abstract-method","public-method","protected-method","private-method","#private-method","static-method","instance-method","abstract-method","decorated-method","method"],"order":"alphabetically"}}'
|
```ts option='{"default":{"order":"alphabetically"}}'
|
||||||
interface Foo {
|
interface Foo {
|
||||||
B: x;
|
B: x;
|
||||||
a: x;
|
a: x;
|
||||||
@@ -843,10 +843,62 @@ interface Foo {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Sorting Alphabetically Case Insensitive Within Member Groups
|
#### Sorting Alphabetically Within Custom Member Groups
|
||||||
|
|
||||||
This config specifies that within each `memberTypes` group, members are in an alphabetic case-insensitive order.
|
This config specifies that within each custom `memberTypes` group, members are in an alphabetic case-sensitive order.
|
||||||
You can copy and paste the default order from [Default Configuration](#default-configuration).
|
|
||||||
|
```jsonc
|
||||||
|
// .eslintrc.json
|
||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/member-ordering": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"default": {
|
||||||
|
"memberTypes": ["method", "field"],
|
||||||
|
"order": "alphabetically"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<!--tabs-->
|
||||||
|
|
||||||
|
##### ❌ Incorrect
|
||||||
|
|
||||||
|
```ts option='{"default":{"memberTypes":["method","field"],"order":"alphabetically"}}'
|
||||||
|
interface Foo {
|
||||||
|
B(): void;
|
||||||
|
c(): void;
|
||||||
|
a(): void;
|
||||||
|
|
||||||
|
a: x;
|
||||||
|
B: x;
|
||||||
|
c: x;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### ✅ Correct
|
||||||
|
|
||||||
|
```ts option='{"default":{"memberTypes":["method","field"],"order":"alphabetically"}}'
|
||||||
|
interface Foo {
|
||||||
|
B(): void;
|
||||||
|
a(): void;
|
||||||
|
c(): void;
|
||||||
|
|
||||||
|
B: x;
|
||||||
|
a: x;
|
||||||
|
c: x;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Sorting Alphabetically Case Insensitive Within Member Groups
|
||||||
|
|
||||||
|
This config specifies that within each `memberTypes` group, members are in an alphabetic case-insensitive order.
|
||||||
|
The default member order will be applied if `memberTypes` is not specified.
|
||||||
|
You can see the default order in [Default Configuration](#default-configuration).
|
||||||
|
|
||||||
```jsonc
|
```jsonc
|
||||||
// .eslintrc.json
|
// .eslintrc.json
|
||||||
@@ -856,9 +908,6 @@ You can copy and paste the default order from [Default Configuration](#default-c
|
|||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"default": {
|
"default": {
|
||||||
"memberTypes": [
|
|
||||||
/* <Default Order> */
|
|
||||||
],
|
|
||||||
"order": "alphabetically-case-insensitive"
|
"order": "alphabetically-case-insensitive"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -871,7 +920,7 @@ You can copy and paste the default order from [Default Configuration](#default-c
|
|||||||
|
|
||||||
##### ❌ Incorrect
|
##### ❌ Incorrect
|
||||||
|
|
||||||
```ts option='{"default":{"memberTypes":["signature","call-signature","public-static-field","protected-static-field","private-static-field","#private-static-field","public-decorated-field","protected-decorated-field","private-decorated-field","public-instance-field","protected-instance-field","private-instance-field","#private-instance-field","public-abstract-field","protected-abstract-field","public-field","protected-field","private-field","#private-field","static-field","instance-field","abstract-field","decorated-field","field","static-initialization","public-constructor","protected-constructor","private-constructor","constructor","public-static-get","protected-static-get","private-static-get","#private-static-get","public-decorated-get","protected-decorated-get","private-decorated-get","public-instance-get","protected-instance-get","private-instance-get","#private-instance-get","public-abstract-get","protected-abstract-get","public-get","protected-get","private-get","#private-get","static-get","instance-get","abstract-get","decorated-get","get","public-static-set","protected-static-set","private-static-set","#private-static-set","public-decorated-set","protected-decorated-set","private-decorated-set","public-instance-set","protected-instance-set","private-instance-set","#private-instance-set","public-abstract-set","protected-abstract-set","public-set","protected-set","private-set","#private-set","static-set","instance-set","abstract-set","decorated-set","set","public-static-method","protected-static-method","private-static-method","#private-static-method","public-decorated-method","protected-decorated-method","private-decorated-method","public-instance-method","protected-instance-method","private-instance-method","#private-instance-method","public-abstract-method","protected-abstract-method","public-method","protected-method","private-method","#private-method","static-method","instance-method","abstract-method","decorated-method","method"],"order":"alphabetically-case-insensitive"}}'
|
```ts option='{"default":{"order":"alphabetically-case-insensitive"}}'
|
||||||
interface Foo {
|
interface Foo {
|
||||||
B: x;
|
B: x;
|
||||||
a: x;
|
a: x;
|
||||||
@@ -885,7 +934,7 @@ interface Foo {
|
|||||||
|
|
||||||
##### ✅ Correct
|
##### ✅ Correct
|
||||||
|
|
||||||
```ts option='{"default":{"memberTypes":["signature","call-signature","public-static-field","protected-static-field","private-static-field","#private-static-field","public-decorated-field","protected-decorated-field","private-decorated-field","public-instance-field","protected-instance-field","private-instance-field","#private-instance-field","public-abstract-field","protected-abstract-field","public-field","protected-field","private-field","#private-field","static-field","instance-field","abstract-field","decorated-field","field","static-initialization","public-constructor","protected-constructor","private-constructor","constructor","public-static-get","protected-static-get","private-static-get","#private-static-get","public-decorated-get","protected-decorated-get","private-decorated-get","public-instance-get","protected-instance-get","private-instance-get","#private-instance-get","public-abstract-get","protected-abstract-get","public-get","protected-get","private-get","#private-get","static-get","instance-get","abstract-get","decorated-get","get","public-static-set","protected-static-set","private-static-set","#private-static-set","public-decorated-set","protected-decorated-set","private-decorated-set","public-instance-set","protected-instance-set","private-instance-set","#private-instance-set","public-abstract-set","protected-abstract-set","public-set","protected-set","private-set","#private-set","static-set","instance-set","abstract-set","decorated-set","set","public-static-method","protected-static-method","private-static-method","#private-static-method","public-decorated-method","protected-decorated-method","private-decorated-method","public-instance-method","protected-instance-method","private-instance-method","#private-instance-method","public-abstract-method","protected-abstract-method","public-method","protected-method","private-method","#private-method","static-method","instance-method","abstract-method","decorated-method","method"],"order":"alphabetically-case-insensitive"}}'
|
```ts option='{"default":{"order":"alphabetically-case-insensitive"}}'
|
||||||
interface Foo {
|
interface Foo {
|
||||||
a: x;
|
a: x;
|
||||||
B: x;
|
B: x;
|
||||||
|
|||||||
14
node_modules/@typescript-eslint/eslint-plugin/package.json
generated
vendored
14
node_modules/@typescript-eslint/eslint-plugin/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typescript-eslint/eslint-plugin",
|
"name": "@typescript-eslint/eslint-plugin",
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"description": "TypeScript plugin for ESLint",
|
"description": "TypeScript plugin for ESLint",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
@@ -57,10 +57,10 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/regexpp": "^4.5.1",
|
"@eslint-community/regexpp": "^4.5.1",
|
||||||
"@typescript-eslint/scope-manager": "6.19.1",
|
"@typescript-eslint/scope-manager": "6.20.0",
|
||||||
"@typescript-eslint/type-utils": "6.19.1",
|
"@typescript-eslint/type-utils": "6.20.0",
|
||||||
"@typescript-eslint/utils": "6.19.1",
|
"@typescript-eslint/utils": "6.20.0",
|
||||||
"@typescript-eslint/visitor-keys": "6.19.1",
|
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"graphemer": "^1.4.0",
|
"graphemer": "^1.4.0",
|
||||||
"ignore": "^5.2.4",
|
"ignore": "^5.2.4",
|
||||||
@@ -73,8 +73,8 @@
|
|||||||
"@types/debug": "*",
|
"@types/debug": "*",
|
||||||
"@types/marked": "*",
|
"@types/marked": "*",
|
||||||
"@types/natural-compare": "*",
|
"@types/natural-compare": "*",
|
||||||
"@typescript-eslint/rule-schema-to-typescript-types": "6.19.1",
|
"@typescript-eslint/rule-schema-to-typescript-types": "6.20.0",
|
||||||
"@typescript-eslint/rule-tester": "6.19.1",
|
"@typescript-eslint/rule-tester": "6.20.0",
|
||||||
"ajv": "^6.12.6",
|
"ajv": "^6.12.6",
|
||||||
"chalk": "^5.3.0",
|
"chalk": "^5.3.0",
|
||||||
"cross-fetch": "*",
|
"cross-fetch": "*",
|
||||||
|
|||||||
10
node_modules/@typescript-eslint/parser/package.json
generated
vendored
10
node_modules/@typescript-eslint/parser/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typescript-eslint/parser",
|
"name": "@typescript-eslint/parser",
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"description": "An ESLint custom parser which leverages TypeScript ESTree",
|
"description": "An ESLint custom parser which leverages TypeScript ESTree",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
@@ -51,10 +51,10 @@
|
|||||||
"eslint": "^7.0.0 || ^8.0.0"
|
"eslint": "^7.0.0 || ^8.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "6.19.1",
|
"@typescript-eslint/scope-manager": "6.20.0",
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"@typescript-eslint/typescript-estree": "6.19.1",
|
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||||
"@typescript-eslint/visitor-keys": "6.19.1",
|
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||||
"debug": "^4.3.4"
|
"debug": "^4.3.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
8
node_modules/@typescript-eslint/scope-manager/package.json
generated
vendored
8
node_modules/@typescript-eslint/scope-manager/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typescript-eslint/scope-manager",
|
"name": "@typescript-eslint/scope-manager",
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"description": "TypeScript scope analyser for ESLint",
|
"description": "TypeScript scope analyser for ESLint",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
@@ -44,13 +44,13 @@
|
|||||||
"typecheck": "npx nx typecheck"
|
"typecheck": "npx nx typecheck"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"@typescript-eslint/visitor-keys": "6.19.1"
|
"@typescript-eslint/visitor-keys": "6.20.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@prettier/sync": "*",
|
"@prettier/sync": "*",
|
||||||
"@types/glob": "*",
|
"@types/glob": "*",
|
||||||
"@typescript-eslint/typescript-estree": "6.19.1",
|
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||||
"glob": "*",
|
"glob": "*",
|
||||||
"jest-specific-snapshot": "*",
|
"jest-specific-snapshot": "*",
|
||||||
"make-dir": "*",
|
"make-dir": "*",
|
||||||
|
|||||||
8
node_modules/@typescript-eslint/type-utils/package.json
generated
vendored
8
node_modules/@typescript-eslint/type-utils/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typescript-eslint/type-utils",
|
"name": "@typescript-eslint/type-utils",
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"description": "Type utilities for working with TypeScript + ESLint together",
|
"description": "Type utilities for working with TypeScript + ESLint together",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
@@ -45,13 +45,13 @@
|
|||||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/typescript-estree": "6.19.1",
|
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||||
"@typescript-eslint/utils": "6.19.1",
|
"@typescript-eslint/utils": "6.20.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"ts-api-utils": "^1.0.1"
|
"ts-api-utils": "^1.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typescript-eslint/parser": "6.19.1",
|
"@typescript-eslint/parser": "6.20.0",
|
||||||
"ajv": "^6.10.0",
|
"ajv": "^6.10.0",
|
||||||
"downlevel-dts": "*",
|
"downlevel-dts": "*",
|
||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
|
|||||||
2
node_modules/@typescript-eslint/types/package.json
generated
vendored
2
node_modules/@typescript-eslint/types/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typescript-eslint/types",
|
"name": "@typescript-eslint/types",
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"description": "Types for the TypeScript-ESTree AST spec",
|
"description": "Types for the TypeScript-ESTree AST spec",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
|||||||
6
node_modules/@typescript-eslint/typescript-estree/package.json
generated
vendored
6
node_modules/@typescript-eslint/typescript-estree/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typescript-eslint/typescript-estree",
|
"name": "@typescript-eslint/typescript-estree",
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
|
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
@@ -52,8 +52,8 @@
|
|||||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"@typescript-eslint/visitor-keys": "6.19.1",
|
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"globby": "^11.1.0",
|
"globby": "^11.1.0",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
|
|||||||
10
node_modules/@typescript-eslint/utils/package.json
generated
vendored
10
node_modules/@typescript-eslint/utils/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typescript-eslint/utils",
|
"name": "@typescript-eslint/utils",
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"description": "Utilities for working with TypeScript + ESLint together",
|
"description": "Utilities for working with TypeScript + ESLint together",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
@@ -68,16 +68,16 @@
|
|||||||
"@eslint-community/eslint-utils": "^4.4.0",
|
"@eslint-community/eslint-utils": "^4.4.0",
|
||||||
"@types/json-schema": "^7.0.12",
|
"@types/json-schema": "^7.0.12",
|
||||||
"@types/semver": "^7.5.0",
|
"@types/semver": "^7.5.0",
|
||||||
"@typescript-eslint/scope-manager": "6.19.1",
|
"@typescript-eslint/scope-manager": "6.20.0",
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"@typescript-eslint/typescript-estree": "6.19.1",
|
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||||
"semver": "^7.5.4"
|
"semver": "^7.5.4"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"eslint": "^7.0.0 || ^8.0.0"
|
"eslint": "^7.0.0 || ^8.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typescript-eslint/parser": "6.19.1",
|
"@typescript-eslint/parser": "6.20.0",
|
||||||
"downlevel-dts": "*",
|
"downlevel-dts": "*",
|
||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^3.0.3",
|
||||||
|
|||||||
4
node_modules/@typescript-eslint/visitor-keys/package.json
generated
vendored
4
node_modules/@typescript-eslint/visitor-keys/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typescript-eslint/visitor-keys",
|
"name": "@typescript-eslint/visitor-keys",
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
|
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"eslint-visitor-keys": "^3.4.1"
|
"eslint-visitor-keys": "^3.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
6
node_modules/nock/README.md
generated
vendored
6
node_modules/nock/README.md
generated
vendored
@@ -66,6 +66,7 @@ For instance, if a module performs HTTP requests to a CouchDB server or makes HT
|
|||||||
- [.pendingMocks()](#pendingmocks)
|
- [.pendingMocks()](#pendingmocks)
|
||||||
- [.activeMocks()](#activemocks)
|
- [.activeMocks()](#activemocks)
|
||||||
- [.isActive()](#isactive)
|
- [.isActive()](#isactive)
|
||||||
|
- [.clone()](#clone)
|
||||||
- [Restoring](#restoring)
|
- [Restoring](#restoring)
|
||||||
- [Activating](#activating)
|
- [Activating](#activating)
|
||||||
- [Turning Nock Off (experimental!)](#turning-nock-off-experimental)
|
- [Turning Nock Off (experimental!)](#turning-nock-off-experimental)
|
||||||
@@ -89,6 +90,8 @@ For instance, if a module performs HTTP requests to a CouchDB server or makes HT
|
|||||||
- [Options](#options-1)
|
- [Options](#options-1)
|
||||||
- [Example](#example)
|
- [Example](#example)
|
||||||
- [Modes](#modes)
|
- [Modes](#modes)
|
||||||
|
- [Verifying recorded fixtures](#verifying-recorded-fixtures)
|
||||||
|
- [Example](#example-1)
|
||||||
- [Common issues](#common-issues)
|
- [Common issues](#common-issues)
|
||||||
- [Axios](#axios)
|
- [Axios](#axios)
|
||||||
- [Memory issues with Jest](#memory-issues-with-jest)
|
- [Memory issues with Jest](#memory-issues-with-jest)
|
||||||
@@ -1693,6 +1696,9 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/all-contri
|
|||||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Beretta1979"><img src="https://avatars.githubusercontent.com/u/10073962?v=4?s=100" width="100px;" alt="Sébastien Van Bruaene"/><br /><sub><b>Sébastien Van Bruaene</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=Beretta1979" title="Code">💻</a> <a href="https://github.com/nock/nock/commits?author=Beretta1979" title="Tests">⚠️</a></td>
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Beretta1979"><img src="https://avatars.githubusercontent.com/u/10073962?v=4?s=100" width="100px;" alt="Sébastien Van Bruaene"/><br /><sub><b>Sébastien Van Bruaene</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=Beretta1979" title="Code">💻</a> <a href="https://github.com/nock/nock/commits?author=Beretta1979" title="Tests">⚠️</a></td>
|
||||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Uzlopak"><img src="https://avatars.githubusercontent.com/u/5059100?v=4?s=100" width="100px;" alt="Aras Abbasi"/><br /><sub><b>Aras Abbasi</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=Uzlopak" title="Code">💻</a> <a href="https://github.com/nock/nock/commits?author=Uzlopak" title="Tests">⚠️</a> <a href="#maintenance-Uzlopak" title="Maintenance">🚧</a></td>
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Uzlopak"><img src="https://avatars.githubusercontent.com/u/5059100?v=4?s=100" width="100px;" alt="Aras Abbasi"/><br /><sub><b>Aras Abbasi</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=Uzlopak" title="Code">💻</a> <a href="https://github.com/nock/nock/commits?author=Uzlopak" title="Tests">⚠️</a> <a href="#maintenance-Uzlopak" title="Maintenance">🚧</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rsaryev"><img src="https://avatars.githubusercontent.com/u/70219513?v=4?s=100" width="100px;" alt="Saryev Rustam"/><br /><sub><b>Saryev Rustam</b></sub></a><br /><a href="https://github.com/nock/nock/commits?author=rsaryev" title="Code">💻</a> <a href="https://github.com/nock/nock/commits?author=rsaryev" title="Tests">⚠️</a></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
5
node_modules/nock/lib/common.js
generated
vendored
5
node_modules/nock/lib/common.js
generated
vendored
@@ -70,10 +70,7 @@ function overrideRequests(newRequest) {
|
|||||||
debug('- overriding request for', proto)
|
debug('- overriding request for', proto)
|
||||||
|
|
||||||
const moduleName = proto // 1 to 1 match of protocol and module is fortunate :)
|
const moduleName = proto // 1 to 1 match of protocol and module is fortunate :)
|
||||||
const module = {
|
const module = require(proto)
|
||||||
http: require('http'),
|
|
||||||
https: require('https'),
|
|
||||||
}[moduleName]
|
|
||||||
const overriddenRequest = module.request
|
const overriddenRequest = module.request
|
||||||
const overriddenGet = module.get
|
const overriddenGet = module.get
|
||||||
|
|
||||||
|
|||||||
4
node_modules/nock/lib/intercept.js
generated
vendored
4
node_modules/nock/lib/intercept.js
generated
vendored
@@ -370,8 +370,6 @@ function activate() {
|
|||||||
throw new Error('Nock already active')
|
throw new Error('Nock already active')
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideClientRequest()
|
|
||||||
|
|
||||||
// ----- Overriding http.request and https.request:
|
// ----- Overriding http.request and https.request:
|
||||||
|
|
||||||
common.overrideRequests(function (proto, overriddenRequest, args) {
|
common.overrideRequests(function (proto, overriddenRequest, args) {
|
||||||
@@ -435,6 +433,8 @@ function activate() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
overrideClientRequest()
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
6
node_modules/nock/package.json
generated
vendored
6
node_modules/nock/package.json
generated
vendored
@@ -7,7 +7,7 @@
|
|||||||
"testing",
|
"testing",
|
||||||
"isolation"
|
"isolation"
|
||||||
],
|
],
|
||||||
"version": "13.5.0",
|
"version": "13.5.1",
|
||||||
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
|
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
"eslint-plugin-promise": "^6.0.0",
|
"eslint-plugin-promise": "^6.0.0",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"got": "^11.3.0",
|
"got": "^11.3.0",
|
||||||
|
"jest": "^29.7.0",
|
||||||
"mocha": "^9.1.3",
|
"mocha": "^9.1.3",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"nyc": "^15.0.0",
|
"nyc": "^15.0.0",
|
||||||
@@ -60,7 +61,8 @@
|
|||||||
"lint:js:fix": "eslint --cache --cache-location './.cache/eslint' --fix '**/*.js'",
|
"lint:js:fix": "eslint --cache --cache-location './.cache/eslint' --fix '**/*.js'",
|
||||||
"lint:ts": "dtslint --expectOnly types",
|
"lint:ts": "dtslint --expectOnly types",
|
||||||
"test": "nyc --reporter=lcov --reporter=text mocha --recursive tests",
|
"test": "nyc --reporter=lcov --reporter=text mocha --recursive tests",
|
||||||
"test:coverage": "open coverage/lcov-report/index.html"
|
"test:coverage": "open coverage/lcov-report/index.html",
|
||||||
|
"test:jest": "jest tests_jest --detectLeaks"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
108
package-lock.json
generated
108
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "3.23.2",
|
"version": "3.24.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "3.23.2",
|
"version": "3.24.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/artifact": "^1.1.2",
|
"@actions/artifact": "^1.1.2",
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"@octokit/plugin-retry": "^5.0.2",
|
"@octokit/plugin-retry": "^5.0.2",
|
||||||
"@octokit/types": "^12.4.0",
|
"@octokit/types": "^12.4.0",
|
||||||
"@schemastore/package": "0.0.10",
|
"@schemastore/package": "0.0.10",
|
||||||
"@types/uuid": "^9.0.7",
|
"@types/uuid": "^9.0.8",
|
||||||
"adm-zip": "^0.5.10",
|
"adm-zip": "^0.5.10",
|
||||||
"check-disk-space": "^3.4.0",
|
"check-disk-space": "^3.4.0",
|
||||||
"console-log-level": "^1.4.1",
|
"console-log-level": "^1.4.1",
|
||||||
@@ -45,8 +45,8 @@
|
|||||||
"@types/node": "20.9.0",
|
"@types/node": "20.9.0",
|
||||||
"@types/semver": "^7.5.6",
|
"@types/semver": "^7.5.6",
|
||||||
"@types/sinon": "^17.0.3",
|
"@types/sinon": "^17.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
||||||
"@typescript-eslint/parser": "^6.19.1",
|
"@typescript-eslint/parser": "^6.20.0",
|
||||||
"ava": "^5.3.1",
|
"ava": "^5.3.1",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
"eslint-import-resolver-typescript": "^3.6.1",
|
"eslint-import-resolver-typescript": "^3.6.1",
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
"eslint-plugin-import": "^2.29.1",
|
"eslint-plugin-import": "^2.29.1",
|
||||||
"eslint-plugin-no-async-foreach": "^0.1.1",
|
"eslint-plugin-no-async-foreach": "^0.1.1",
|
||||||
"micromatch": "4.0.5",
|
"micromatch": "4.0.5",
|
||||||
"nock": "^13.5.0",
|
"nock": "^13.5.1",
|
||||||
"removeNPMAbsolutePaths": "3.0.1",
|
"removeNPMAbsolutePaths": "3.0.1",
|
||||||
"sinon": "^17.0.1",
|
"sinon": "^17.0.1",
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.3.3"
|
||||||
@@ -1012,21 +1012,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/uuid": {
|
"node_modules/@types/uuid": {
|
||||||
"version": "9.0.7",
|
"version": "9.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz",
|
||||||
"integrity": "sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g=="
|
"integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.20.0.tgz",
|
||||||
"integrity": "sha512-roQScUGFruWod9CEyoV5KlCYrubC/fvG8/1zXuT0WTcxX87GnMMmnksMwSg99lo1xiKrBzw2icsJPMAw1OtKxg==",
|
"integrity": "sha512-fTwGQUnjhoYHeSF6m5pWNkzmDDdsKELYrOBxhjMrofPqCkoC2k3B2wvGHFxa1CTIqkEn88nlW1HVMztjo2K8Hg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/regexpp": "^4.5.1",
|
"@eslint-community/regexpp": "^4.5.1",
|
||||||
"@typescript-eslint/scope-manager": "6.19.1",
|
"@typescript-eslint/scope-manager": "6.20.0",
|
||||||
"@typescript-eslint/type-utils": "6.19.1",
|
"@typescript-eslint/type-utils": "6.20.0",
|
||||||
"@typescript-eslint/utils": "6.19.1",
|
"@typescript-eslint/utils": "6.20.0",
|
||||||
"@typescript-eslint/visitor-keys": "6.19.1",
|
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"graphemer": "^1.4.0",
|
"graphemer": "^1.4.0",
|
||||||
"ignore": "^5.2.4",
|
"ignore": "^5.2.4",
|
||||||
@@ -1052,15 +1052,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser": {
|
"node_modules/@typescript-eslint/parser": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz",
|
||||||
"integrity": "sha512-WEfX22ziAh6pRE9jnbkkLGp/4RhTpffr2ZK5bJ18M8mIfA8A+k97U9ZyaXCEJRlmMHh7R9MJZWXp/r73DzINVQ==",
|
"integrity": "sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "6.19.1",
|
"@typescript-eslint/scope-manager": "6.20.0",
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"@typescript-eslint/typescript-estree": "6.19.1",
|
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||||
"@typescript-eslint/visitor-keys": "6.19.1",
|
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||||
"debug": "^4.3.4"
|
"debug": "^4.3.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -1080,13 +1080,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/scope-manager": {
|
"node_modules/@typescript-eslint/scope-manager": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.20.0.tgz",
|
||||||
"integrity": "sha512-4CdXYjKf6/6aKNMSly/BP4iCSOpvMmqtDzRtqFyyAae3z5kkqEjKndR5vDHL8rSuMIIWP8u4Mw4VxLyxZW6D5w==",
|
"integrity": "sha512-p4rvHQRDTI1tGGMDFQm+GtxP1ZHyAh64WANVoyEcNMpaTFn3ox/3CcgtIlELnRfKzSs/DwYlDccJEtr3O6qBvA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"@typescript-eslint/visitor-keys": "6.19.1"
|
"@typescript-eslint/visitor-keys": "6.20.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^16.0.0 || >=18.0.0"
|
"node": "^16.0.0 || >=18.0.0"
|
||||||
@@ -1097,13 +1097,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/type-utils": {
|
"node_modules/@typescript-eslint/type-utils": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.20.0.tgz",
|
||||||
"integrity": "sha512-0vdyld3ecfxJuddDjACUvlAeYNrHP/pDeQk2pWBR2ESeEzQhg52DF53AbI9QCBkYE23lgkhLCZNkHn2hEXXYIg==",
|
"integrity": "sha512-qnSobiJQb1F5JjN0YDRPHruQTrX7ICsmltXhkV536mp4idGAYrIyr47zF/JmkJtEcAVnIz4gUYJ7gOZa6SmN4g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/typescript-estree": "6.19.1",
|
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||||
"@typescript-eslint/utils": "6.19.1",
|
"@typescript-eslint/utils": "6.20.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"ts-api-utils": "^1.0.1"
|
"ts-api-utils": "^1.0.1"
|
||||||
},
|
},
|
||||||
@@ -1124,9 +1124,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/types": {
|
"node_modules/@typescript-eslint/types": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz",
|
||||||
"integrity": "sha512-6+bk6FEtBhvfYvpHsDgAL3uo4BfvnTnoge5LrrCj2eJN8g3IJdLTD4B/jK3Q6vo4Ql/Hoip9I8aB6fF+6RfDqg==",
|
"integrity": "sha512-MM9mfZMAhiN4cOEcUOEx+0HmuaW3WBfukBZPCfwSqFnQy0grXYtngKCqpQN339X3RrwtzspWJrpbrupKYUSBXQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^16.0.0 || >=18.0.0"
|
"node": "^16.0.0 || >=18.0.0"
|
||||||
@@ -1137,13 +1137,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/typescript-estree": {
|
"node_modules/@typescript-eslint/typescript-estree": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.20.0.tgz",
|
||||||
"integrity": "sha512-aFdAxuhzBFRWhy+H20nYu19+Km+gFfwNO4TEqyszkMcgBDYQjmPJ61erHxuT2ESJXhlhrO7I5EFIlZ+qGR8oVA==",
|
"integrity": "sha512-RnRya9q5m6YYSpBN7IzKu9FmLcYtErkDkc8/dKv81I9QiLLtVBHrjz+Ev/crAqgMNW2FCsoZF4g2QUylMnJz+g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"@typescript-eslint/visitor-keys": "6.19.1",
|
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"globby": "^11.1.0",
|
"globby": "^11.1.0",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
@@ -1189,17 +1189,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/utils": {
|
"node_modules/@typescript-eslint/utils": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.20.0.tgz",
|
||||||
"integrity": "sha512-JvjfEZuP5WoMqwh9SPAPDSHSg9FBHHGhjPugSRxu5jMfjvBpq5/sGTD+9M9aQ5sh6iJ8AY/Kk/oUYVEMAPwi7w==",
|
"integrity": "sha512-/EKuw+kRu2vAqCoDwDCBtDRU6CTKbUmwwI7SH7AashZ+W+7o8eiyy6V2cdOqN49KsTcASWsC5QeghYuRDTyOOg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.4.0",
|
"@eslint-community/eslint-utils": "^4.4.0",
|
||||||
"@types/json-schema": "^7.0.12",
|
"@types/json-schema": "^7.0.12",
|
||||||
"@types/semver": "^7.5.0",
|
"@types/semver": "^7.5.0",
|
||||||
"@typescript-eslint/scope-manager": "6.19.1",
|
"@typescript-eslint/scope-manager": "6.20.0",
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"@typescript-eslint/typescript-estree": "6.19.1",
|
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||||
"semver": "^7.5.4"
|
"semver": "^7.5.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -1214,12 +1214,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/visitor-keys": {
|
"node_modules/@typescript-eslint/visitor-keys": {
|
||||||
"version": "6.19.1",
|
"version": "6.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.20.0.tgz",
|
||||||
"integrity": "sha512-gkdtIO+xSO/SmI0W68DBg4u1KElmIUo3vXzgHyGPs6cxgB0sa3TlptRAAE0hUY1hM6FcDKEv7aIwiTGm76cXfQ==",
|
"integrity": "sha512-E8Cp98kRe4gKHjJD4NExXKz/zOJ1A2hhZc+IMVD6i7w4yjIvh6VyuRI0gRtxAsXtoC35uGMaQ9rjI2zJaXDEAw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "6.19.1",
|
"@typescript-eslint/types": "6.20.0",
|
||||||
"eslint-visitor-keys": "^3.4.1"
|
"eslint-visitor-keys": "^3.4.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -4621,9 +4621,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/nock": {
|
"node_modules/nock": {
|
||||||
"version": "13.5.0",
|
"version": "13.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/nock/-/nock-13.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/nock/-/nock-13.5.1.tgz",
|
||||||
"integrity": "sha512-9hc1eCS2HtOz+sE9W7JQw/tXJktg0zoPSu48s/pYe73e25JW9ywiowbqnUSd7iZPeVawLcVpPZeZS312fwSY+g==",
|
"integrity": "sha512-+s7b73fzj5KnxbKH4Oaqz07tQ8degcMilU4rrmnKvI//b0JMBU4wEXFQ8zqr+3+L4eWSfU3H/UoIVGUV0tue1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "^4.1.0",
|
"debug": "^4.1.0",
|
||||||
|
|||||||
10
package.json
10
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "codeql",
|
"name": "codeql",
|
||||||
"version": "3.23.2",
|
"version": "3.24.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "CodeQL action",
|
"description": "CodeQL action",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
"@octokit/plugin-retry": "^5.0.2",
|
"@octokit/plugin-retry": "^5.0.2",
|
||||||
"@octokit/types": "^12.4.0",
|
"@octokit/types": "^12.4.0",
|
||||||
"@schemastore/package": "0.0.10",
|
"@schemastore/package": "0.0.10",
|
||||||
"@types/uuid": "^9.0.7",
|
"@types/uuid": "^9.0.8",
|
||||||
"adm-zip": "^0.5.10",
|
"adm-zip": "^0.5.10",
|
||||||
"check-disk-space": "^3.4.0",
|
"check-disk-space": "^3.4.0",
|
||||||
"console-log-level": "^1.4.1",
|
"console-log-level": "^1.4.1",
|
||||||
@@ -60,8 +60,8 @@
|
|||||||
"@types/node": "20.9.0",
|
"@types/node": "20.9.0",
|
||||||
"@types/semver": "^7.5.6",
|
"@types/semver": "^7.5.6",
|
||||||
"@types/sinon": "^17.0.3",
|
"@types/sinon": "^17.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
||||||
"@typescript-eslint/parser": "^6.19.1",
|
"@typescript-eslint/parser": "^6.20.0",
|
||||||
"ava": "^5.3.1",
|
"ava": "^5.3.1",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
"eslint-import-resolver-typescript": "^3.6.1",
|
"eslint-import-resolver-typescript": "^3.6.1",
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
"eslint-plugin-import": "^2.29.1",
|
"eslint-plugin-import": "^2.29.1",
|
||||||
"eslint-plugin-no-async-foreach": "^0.1.1",
|
"eslint-plugin-no-async-foreach": "^0.1.1",
|
||||||
"micromatch": "4.0.5",
|
"micromatch": "4.0.5",
|
||||||
"nock": "^13.5.0",
|
"nock": "^13.5.1",
|
||||||
"removeNPMAbsolutePaths": "3.0.1",
|
"removeNPMAbsolutePaths": "3.0.1",
|
||||||
"sinon": "^17.0.1",
|
"sinon": "^17.0.1",
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.3.3"
|
||||||
|
|||||||
24
pr-checks/checks/build-mode-none.yml
Normal file
24
pr-checks/checks/build-mode-none.yml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
name: "Build mode none"
|
||||||
|
description: "An end-to-end integration test of a Java repository built using 'build-mode: none'"
|
||||||
|
operatingSystems: ["ubuntu"]
|
||||||
|
versions: ["latest", "nightly-latest"]
|
||||||
|
steps:
|
||||||
|
- uses: ./../action/init
|
||||||
|
id: init
|
||||||
|
with:
|
||||||
|
build-mode: none
|
||||||
|
db-location: "${{ runner.temp }}/customDbLocation"
|
||||||
|
languages: java
|
||||||
|
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||||
|
|
||||||
|
- name: Validate database build mode
|
||||||
|
run: |
|
||||||
|
metadata_path="$RUNNER_TEMP/customDbLocation/java/codeql-database.yml"
|
||||||
|
build_mode=$(yq eval '.buildMode' "$metadata_path")
|
||||||
|
if [[ "$build_mode" != "none" ]]; then
|
||||||
|
echo "Expected build mode to be 'none' but was $build_mode"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- uses: ./../action/autobuild
|
||||||
|
- uses: ./../action/analyze
|
||||||
@@ -19,7 +19,7 @@ class ActionDeclaration extends File {
|
|||||||
getRelativePath().matches("%/action.yml")
|
getRelativePath().matches("%/action.yml")
|
||||||
}
|
}
|
||||||
|
|
||||||
YAMLDocument getRootNode() {
|
YamlDocument getRootNode() {
|
||||||
result.getFile() = this
|
result.getFile() = this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ class ActionDeclaration extends File {
|
|||||||
* The name of any input to this action.
|
* The name of any input to this action.
|
||||||
*/
|
*/
|
||||||
string getAnInput() {
|
string getAnInput() {
|
||||||
result = getRootNode().(YAMLMapping).lookup("inputs").(YAMLMapping).getKey(_).(YAMLString).getValue()
|
result = getRootNode().(YamlMapping).lookup("inputs").(YamlMapping).getKey(_).(YamlString).getValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,21 +35,10 @@ class ActionDeclaration extends File {
|
|||||||
* or because it has a default value.
|
* or because it has a default value.
|
||||||
*/
|
*/
|
||||||
predicate inputAlwaysHasValue(string input) {
|
predicate inputAlwaysHasValue(string input) {
|
||||||
exists(YAMLMapping value |
|
exists(YamlMapping value |
|
||||||
value = getRootNode().(YAMLMapping).lookup("inputs").(YAMLMapping).lookup(input) and
|
value = getRootNode().(YamlMapping).lookup("inputs").(YamlMapping).lookup(input) and
|
||||||
(exists(value.lookup("default")) or
|
(exists(value.lookup("default")) or
|
||||||
value.lookup("required").(YAMLBool).getBoolValue() = true))
|
value.lookup("required").(YamlBool).getBoolValue() = true))
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The function that is the entrypoint to this action.
|
|
||||||
*/
|
|
||||||
FunctionDeclStmt getEntrypoint() {
|
|
||||||
result.getFile().getRelativePath() = getRootNode().
|
|
||||||
(YAMLMapping).lookup("runs").
|
|
||||||
(YAMLMapping).lookup("main").
|
|
||||||
(YAMLString).getValue().regexpReplaceAll("\\.\\./lib/(.*)\\.js", "src/$1.ts") and
|
|
||||||
result.getName() = "run"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class ActionDeclaration extends File {
|
|||||||
result = getRelativePath().regexpCapture("(.*)/action.yml", 1)
|
result = getRelativePath().regexpCapture("(.*)/action.yml", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
YAMLDocument getRootNode() {
|
YamlDocument getRootNode() {
|
||||||
result.getFile() = this
|
result.getFile() = this
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ class ActionDeclaration extends File {
|
|||||||
* The name of any input to this action.
|
* The name of any input to this action.
|
||||||
*/
|
*/
|
||||||
string getAnInput() {
|
string getAnInput() {
|
||||||
result = getRootNode().(YAMLMapping).lookup("inputs").(YAMLMapping).getKey(_).(YAMLString).getValue()
|
result = getRootNode().(YamlMapping).lookup("inputs").(YamlMapping).getKey(_).(YamlString).getValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,9 +40,9 @@ class ActionDeclaration extends File {
|
|||||||
*/
|
*/
|
||||||
FunctionDeclStmt getEntrypoint() {
|
FunctionDeclStmt getEntrypoint() {
|
||||||
result.getFile().getRelativePath() = getRootNode().
|
result.getFile().getRelativePath() = getRootNode().
|
||||||
(YAMLMapping).lookup("runs").
|
(YamlMapping).lookup("runs").
|
||||||
(YAMLMapping).lookup("main").
|
(YamlMapping).lookup("main").
|
||||||
(YAMLString).getValue().regexpReplaceAll("\\.\\./lib/(.*)\\.js", "src/$1.ts") and
|
(YamlString).getValue().regexpReplaceAll("\\.\\./lib/(.*)\\.js", "src/$1.ts") and
|
||||||
result.getName() = "run"
|
result.getName() = "run"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,15 @@ import * as sinon from "sinon";
|
|||||||
|
|
||||||
import { runQueries } from "./analyze";
|
import { runQueries } from "./analyze";
|
||||||
import { setCodeQL } from "./codeql";
|
import { setCodeQL } from "./codeql";
|
||||||
import { Config } from "./config-utils";
|
|
||||||
import { Feature } from "./feature-flags";
|
import { Feature } from "./feature-flags";
|
||||||
import { Language } from "./languages";
|
import { Language } from "./languages";
|
||||||
import { getRunnerLogger } from "./logging";
|
import { getRunnerLogger } from "./logging";
|
||||||
import { setupTests, setupActionsVars, createFeatures } from "./testing-utils";
|
import {
|
||||||
|
setupTests,
|
||||||
|
setupActionsVars,
|
||||||
|
createFeatures,
|
||||||
|
createTestConfig,
|
||||||
|
} from "./testing-utils";
|
||||||
import * as uploadLib from "./upload-lib";
|
import * as uploadLib from "./upload-lib";
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
|
|
||||||
@@ -82,25 +86,11 @@ test("status report fields", async (t) => {
|
|||||||
databasePrintBaseline: async () => "",
|
databasePrintBaseline: async () => "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const config: Config = {
|
const config = createTestConfig({
|
||||||
languages: [language],
|
languages: [language],
|
||||||
originalUserInput: {},
|
|
||||||
tempDir: tmpDir,
|
tempDir: tmpDir,
|
||||||
codeQLCmd: "",
|
|
||||||
gitHubVersion: {
|
|
||||||
type: util.GitHubVariant.DOTCOM,
|
|
||||||
} as util.GitHubVersion,
|
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||||
debugMode: false,
|
});
|
||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: {
|
|
||||||
packsInputCombines: false,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
},
|
|
||||||
trapCaches: {},
|
|
||||||
trapCacheDownloadTime: 0,
|
|
||||||
};
|
|
||||||
fs.mkdirSync(util.getCodeQLDatabasePath(config, language), {
|
fs.mkdirSync(util.getCodeQLDatabasePath(config, language), {
|
||||||
recursive: true,
|
recursive: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
SAMPLE_DEFAULT_CLI_VERSION,
|
SAMPLE_DEFAULT_CLI_VERSION,
|
||||||
mockBundleDownloadApi,
|
mockBundleDownloadApi,
|
||||||
makeVersionInfo,
|
makeVersionInfo,
|
||||||
|
createTestConfig,
|
||||||
} from "./testing-utils";
|
} from "./testing-utils";
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
import { initializeEnvironment } from "./util";
|
import { initializeEnvironment } from "./util";
|
||||||
@@ -37,25 +38,9 @@ let stubConfig: Config;
|
|||||||
test.beforeEach(() => {
|
test.beforeEach(() => {
|
||||||
initializeEnvironment("1.2.3");
|
initializeEnvironment("1.2.3");
|
||||||
|
|
||||||
stubConfig = {
|
stubConfig = createTestConfig({
|
||||||
languages: [Language.cpp],
|
languages: [Language.cpp],
|
||||||
originalUserInput: {},
|
});
|
||||||
tempDir: "",
|
|
||||||
codeQLCmd: "",
|
|
||||||
gitHubVersion: {
|
|
||||||
type: util.GitHubVariant.DOTCOM,
|
|
||||||
} as util.GitHubVersion,
|
|
||||||
dbLocation: "",
|
|
||||||
debugMode: false,
|
|
||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: {
|
|
||||||
packsInputCombines: false,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
},
|
|
||||||
trapCaches: {},
|
|
||||||
trapCacheDownloadTime: 0,
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
async function installIntoToolcache({
|
async function installIntoToolcache({
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {
|
|||||||
import { isTracedLanguage, Language } from "./languages";
|
import { isTracedLanguage, Language } from "./languages";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
import * as setupCodeql from "./setup-codeql";
|
import * as setupCodeql from "./setup-codeql";
|
||||||
|
import { ToolsFeature, isSupportedToolsFeature } from "./tools-features";
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
import { wrapError } from "./util";
|
import { wrapError } from "./util";
|
||||||
|
|
||||||
@@ -90,6 +91,10 @@ export interface CodeQL {
|
|||||||
* Print version information about CodeQL.
|
* Print version information about CodeQL.
|
||||||
*/
|
*/
|
||||||
printVersion(): Promise<void>;
|
printVersion(): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Returns whether the CodeQL executable supports the specified feature.
|
||||||
|
*/
|
||||||
|
supportsFeature(feature: ToolsFeature): Promise<boolean>;
|
||||||
/**
|
/**
|
||||||
* Run 'codeql database init --db-cluster'.
|
* Run 'codeql database init --db-cluster'.
|
||||||
*/
|
*/
|
||||||
@@ -452,17 +457,17 @@ function resolveFunction<T>(
|
|||||||
export function setCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
|
export function setCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
|
||||||
cachedCodeQL = {
|
cachedCodeQL = {
|
||||||
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
|
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
|
||||||
getVersion: resolveFunction(
|
getVersion: resolveFunction(partialCodeql, "getVersion", async () => ({
|
||||||
partialCodeql,
|
version: "1.0.0",
|
||||||
"getVersion",
|
})),
|
||||||
() =>
|
|
||||||
new Promise((resolve) =>
|
|
||||||
resolve({
|
|
||||||
version: "1.0.0",
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
printVersion: resolveFunction(partialCodeql, "printVersion"),
|
printVersion: resolveFunction(partialCodeql, "printVersion"),
|
||||||
|
supportsFeature: resolveFunction(
|
||||||
|
partialCodeql,
|
||||||
|
"supportsFeature",
|
||||||
|
async (feature) =>
|
||||||
|
!!partialCodeql.getVersion &&
|
||||||
|
isSupportedToolsFeature(await partialCodeql.getVersion(), feature),
|
||||||
|
),
|
||||||
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
|
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
|
||||||
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
|
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
|
||||||
extractScannedLanguage: resolveFunction(
|
extractScannedLanguage: resolveFunction(
|
||||||
@@ -561,6 +566,9 @@ export async function getCodeQLForCmd(
|
|||||||
async printVersion() {
|
async printVersion() {
|
||||||
await runTool(cmd, ["version", "--format=json"]);
|
await runTool(cmd, ["version", "--format=json"]);
|
||||||
},
|
},
|
||||||
|
async supportsFeature(feature: ToolsFeature) {
|
||||||
|
return isSupportedToolsFeature(await this.getVersion(), feature);
|
||||||
|
},
|
||||||
async databaseInitCluster(
|
async databaseInitCluster(
|
||||||
config: Config,
|
config: Config,
|
||||||
sourceRoot: string,
|
sourceRoot: string,
|
||||||
@@ -589,6 +597,12 @@ export async function getCodeQLForCmd(
|
|||||||
extraArgs.push("--external-repository-token-stdin");
|
extraArgs.push("--external-repository-token-stdin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
config.buildMode !== undefined &&
|
||||||
|
(await this.supportsFeature(ToolsFeature.BuildModeOption))
|
||||||
|
) {
|
||||||
|
extraArgs.push(`--build-mode=${config.buildMode}`);
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
qlconfigFile !== undefined &&
|
qlconfigFile !== undefined &&
|
||||||
(await util.codeQlVersionAbove(this, CODEQL_VERSION_INIT_WITH_QLCONFIG))
|
(await util.codeQlVersionAbove(this, CODEQL_VERSION_INIT_WITH_QLCONFIG))
|
||||||
|
|||||||
@@ -7,7 +7,12 @@ import * as yaml from "js-yaml";
|
|||||||
import * as sinon from "sinon";
|
import * as sinon from "sinon";
|
||||||
|
|
||||||
import * as api from "./api-client";
|
import * as api from "./api-client";
|
||||||
import { getCachedCodeQL, PackDownloadOutput, setCodeQL } from "./codeql";
|
import {
|
||||||
|
CodeQL,
|
||||||
|
getCachedCodeQL,
|
||||||
|
PackDownloadOutput,
|
||||||
|
setCodeQL,
|
||||||
|
} from "./codeql";
|
||||||
import * as configUtils from "./config-utils";
|
import * as configUtils from "./config-utils";
|
||||||
import { Language } from "./languages";
|
import { Language } from "./languages";
|
||||||
import { getRunnerLogger } from "./logging";
|
import { getRunnerLogger } from "./logging";
|
||||||
@@ -26,15 +31,42 @@ import {
|
|||||||
|
|
||||||
setupTests(test);
|
setupTests(test);
|
||||||
|
|
||||||
const sampleApiDetails = {
|
const githubVersion = { type: GitHubVariant.DOTCOM } as GitHubVersion;
|
||||||
auth: "token",
|
|
||||||
externalRepoAuth: "token",
|
|
||||||
url: "https://github.example.com",
|
|
||||||
apiURL: undefined,
|
|
||||||
registriesAuthTokens: undefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
const gitHubVersion = { type: GitHubVariant.DOTCOM } as GitHubVersion;
|
function createTestInitConfigInputs(
|
||||||
|
overrides: Partial<configUtils.InitConfigInputs>,
|
||||||
|
): configUtils.InitConfigInputs {
|
||||||
|
return Object.assign(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
languagesInput: undefined,
|
||||||
|
queriesInput: undefined,
|
||||||
|
packsInput: undefined,
|
||||||
|
configFile: undefined,
|
||||||
|
dbLocation: undefined,
|
||||||
|
configInput: undefined,
|
||||||
|
buildModeInput: undefined,
|
||||||
|
trapCachingEnabled: false,
|
||||||
|
debugMode: false,
|
||||||
|
debugArtifactName: "",
|
||||||
|
debugDatabaseName: "",
|
||||||
|
repository: { owner: "github", repo: "example" },
|
||||||
|
tempDir: "",
|
||||||
|
codeql: {} as CodeQL,
|
||||||
|
workspacePath: "",
|
||||||
|
githubVersion,
|
||||||
|
apiDetails: {
|
||||||
|
auth: "token",
|
||||||
|
externalRepoAuth: "token",
|
||||||
|
url: "https://github.example.com",
|
||||||
|
apiURL: undefined,
|
||||||
|
registriesAuthTokens: undefined,
|
||||||
|
},
|
||||||
|
logger: getRunnerLogger(true),
|
||||||
|
},
|
||||||
|
overrides,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the filepath of the newly-created file
|
// Returns the filepath of the newly-created file
|
||||||
function createConfigFile(inputFileContents: string, tmpDir: string): string {
|
function createConfigFile(inputFileContents: string, tmpDir: string): string {
|
||||||
@@ -77,11 +109,11 @@ function mockListLanguages(languages: string[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test("load empty config", async (t) => {
|
test("load empty config", async (t) => {
|
||||||
return await withTmpDir(async (tmpDir) => {
|
return await withTmpDir(async (tempDir) => {
|
||||||
const logger = getRunnerLogger(true);
|
const logger = getRunnerLogger(true);
|
||||||
const languages = "javascript,python";
|
const languages = "javascript,python";
|
||||||
|
|
||||||
const codeQL = setCodeQL({
|
const codeql = setCodeQL({
|
||||||
async resolveQueries() {
|
async resolveQueries() {
|
||||||
return {
|
return {
|
||||||
byLanguage: {
|
byLanguage: {
|
||||||
@@ -98,51 +130,34 @@ test("load empty config", async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const config = await configUtils.initConfig(
|
const config = await configUtils.initConfig(
|
||||||
languages,
|
createTestInitConfigInputs({
|
||||||
undefined,
|
languagesInput: languages,
|
||||||
undefined,
|
repository: { owner: "github", repo: "example" },
|
||||||
undefined,
|
tempDir,
|
||||||
undefined,
|
codeql,
|
||||||
undefined,
|
logger,
|
||||||
false,
|
}),
|
||||||
false,
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
codeQL,
|
|
||||||
tmpDir,
|
|
||||||
gitHubVersion,
|
|
||||||
sampleApiDetails,
|
|
||||||
logger,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
t.deepEqual(
|
t.deepEqual(
|
||||||
config,
|
config,
|
||||||
await configUtils.getDefaultConfig(
|
await configUtils.getDefaultConfig(
|
||||||
languages,
|
createTestInitConfigInputs({
|
||||||
undefined,
|
languagesInput: languages,
|
||||||
undefined,
|
tempDir,
|
||||||
undefined,
|
codeql,
|
||||||
false,
|
logger,
|
||||||
false,
|
}),
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
codeQL,
|
|
||||||
gitHubVersion,
|
|
||||||
logger,
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("loading config saves config", async (t) => {
|
test("loading config saves config", async (t) => {
|
||||||
return await withTmpDir(async (tmpDir) => {
|
return await withTmpDir(async (tempDir) => {
|
||||||
const logger = getRunnerLogger(true);
|
const logger = getRunnerLogger(true);
|
||||||
|
|
||||||
const codeQL = setCodeQL({
|
const codeql = setCodeQL({
|
||||||
async resolveQueries() {
|
async resolveQueries() {
|
||||||
return {
|
return {
|
||||||
byLanguage: {
|
byLanguage: {
|
||||||
@@ -159,36 +174,26 @@ test("loading config saves config", async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Sanity check the saved config file does not already exist
|
// Sanity check the saved config file does not already exist
|
||||||
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tempDir)));
|
||||||
|
|
||||||
// Sanity check that getConfig returns undefined before we have called initConfig
|
// Sanity check that getConfig returns undefined before we have called initConfig
|
||||||
t.deepEqual(await configUtils.getConfig(tmpDir, logger), undefined);
|
t.deepEqual(await configUtils.getConfig(tempDir, logger), undefined);
|
||||||
|
|
||||||
const config1 = await configUtils.initConfig(
|
const config1 = await configUtils.initConfig(
|
||||||
"javascript,python",
|
createTestInitConfigInputs({
|
||||||
undefined,
|
languagesInput: "javascript,python",
|
||||||
undefined,
|
tempDir,
|
||||||
undefined,
|
codeql,
|
||||||
undefined,
|
workspacePath: tempDir,
|
||||||
undefined,
|
logger,
|
||||||
false,
|
}),
|
||||||
false,
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
codeQL,
|
|
||||||
tmpDir,
|
|
||||||
gitHubVersion,
|
|
||||||
sampleApiDetails,
|
|
||||||
logger,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// The saved config file should now exist
|
// The saved config file should now exist
|
||||||
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tempDir)));
|
||||||
|
|
||||||
// And that same newly-initialised config should now be returned by getConfig
|
// And that same newly-initialised config should now be returned by getConfig
|
||||||
const config2 = await configUtils.getConfig(tmpDir, logger);
|
const config2 = await configUtils.getConfig(tempDir, logger);
|
||||||
t.not(config2, undefined);
|
t.not(config2, undefined);
|
||||||
if (config2 !== undefined) {
|
if (config2 !== undefined) {
|
||||||
// removes properties assigned to undefined.
|
// removes properties assigned to undefined.
|
||||||
@@ -199,26 +204,15 @@ test("loading config saves config", async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("load input outside of workspace", async (t) => {
|
test("load input outside of workspace", async (t) => {
|
||||||
return await withTmpDir(async (tmpDir) => {
|
return await withTmpDir(async (tempDir) => {
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(
|
await configUtils.initConfig(
|
||||||
undefined,
|
createTestInitConfigInputs({
|
||||||
undefined,
|
configFile: "../input",
|
||||||
undefined,
|
tempDir,
|
||||||
"../input",
|
codeql: getCachedCodeQL(),
|
||||||
undefined,
|
workspacePath: tempDir,
|
||||||
undefined,
|
}),
|
||||||
false,
|
|
||||||
false,
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
getCachedCodeQL(),
|
|
||||||
tmpDir,
|
|
||||||
gitHubVersion,
|
|
||||||
sampleApiDetails,
|
|
||||||
getRunnerLogger(true),
|
|
||||||
);
|
);
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -226,7 +220,7 @@ test("load input outside of workspace", async (t) => {
|
|||||||
err,
|
err,
|
||||||
new UserError(
|
new UserError(
|
||||||
configUtils.getConfigFileOutsideWorkspaceErrorMessage(
|
configUtils.getConfigFileOutsideWorkspaceErrorMessage(
|
||||||
path.join(tmpDir, "../input"),
|
path.join(tempDir, "../input"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -235,29 +229,18 @@ test("load input outside of workspace", async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("load non-local input with invalid repo syntax", async (t) => {
|
test("load non-local input with invalid repo syntax", async (t) => {
|
||||||
return await withTmpDir(async (tmpDir) => {
|
return await withTmpDir(async (tempDir) => {
|
||||||
// no filename given, just a repo
|
// no filename given, just a repo
|
||||||
const configFile = "octo-org/codeql-config@main";
|
const configFile = "octo-org/codeql-config@main";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(
|
await configUtils.initConfig(
|
||||||
undefined,
|
createTestInitConfigInputs({
|
||||||
undefined,
|
configFile,
|
||||||
undefined,
|
tempDir,
|
||||||
configFile,
|
codeql: getCachedCodeQL(),
|
||||||
undefined,
|
workspacePath: tempDir,
|
||||||
undefined,
|
}),
|
||||||
false,
|
|
||||||
false,
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
getCachedCodeQL(),
|
|
||||||
tmpDir,
|
|
||||||
gitHubVersion,
|
|
||||||
sampleApiDetails,
|
|
||||||
getRunnerLogger(true),
|
|
||||||
);
|
);
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -274,30 +257,20 @@ test("load non-local input with invalid repo syntax", async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("load non-existent input", async (t) => {
|
test("load non-existent input", async (t) => {
|
||||||
return await withTmpDir(async (tmpDir) => {
|
return await withTmpDir(async (tempDir) => {
|
||||||
const languages = "javascript";
|
const languagesInput = "javascript";
|
||||||
const configFile = "input";
|
const configFile = "input";
|
||||||
t.false(fs.existsSync(path.join(tmpDir, configFile)));
|
t.false(fs.existsSync(path.join(tempDir, configFile)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(
|
await configUtils.initConfig(
|
||||||
languages,
|
createTestInitConfigInputs({
|
||||||
undefined,
|
languagesInput,
|
||||||
undefined,
|
configFile,
|
||||||
configFile,
|
tempDir,
|
||||||
undefined,
|
codeql: getCachedCodeQL(),
|
||||||
undefined,
|
workspacePath: tempDir,
|
||||||
false,
|
}),
|
||||||
false,
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
getCachedCodeQL(),
|
|
||||||
tmpDir,
|
|
||||||
gitHubVersion,
|
|
||||||
sampleApiDetails,
|
|
||||||
getRunnerLogger(true),
|
|
||||||
);
|
);
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -305,7 +278,7 @@ test("load non-existent input", async (t) => {
|
|||||||
err,
|
err,
|
||||||
new UserError(
|
new UserError(
|
||||||
configUtils.getConfigFileDoesNotExistErrorMessage(
|
configUtils.getConfigFileDoesNotExistErrorMessage(
|
||||||
path.join(tmpDir, "input"),
|
path.join(tempDir, "input"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -314,8 +287,8 @@ test("load non-existent input", async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("load non-empty input", async (t) => {
|
test("load non-empty input", async (t) => {
|
||||||
return await withTmpDir(async (tmpDir) => {
|
return await withTmpDir(async (tempDir) => {
|
||||||
const codeQL = setCodeQL({
|
const codeql = setCodeQL({
|
||||||
async resolveQueries() {
|
async resolveQueries() {
|
||||||
return {
|
return {
|
||||||
byLanguage: {
|
byLanguage: {
|
||||||
@@ -345,11 +318,12 @@ test("load non-empty input", async (t) => {
|
|||||||
paths:
|
paths:
|
||||||
- c/d`;
|
- c/d`;
|
||||||
|
|
||||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
fs.mkdirSync(path.join(tempDir, "foo"));
|
||||||
|
|
||||||
// And the config we expect it to parse to
|
// And the config we expect it to parse to
|
||||||
const expectedConfig: configUtils.Config = {
|
const expectedConfig: configUtils.Config = {
|
||||||
languages: [Language.javascript],
|
languages: [Language.javascript],
|
||||||
|
buildMode: "none",
|
||||||
originalUserInput: {
|
originalUserInput: {
|
||||||
name: "my config",
|
name: "my config",
|
||||||
"disable-default-queries": true,
|
"disable-default-queries": true,
|
||||||
@@ -357,10 +331,10 @@ test("load non-empty input", async (t) => {
|
|||||||
"paths-ignore": ["a", "b"],
|
"paths-ignore": ["a", "b"],
|
||||||
paths: ["c/d"],
|
paths: ["c/d"],
|
||||||
},
|
},
|
||||||
tempDir: tmpDir,
|
tempDir,
|
||||||
codeQLCmd: codeQL.getPath(),
|
codeQLCmd: codeql.getPath(),
|
||||||
gitHubVersion,
|
gitHubVersion: githubVersion,
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
debugArtifactName: "my-artifact",
|
debugArtifactName: "my-artifact",
|
||||||
debugDatabaseName: "my-db",
|
debugDatabaseName: "my-db",
|
||||||
@@ -369,27 +343,20 @@ test("load non-empty input", async (t) => {
|
|||||||
trapCacheDownloadTime: 0,
|
trapCacheDownloadTime: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
const languages = "javascript";
|
const languagesInput = "javascript";
|
||||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tempDir);
|
||||||
|
|
||||||
const actualConfig = await configUtils.initConfig(
|
const actualConfig = await configUtils.initConfig(
|
||||||
languages,
|
createTestInitConfigInputs({
|
||||||
undefined,
|
languagesInput,
|
||||||
undefined,
|
buildModeInput: "none",
|
||||||
configFilePath,
|
configFile: configFilePath,
|
||||||
undefined,
|
debugArtifactName: "my-artifact",
|
||||||
undefined,
|
debugDatabaseName: "my-db",
|
||||||
false,
|
tempDir,
|
||||||
false,
|
codeql,
|
||||||
"my-artifact",
|
workspacePath: tempDir,
|
||||||
"my-db",
|
}),
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
codeQL,
|
|
||||||
tmpDir,
|
|
||||||
gitHubVersion,
|
|
||||||
sampleApiDetails,
|
|
||||||
getRunnerLogger(true),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Should exactly equal the object we constructed earlier
|
// Should exactly equal the object we constructed earlier
|
||||||
@@ -417,15 +384,15 @@ function queriesToResolvedQueryForm(queries: string[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test("Using config input and file together, config input should be used.", async (t) => {
|
test("Using config input and file together, config input should be used.", async (t) => {
|
||||||
return await withTmpDir(async (tmpDir) => {
|
return await withTmpDir(async (tempDir) => {
|
||||||
process.env["RUNNER_TEMP"] = tmpDir;
|
process.env["RUNNER_TEMP"] = tempDir;
|
||||||
process.env["GITHUB_WORKSPACE"] = tmpDir;
|
process.env["GITHUB_WORKSPACE"] = tempDir;
|
||||||
|
|
||||||
const inputFileContents = `
|
const inputFileContents = `
|
||||||
name: my config
|
name: my config
|
||||||
queries:
|
queries:
|
||||||
- uses: ./foo_file`;
|
- uses: ./foo_file`;
|
||||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
const configFilePath = createConfigFile(inputFileContents, tempDir);
|
||||||
|
|
||||||
const configInput = `
|
const configInput = `
|
||||||
name: my config
|
name: my config
|
||||||
@@ -438,13 +405,13 @@ test("Using config input and file together, config input should be used.", async
|
|||||||
- c/d@1.2.3
|
- c/d@1.2.3
|
||||||
`;
|
`;
|
||||||
|
|
||||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
fs.mkdirSync(path.join(tempDir, "foo"));
|
||||||
|
|
||||||
const resolveQueriesArgs: Array<{
|
const resolveQueriesArgs: Array<{
|
||||||
queries: string[];
|
queries: string[];
|
||||||
extraSearchPath: string | undefined;
|
extraSearchPath: string | undefined;
|
||||||
}> = [];
|
}> = [];
|
||||||
const codeQL = setCodeQL({
|
const codeql = setCodeQL({
|
||||||
async resolveQueries(
|
async resolveQueries(
|
||||||
queries: string[],
|
queries: string[],
|
||||||
extraSearchPath: string | undefined,
|
extraSearchPath: string | undefined,
|
||||||
@@ -458,26 +425,17 @@ test("Using config input and file together, config input should be used.", async
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Only JS, python packs will be ignored
|
// Only JS, python packs will be ignored
|
||||||
const languages = "javascript";
|
const languagesInput = "javascript";
|
||||||
|
|
||||||
const config = await configUtils.initConfig(
|
const config = await configUtils.initConfig(
|
||||||
languages,
|
createTestInitConfigInputs({
|
||||||
undefined,
|
languagesInput,
|
||||||
undefined,
|
configFile: configFilePath,
|
||||||
undefined,
|
configInput,
|
||||||
configFilePath,
|
tempDir,
|
||||||
configInput,
|
codeql,
|
||||||
false,
|
workspacePath: tempDir,
|
||||||
false,
|
}),
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
codeQL,
|
|
||||||
tmpDir,
|
|
||||||
gitHubVersion,
|
|
||||||
sampleApiDetails,
|
|
||||||
getRunnerLogger(true),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
t.deepEqual(config.originalUserInput, yaml.load(configInput));
|
t.deepEqual(config.originalUserInput, yaml.load(configInput));
|
||||||
@@ -485,8 +443,8 @@ test("Using config input and file together, config input should be used.", async
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("API client used when reading remote config", async (t) => {
|
test("API client used when reading remote config", async (t) => {
|
||||||
return await withTmpDir(async (tmpDir) => {
|
return await withTmpDir(async (tempDir) => {
|
||||||
const codeQL = setCodeQL({
|
const codeql = setCodeQL({
|
||||||
async resolveQueries() {
|
async resolveQueries() {
|
||||||
return {
|
return {
|
||||||
byLanguage: {
|
byLanguage: {
|
||||||
@@ -521,59 +479,38 @@ test("API client used when reading remote config", async (t) => {
|
|||||||
const spyGetContents = mockGetContents(dummyResponse);
|
const spyGetContents = mockGetContents(dummyResponse);
|
||||||
|
|
||||||
// Create checkout directory for remote queries repository
|
// Create checkout directory for remote queries repository
|
||||||
fs.mkdirSync(path.join(tmpDir, "foo/bar/dev"), { recursive: true });
|
fs.mkdirSync(path.join(tempDir, "foo/bar/dev"), { recursive: true });
|
||||||
|
|
||||||
const configFile = "octo-org/codeql-config/config.yaml@main";
|
const configFile = "octo-org/codeql-config/config.yaml@main";
|
||||||
const languages = "javascript";
|
const languagesInput = "javascript";
|
||||||
|
|
||||||
await configUtils.initConfig(
|
await configUtils.initConfig(
|
||||||
languages,
|
createTestInitConfigInputs({
|
||||||
undefined,
|
languagesInput,
|
||||||
undefined,
|
configFile,
|
||||||
configFile,
|
tempDir,
|
||||||
undefined,
|
codeql,
|
||||||
undefined,
|
workspacePath: tempDir,
|
||||||
false,
|
}),
|
||||||
false,
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
codeQL,
|
|
||||||
tmpDir,
|
|
||||||
gitHubVersion,
|
|
||||||
sampleApiDetails,
|
|
||||||
getRunnerLogger(true),
|
|
||||||
);
|
);
|
||||||
t.assert(spyGetContents.called);
|
t.assert(spyGetContents.called);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Remote config handles the case where a directory is provided", async (t) => {
|
test("Remote config handles the case where a directory is provided", async (t) => {
|
||||||
return await withTmpDir(async (tmpDir) => {
|
return await withTmpDir(async (tempDir) => {
|
||||||
const dummyResponse = []; // directories are returned as arrays
|
const dummyResponse = []; // directories are returned as arrays
|
||||||
mockGetContents(dummyResponse);
|
mockGetContents(dummyResponse);
|
||||||
|
|
||||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(
|
await configUtils.initConfig(
|
||||||
undefined,
|
createTestInitConfigInputs({
|
||||||
undefined,
|
configFile: repoReference,
|
||||||
undefined,
|
tempDir,
|
||||||
repoReference,
|
codeql: getCachedCodeQL(),
|
||||||
undefined,
|
workspacePath: tempDir,
|
||||||
undefined,
|
}),
|
||||||
false,
|
|
||||||
false,
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
getCachedCodeQL(),
|
|
||||||
tmpDir,
|
|
||||||
gitHubVersion,
|
|
||||||
sampleApiDetails,
|
|
||||||
getRunnerLogger(true),
|
|
||||||
);
|
);
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -588,7 +525,7 @@ test("Remote config handles the case where a directory is provided", async (t) =
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("Invalid format of remote config handled correctly", async (t) => {
|
test("Invalid format of remote config handled correctly", async (t) => {
|
||||||
return await withTmpDir(async (tmpDir) => {
|
return await withTmpDir(async (tempDir) => {
|
||||||
const dummyResponse = {
|
const dummyResponse = {
|
||||||
// note no "content" property here
|
// note no "content" property here
|
||||||
};
|
};
|
||||||
@@ -597,23 +534,12 @@ test("Invalid format of remote config handled correctly", async (t) => {
|
|||||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(
|
await configUtils.initConfig(
|
||||||
undefined,
|
createTestInitConfigInputs({
|
||||||
undefined,
|
configFile: repoReference,
|
||||||
undefined,
|
tempDir,
|
||||||
repoReference,
|
codeql: getCachedCodeQL(),
|
||||||
undefined,
|
workspacePath: tempDir,
|
||||||
undefined,
|
}),
|
||||||
false,
|
|
||||||
false,
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
getCachedCodeQL(),
|
|
||||||
tmpDir,
|
|
||||||
gitHubVersion,
|
|
||||||
sampleApiDetails,
|
|
||||||
getRunnerLogger(true),
|
|
||||||
);
|
);
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -628,9 +554,9 @@ test("Invalid format of remote config handled correctly", async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("No detected languages", async (t) => {
|
test("No detected languages", async (t) => {
|
||||||
return await withTmpDir(async (tmpDir) => {
|
return await withTmpDir(async (tempDir) => {
|
||||||
mockListLanguages([]);
|
mockListLanguages([]);
|
||||||
const codeQL = setCodeQL({
|
const codeql = setCodeQL({
|
||||||
async resolveLanguages() {
|
async resolveLanguages() {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
@@ -641,23 +567,11 @@ test("No detected languages", async (t) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(
|
await configUtils.initConfig(
|
||||||
undefined,
|
createTestInitConfigInputs({
|
||||||
undefined,
|
tempDir,
|
||||||
undefined,
|
codeql,
|
||||||
undefined,
|
workspacePath: tempDir,
|
||||||
undefined,
|
}),
|
||||||
undefined,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
codeQL,
|
|
||||||
tmpDir,
|
|
||||||
gitHubVersion,
|
|
||||||
sampleApiDetails,
|
|
||||||
getRunnerLogger(true),
|
|
||||||
);
|
);
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -667,28 +581,17 @@ test("No detected languages", async (t) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("Unknown languages", async (t) => {
|
test("Unknown languages", async (t) => {
|
||||||
return await withTmpDir(async (tmpDir) => {
|
return await withTmpDir(async (tempDir) => {
|
||||||
const languages = "rubbish,english";
|
const languagesInput = "rubbish,english";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await configUtils.initConfig(
|
await configUtils.initConfig(
|
||||||
languages,
|
createTestInitConfigInputs({
|
||||||
undefined,
|
languagesInput,
|
||||||
undefined,
|
tempDir,
|
||||||
undefined,
|
codeql: getCachedCodeQL(),
|
||||||
undefined,
|
workspacePath: tempDir,
|
||||||
undefined,
|
}),
|
||||||
false,
|
|
||||||
false,
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
{ owner: "github", repo: "example" },
|
|
||||||
tmpDir,
|
|
||||||
getCachedCodeQL(),
|
|
||||||
tmpDir,
|
|
||||||
gitHubVersion,
|
|
||||||
sampleApiDetails,
|
|
||||||
getRunnerLogger(true),
|
|
||||||
);
|
);
|
||||||
throw new Error("initConfig did not throw error");
|
throw new Error("initConfig did not throw error");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ export interface Config {
|
|||||||
* Set of languages to run analysis for.
|
* Set of languages to run analysis for.
|
||||||
*/
|
*/
|
||||||
languages: Language[];
|
languages: Language[];
|
||||||
|
/**
|
||||||
|
* Build mode, if set. Currently only a single build mode is supported per job.
|
||||||
|
*/
|
||||||
|
buildMode: string | undefined;
|
||||||
/**
|
/**
|
||||||
* A unaltered copy of the original user input.
|
* A unaltered copy of the original user input.
|
||||||
* Mainly intended to be used for status reporting.
|
* Mainly intended to be used for status reporting.
|
||||||
@@ -391,49 +395,82 @@ export async function getRawLanguages(
|
|||||||
return { rawLanguages, autodetected };
|
return { rawLanguages, autodetected };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Inputs required to initialize a configuration. */
|
||||||
|
export interface InitConfigInputs {
|
||||||
|
languagesInput: string | undefined;
|
||||||
|
queriesInput: string | undefined;
|
||||||
|
packsInput: string | undefined;
|
||||||
|
configFile: string | undefined;
|
||||||
|
dbLocation: string | undefined;
|
||||||
|
configInput: string | undefined;
|
||||||
|
buildModeInput: string | undefined;
|
||||||
|
trapCachingEnabled: boolean;
|
||||||
|
debugMode: boolean;
|
||||||
|
debugArtifactName: string;
|
||||||
|
debugDatabaseName: string;
|
||||||
|
repository: RepositoryNwo;
|
||||||
|
tempDir: string;
|
||||||
|
codeql: CodeQL;
|
||||||
|
workspacePath: string;
|
||||||
|
githubVersion: GitHubVersion;
|
||||||
|
apiDetails: api.GitHubApiCombinedDetails;
|
||||||
|
logger: Logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetDefaultConfigInputs = Omit<
|
||||||
|
InitConfigInputs,
|
||||||
|
"configFile" | "configInput"
|
||||||
|
>;
|
||||||
|
|
||||||
|
type LoadConfigInputs = Omit<InitConfigInputs, "configInput"> & {
|
||||||
|
configFile: string;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the default config for when the user has not supplied one.
|
* Get the default config for when the user has not supplied one.
|
||||||
*/
|
*/
|
||||||
export async function getDefaultConfig(
|
export async function getDefaultConfig({
|
||||||
languagesInput: string | undefined,
|
languagesInput,
|
||||||
rawQueriesInput: string | undefined,
|
queriesInput,
|
||||||
rawPacksInput: string | undefined,
|
packsInput,
|
||||||
dbLocation: string | undefined,
|
buildModeInput,
|
||||||
trapCachingEnabled: boolean,
|
dbLocation,
|
||||||
debugMode: boolean,
|
trapCachingEnabled,
|
||||||
debugArtifactName: string,
|
debugMode,
|
||||||
debugDatabaseName: string,
|
debugArtifactName,
|
||||||
repository: RepositoryNwo,
|
debugDatabaseName,
|
||||||
tempDir: string,
|
repository,
|
||||||
codeQL: CodeQL,
|
tempDir,
|
||||||
gitHubVersion: GitHubVersion,
|
codeql,
|
||||||
logger: Logger,
|
githubVersion,
|
||||||
): Promise<Config> {
|
logger,
|
||||||
|
}: GetDefaultConfigInputs): Promise<Config> {
|
||||||
const languages = await getLanguages(
|
const languages = await getLanguages(
|
||||||
codeQL,
|
codeql,
|
||||||
languagesInput,
|
languagesInput,
|
||||||
repository,
|
repository,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
const augmentationProperties = calculateAugmentation(
|
const augmentationProperties = calculateAugmentation(
|
||||||
rawPacksInput,
|
packsInput,
|
||||||
rawQueriesInput,
|
queriesInput,
|
||||||
languages,
|
languages,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(
|
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(
|
||||||
trapCachingEnabled,
|
trapCachingEnabled,
|
||||||
codeQL,
|
codeql,
|
||||||
languages,
|
languages,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
languages,
|
languages,
|
||||||
|
buildMode: buildModeInput,
|
||||||
originalUserInput: {},
|
originalUserInput: {},
|
||||||
tempDir,
|
tempDir,
|
||||||
codeQLCmd: codeQL.getPath(),
|
codeQLCmd: codeql.getPath(),
|
||||||
gitHubVersion,
|
gitHubVersion: githubVersion,
|
||||||
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
||||||
debugMode,
|
debugMode,
|
||||||
debugArtifactName,
|
debugArtifactName,
|
||||||
@@ -466,24 +503,25 @@ async function downloadCacheWithTime(
|
|||||||
/**
|
/**
|
||||||
* Load the config from the given file.
|
* Load the config from the given file.
|
||||||
*/
|
*/
|
||||||
async function loadConfig(
|
async function loadConfig({
|
||||||
languagesInput: string | undefined,
|
languagesInput,
|
||||||
rawQueriesInput: string | undefined,
|
queriesInput,
|
||||||
rawPacksInput: string | undefined,
|
packsInput,
|
||||||
configFile: string,
|
buildModeInput,
|
||||||
dbLocation: string | undefined,
|
configFile,
|
||||||
trapCachingEnabled: boolean,
|
dbLocation,
|
||||||
debugMode: boolean,
|
trapCachingEnabled,
|
||||||
debugArtifactName: string,
|
debugMode,
|
||||||
debugDatabaseName: string,
|
debugArtifactName,
|
||||||
repository: RepositoryNwo,
|
debugDatabaseName,
|
||||||
tempDir: string,
|
repository,
|
||||||
codeQL: CodeQL,
|
tempDir,
|
||||||
workspacePath: string,
|
codeql,
|
||||||
gitHubVersion: GitHubVersion,
|
workspacePath,
|
||||||
apiDetails: api.GitHubApiCombinedDetails,
|
githubVersion,
|
||||||
logger: Logger,
|
apiDetails,
|
||||||
): Promise<Config> {
|
logger,
|
||||||
|
}: LoadConfigInputs): Promise<Config> {
|
||||||
let parsedYAML: UserConfig;
|
let parsedYAML: UserConfig;
|
||||||
|
|
||||||
if (isLocal(configFile)) {
|
if (isLocal(configFile)) {
|
||||||
@@ -495,31 +533,32 @@ async function loadConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const languages = await getLanguages(
|
const languages = await getLanguages(
|
||||||
codeQL,
|
codeql,
|
||||||
languagesInput,
|
languagesInput,
|
||||||
repository,
|
repository,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
const augmentationProperties = calculateAugmentation(
|
const augmentationProperties = calculateAugmentation(
|
||||||
rawPacksInput,
|
packsInput,
|
||||||
rawQueriesInput,
|
queriesInput,
|
||||||
languages,
|
languages,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(
|
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(
|
||||||
trapCachingEnabled,
|
trapCachingEnabled,
|
||||||
codeQL,
|
codeql,
|
||||||
languages,
|
languages,
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
languages,
|
languages,
|
||||||
|
buildMode: buildModeInput,
|
||||||
originalUserInput: parsedYAML,
|
originalUserInput: parsedYAML,
|
||||||
tempDir,
|
tempDir,
|
||||||
codeQLCmd: codeQL.getPath(),
|
codeQLCmd: codeql.getPath(),
|
||||||
gitHubVersion,
|
gitHubVersion: githubVersion,
|
||||||
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
||||||
debugMode,
|
debugMode,
|
||||||
debugArtifactName,
|
debugArtifactName,
|
||||||
@@ -765,76 +804,33 @@ function dbLocationOrDefault(
|
|||||||
* This will parse the config from the user input if present, or generate
|
* This will parse the config from the user input if present, or generate
|
||||||
* a default config. The parsed config is then stored to a known location.
|
* a default config. The parsed config is then stored to a known location.
|
||||||
*/
|
*/
|
||||||
export async function initConfig(
|
export async function initConfig(inputs: InitConfigInputs): Promise<Config> {
|
||||||
languagesInput: string | undefined,
|
|
||||||
queriesInput: string | undefined,
|
|
||||||
packsInput: string | undefined,
|
|
||||||
configFile: string | undefined,
|
|
||||||
dbLocation: string | undefined,
|
|
||||||
configInput: string | undefined,
|
|
||||||
trapCachingEnabled: boolean,
|
|
||||||
debugMode: boolean,
|
|
||||||
debugArtifactName: string,
|
|
||||||
debugDatabaseName: string,
|
|
||||||
repository: RepositoryNwo,
|
|
||||||
tempDir: string,
|
|
||||||
codeQL: CodeQL,
|
|
||||||
workspacePath: string,
|
|
||||||
gitHubVersion: GitHubVersion,
|
|
||||||
apiDetails: api.GitHubApiCombinedDetails,
|
|
||||||
logger: Logger,
|
|
||||||
): Promise<Config> {
|
|
||||||
let config: Config;
|
let config: Config;
|
||||||
|
|
||||||
|
const { logger, workspacePath } = inputs;
|
||||||
|
|
||||||
// if configInput is set, it takes precedence over configFile
|
// if configInput is set, it takes precedence over configFile
|
||||||
if (configInput) {
|
if (inputs.configInput) {
|
||||||
if (configFile) {
|
if (inputs.configFile) {
|
||||||
logger.warning(
|
logger.warning(
|
||||||
`Both a config file and config input were provided. Ignoring config file.`,
|
`Both a config file and config input were provided. Ignoring config file.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
configFile = path.resolve(workspacePath, "user-config-from-action.yml");
|
inputs.configFile = path.resolve(
|
||||||
fs.writeFileSync(configFile, configInput);
|
workspacePath,
|
||||||
logger.debug(`Using config from action input: ${configFile}`);
|
"user-config-from-action.yml",
|
||||||
|
);
|
||||||
|
fs.writeFileSync(inputs.configFile, inputs.configInput);
|
||||||
|
logger.debug(`Using config from action input: ${inputs.configFile}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no config file was provided create an empty one
|
// If no config file was provided create an empty one
|
||||||
if (!configFile) {
|
if (!inputs.configFile) {
|
||||||
logger.debug("No configuration file was provided");
|
logger.debug("No configuration file was provided");
|
||||||
config = await getDefaultConfig(
|
config = await getDefaultConfig(inputs);
|
||||||
languagesInput,
|
|
||||||
queriesInput,
|
|
||||||
packsInput,
|
|
||||||
dbLocation,
|
|
||||||
trapCachingEnabled,
|
|
||||||
debugMode,
|
|
||||||
debugArtifactName,
|
|
||||||
debugDatabaseName,
|
|
||||||
repository,
|
|
||||||
tempDir,
|
|
||||||
codeQL,
|
|
||||||
gitHubVersion,
|
|
||||||
logger,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
config = await loadConfig(
|
// Convince the type checker that inputs.configFile is defined.
|
||||||
languagesInput,
|
config = await loadConfig({ ...inputs, configFile: inputs.configFile });
|
||||||
queriesInput,
|
|
||||||
packsInput,
|
|
||||||
configFile,
|
|
||||||
dbLocation,
|
|
||||||
trapCachingEnabled,
|
|
||||||
debugMode,
|
|
||||||
debugArtifactName,
|
|
||||||
debugDatabaseName,
|
|
||||||
repository,
|
|
||||||
tempDir,
|
|
||||||
codeQL,
|
|
||||||
workspacePath,
|
|
||||||
gitHubVersion,
|
|
||||||
apiDetails,
|
|
||||||
logger,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the config so we can easily access it again in the future
|
// Save the config so we can easily access it again in the future
|
||||||
|
|||||||
@@ -8,19 +8,18 @@ import * as actionsUtil from "./actions-util";
|
|||||||
import { GitHubApiDetails } from "./api-client";
|
import { GitHubApiDetails } from "./api-client";
|
||||||
import * as apiClient from "./api-client";
|
import * as apiClient from "./api-client";
|
||||||
import { setCodeQL } from "./codeql";
|
import { setCodeQL } from "./codeql";
|
||||||
import { Config, defaultAugmentationProperties } from "./config-utils";
|
import { Config } from "./config-utils";
|
||||||
import { uploadDatabases } from "./database-upload";
|
import { uploadDatabases } from "./database-upload";
|
||||||
import { Language } from "./languages";
|
import { Language } from "./languages";
|
||||||
import { RepositoryNwo } from "./repository";
|
import { RepositoryNwo } from "./repository";
|
||||||
import {
|
import {
|
||||||
|
createTestConfig,
|
||||||
getRecordingLogger,
|
getRecordingLogger,
|
||||||
LoggedMessage,
|
LoggedMessage,
|
||||||
setupActionsVars,
|
setupActionsVars,
|
||||||
setupTests,
|
setupTests,
|
||||||
} from "./testing-utils";
|
} from "./testing-utils";
|
||||||
import {
|
import {
|
||||||
DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
GitHubVariant,
|
GitHubVariant,
|
||||||
HTTPError,
|
HTTPError,
|
||||||
initializeEnvironment,
|
initializeEnvironment,
|
||||||
@@ -41,20 +40,10 @@ const testApiDetails: GitHubApiDetails = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function getTestConfig(tmpDir: string): Config {
|
function getTestConfig(tmpDir: string): Config {
|
||||||
return {
|
return createTestConfig({
|
||||||
languages: [Language.javascript],
|
languages: [Language.javascript],
|
||||||
originalUserInput: {},
|
|
||||||
tempDir: tmpDir,
|
|
||||||
codeQLCmd: "foo",
|
|
||||||
gitHubVersion: { type: GitHubVariant.DOTCOM },
|
|
||||||
dbLocation: tmpDir,
|
dbLocation: tmpDir,
|
||||||
debugMode: false,
|
});
|
||||||
debugArtifactName: DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: defaultAugmentationProperties,
|
|
||||||
trapCaches: {},
|
|
||||||
trapCacheDownloadTime: 0,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function mockHttpRequests(databaseUploadStatusCode: number) {
|
async function mockHttpRequests(databaseUploadStatusCode: number) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"bundleVersion": "codeql-bundle-v2.16.0",
|
"bundleVersion": "codeql-bundle-v2.16.1",
|
||||||
"cliVersion": "2.16.0",
|
"cliVersion": "2.16.1",
|
||||||
"priorBundleVersion": "codeql-bundle-v2.15.5",
|
"priorBundleVersion": "codeql-bundle-v2.16.0",
|
||||||
"priorCliVersion": "2.15.5"
|
"priorCliVersion": "2.16.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Environment variables used by the CodeQL Action.
|
||||||
|
*
|
||||||
|
* We recommend prefixing environment variables with `CODEQL_ACTION_`
|
||||||
|
* to reduce the risk that they are overwritten by other steps.
|
||||||
|
*/
|
||||||
export enum EnvVar {
|
export enum EnvVar {
|
||||||
/** Whether the `analyze` Action completes successfully. */
|
/** Whether the `analyze` Action completes successfully. */
|
||||||
ANALYZE_DID_COMPLETE_SUCCESSFULLY = "CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY",
|
ANALYZE_DID_COMPLETE_SUCCESSFULLY = "CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY",
|
||||||
@@ -35,6 +41,9 @@ export enum EnvVar {
|
|||||||
/** UUID representing the current job run. */
|
/** UUID representing the current job run. */
|
||||||
JOB_RUN_UUID = "JOB_RUN_UUID",
|
JOB_RUN_UUID = "JOB_RUN_UUID",
|
||||||
|
|
||||||
|
/** Status for the entire job, submitted to the status report in `init-post` */
|
||||||
|
JOB_STATUS = "CODEQL_ACTION_JOB_STATUS",
|
||||||
|
|
||||||
ODASA_TRACER_CONFIGURATION = "ODASA_TRACER_CONFIGURATION",
|
ODASA_TRACER_CONFIGURATION = "ODASA_TRACER_CONFIGURATION",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ export const featureConfig: Record<
|
|||||||
// here!
|
// here!
|
||||||
envVar: "CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION",
|
envVar: "CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION",
|
||||||
minimumVersion: "2.16.0",
|
minimumVersion: "2.16.0",
|
||||||
defaultValue: false,
|
defaultValue: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as core from "@actions/core";
|
||||||
import * as github from "@actions/github";
|
import * as github from "@actions/github";
|
||||||
|
|
||||||
import * as actionsUtil from "./actions-util";
|
import * as actionsUtil from "./actions-util";
|
||||||
@@ -8,6 +9,7 @@ import { EnvVar } from "./environment";
|
|||||||
import { Feature, FeatureEnablement } from "./feature-flags";
|
import { Feature, FeatureEnablement } from "./feature-flags";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
import { RepositoryNwo, parseRepositoryNwo } from "./repository";
|
import { RepositoryNwo, parseRepositoryNwo } from "./repository";
|
||||||
|
import { JobStatus } from "./status-report";
|
||||||
import * as uploadLib from "./upload-lib";
|
import * as uploadLib from "./upload-lib";
|
||||||
import {
|
import {
|
||||||
delay,
|
delay,
|
||||||
@@ -36,6 +38,10 @@ export interface UploadFailedSarifResult extends uploadLib.UploadStatusReport {
|
|||||||
sarifID?: string;
|
sarifID?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface JobStatusReport {
|
||||||
|
job_status: JobStatus;
|
||||||
|
}
|
||||||
|
|
||||||
function createFailedUploadFailedSarifResult(
|
function createFailedUploadFailedSarifResult(
|
||||||
error: unknown,
|
error: unknown,
|
||||||
): UploadFailedSarifResult {
|
): UploadFailedSarifResult {
|
||||||
@@ -121,6 +127,15 @@ export async function tryUploadSarifIfRunFailed(
|
|||||||
logger: Logger,
|
logger: Logger,
|
||||||
): Promise<UploadFailedSarifResult> {
|
): Promise<UploadFailedSarifResult> {
|
||||||
if (process.env[EnvVar.ANALYZE_DID_COMPLETE_SUCCESSFULLY] !== "true") {
|
if (process.env[EnvVar.ANALYZE_DID_COMPLETE_SUCCESSFULLY] !== "true") {
|
||||||
|
// If analyze didn't complete successfully and the job status hasn't
|
||||||
|
// already been set to Failure/ConfigurationError previously, this
|
||||||
|
// means that something along the way failed in a step that is not
|
||||||
|
// owned by the Action, for example a manual build step. We
|
||||||
|
// consider this a configuration error.
|
||||||
|
core.exportVariable(
|
||||||
|
EnvVar.JOB_STATUS,
|
||||||
|
process.env[EnvVar.JOB_STATUS] ?? JobStatus.ConfigurationError,
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
return await maybeUploadFailedSarif(
|
return await maybeUploadFailedSarif(
|
||||||
config,
|
config,
|
||||||
@@ -135,6 +150,10 @@ export async function tryUploadSarifIfRunFailed(
|
|||||||
return createFailedUploadFailedSarifResult(e);
|
return createFailedUploadFailedSarifResult(e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
core.exportVariable(
|
||||||
|
EnvVar.JOB_STATUS,
|
||||||
|
process.env[EnvVar.JOB_STATUS] ?? JobStatus.Success,
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
upload_failed_run_skipped_because:
|
upload_failed_run_skipped_because:
|
||||||
"Analyze Action completed successfully",
|
"Analyze Action completed successfully",
|
||||||
@@ -282,3 +301,20 @@ async function removeUploadedSarif(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the final job status sent in the `init-post` Action, based on the
|
||||||
|
* current value of the JOB_STATUS environment variable. If the variable is
|
||||||
|
* unset, or if its value is not one of the JobStatus enum values, returns
|
||||||
|
* Unknown. Otherwise it returns the status set in the environment variable.
|
||||||
|
*/
|
||||||
|
export function getFinalJobStatus(): JobStatus {
|
||||||
|
const jobStatusFromEnvironment = process.env[EnvVar.JOB_STATUS];
|
||||||
|
if (
|
||||||
|
!jobStatusFromEnvironment ||
|
||||||
|
!Object.values(JobStatus).includes(jobStatusFromEnvironment as JobStatus)
|
||||||
|
) {
|
||||||
|
return JobStatus.Unknown;
|
||||||
|
}
|
||||||
|
return jobStatusFromEnvironment as JobStatus;
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ import {
|
|||||||
|
|
||||||
interface InitPostStatusReport
|
interface InitPostStatusReport
|
||||||
extends StatusReportBase,
|
extends StatusReportBase,
|
||||||
initActionPostHelper.UploadFailedSarifResult {}
|
initActionPostHelper.UploadFailedSarifResult,
|
||||||
|
initActionPostHelper.JobStatusReport {}
|
||||||
|
|
||||||
async function runWrapper() {
|
async function runWrapper() {
|
||||||
const startedAt = new Date();
|
const startedAt = new Date();
|
||||||
@@ -83,6 +84,7 @@ async function runWrapper() {
|
|||||||
const statusReport: InitPostStatusReport = {
|
const statusReport: InitPostStatusReport = {
|
||||||
...statusReportBase,
|
...statusReportBase,
|
||||||
...uploadFailedSarifResult,
|
...uploadFailedSarifResult,
|
||||||
|
job_status: initActionPostHelper.getFinalJobStatus(),
|
||||||
};
|
};
|
||||||
await sendStatusReport(statusReport);
|
await sendStatusReport(statusReport);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import {
|
|||||||
getActionsStatus,
|
getActionsStatus,
|
||||||
sendStatusReport,
|
sendStatusReport,
|
||||||
} from "./status-report";
|
} from "./status-report";
|
||||||
import { ToolsFeature, isSupportedToolsFeature } from "./tools-features";
|
import { ToolsFeature } from "./tools-features";
|
||||||
import { getTotalCacheSize } from "./trap-caching";
|
import { getTotalCacheSize } from "./trap-caching";
|
||||||
import {
|
import {
|
||||||
checkDiskUsage,
|
checkDiskUsage,
|
||||||
@@ -265,29 +265,32 @@ async function run() {
|
|||||||
}
|
}
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
|
|
||||||
config = await initConfig(
|
config = await initConfig({
|
||||||
getOptionalInput("languages"),
|
languagesInput: getOptionalInput("languages"),
|
||||||
getOptionalInput("queries"),
|
queriesInput: getOptionalInput("queries"),
|
||||||
getOptionalInput("packs"),
|
packsInput: getOptionalInput("packs"),
|
||||||
getOptionalInput("config-file"),
|
buildModeInput: getOptionalInput("build-mode"),
|
||||||
getOptionalInput("db-location"),
|
configFile: getOptionalInput("config-file"),
|
||||||
getOptionalInput("config"),
|
dbLocation: getOptionalInput("db-location"),
|
||||||
getTrapCachingEnabled(),
|
configInput: getOptionalInput("config"),
|
||||||
|
trapCachingEnabled: getTrapCachingEnabled(),
|
||||||
// Debug mode is enabled if:
|
// Debug mode is enabled if:
|
||||||
// - The `init` Action is passed `debug: true`.
|
// - The `init` Action is passed `debug: true`.
|
||||||
// - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow),
|
// - Actions step debugging is enabled (e.g. by [enabling debug logging for a rerun](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow),
|
||||||
// or by setting the `ACTIONS_STEP_DEBUG` secret to `true`).
|
// or by setting the `ACTIONS_STEP_DEBUG` secret to `true`).
|
||||||
getOptionalInput("debug") === "true" || core.isDebug(),
|
debugMode: getOptionalInput("debug") === "true" || core.isDebug(),
|
||||||
getOptionalInput("debug-artifact-name") || DEFAULT_DEBUG_ARTIFACT_NAME,
|
debugArtifactName:
|
||||||
getOptionalInput("debug-database-name") || DEFAULT_DEBUG_DATABASE_NAME,
|
getOptionalInput("debug-artifact-name") || DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
repositoryNwo,
|
debugDatabaseName:
|
||||||
getTemporaryDirectory(),
|
getOptionalInput("debug-database-name") || DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
|
repository: repositoryNwo,
|
||||||
|
tempDir: getTemporaryDirectory(),
|
||||||
codeql,
|
codeql,
|
||||||
getRequiredEnvParam("GITHUB_WORKSPACE"),
|
workspacePath: getRequiredEnvParam("GITHUB_WORKSPACE"),
|
||||||
gitHubVersion,
|
githubVersion: gitHubVersion,
|
||||||
apiDetails,
|
apiDetails,
|
||||||
logger,
|
logger,
|
||||||
);
|
});
|
||||||
|
|
||||||
await checkInstallPython311(config.languages, codeql);
|
await checkInstallPython311(config.languages, codeql);
|
||||||
|
|
||||||
@@ -325,9 +328,6 @@ async function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Query CLI for supported features
|
|
||||||
const versionInfo = await codeql.getVersion();
|
|
||||||
|
|
||||||
// Forward Go flags
|
// Forward Go flags
|
||||||
const goFlags = process.env["GOFLAGS"];
|
const goFlags = process.env["GOFLAGS"];
|
||||||
if (goFlags) {
|
if (goFlags) {
|
||||||
@@ -351,10 +351,9 @@ async function run() {
|
|||||||
// typically dynamically linked, this provides a suitable entry point for the CodeQL tracer.
|
// typically dynamically linked, this provides a suitable entry point for the CodeQL tracer.
|
||||||
if (
|
if (
|
||||||
fileOutput.includes("statically linked") &&
|
fileOutput.includes("statically linked") &&
|
||||||
!isSupportedToolsFeature(
|
!(await codeql.supportsFeature(
|
||||||
versionInfo,
|
|
||||||
ToolsFeature.IndirectTracingSupportsStaticBinaries,
|
ToolsFeature.IndirectTracingSupportsStaticBinaries,
|
||||||
)
|
))
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
logger.debug(`Applying static binary workaround for Go`);
|
logger.debug(`Applying static binary workaround for Go`);
|
||||||
|
|||||||
42
src/init.ts
42
src/init.ts
@@ -10,7 +10,6 @@ import * as configUtils from "./config-utils";
|
|||||||
import { CodeQLDefaultVersionInfo } from "./feature-flags";
|
import { CodeQLDefaultVersionInfo } from "./feature-flags";
|
||||||
import { Language, isScannedLanguage } from "./languages";
|
import { Language, isScannedLanguage } from "./languages";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
import { RepositoryNwo } from "./repository";
|
|
||||||
import { ToolsSource } from "./setup-codeql";
|
import { ToolsSource } from "./setup-codeql";
|
||||||
import { TracerConfig, getCombinedTracerConfig } from "./tracer-config";
|
import { TracerConfig, getCombinedTracerConfig } from "./tracer-config";
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
@@ -45,44 +44,11 @@ export async function initCodeQL(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function initConfig(
|
export async function initConfig(
|
||||||
languagesInput: string | undefined,
|
inputs: configUtils.InitConfigInputs,
|
||||||
queriesInput: string | undefined,
|
|
||||||
packsInput: string | undefined,
|
|
||||||
configFile: string | undefined,
|
|
||||||
dbLocation: string | undefined,
|
|
||||||
configInput: string | undefined,
|
|
||||||
trapCachingEnabled: boolean,
|
|
||||||
debugMode: boolean,
|
|
||||||
debugArtifactName: string,
|
|
||||||
debugDatabaseName: string,
|
|
||||||
repository: RepositoryNwo,
|
|
||||||
tempDir: string,
|
|
||||||
codeQL: CodeQL,
|
|
||||||
workspacePath: string,
|
|
||||||
gitHubVersion: util.GitHubVersion,
|
|
||||||
apiDetails: GitHubApiCombinedDetails,
|
|
||||||
logger: Logger,
|
|
||||||
): Promise<configUtils.Config> {
|
): Promise<configUtils.Config> {
|
||||||
|
const logger = inputs.logger;
|
||||||
logger.startGroup("Load language configuration");
|
logger.startGroup("Load language configuration");
|
||||||
const config = await configUtils.initConfig(
|
const config = await configUtils.initConfig(inputs);
|
||||||
languagesInput,
|
|
||||||
queriesInput,
|
|
||||||
packsInput,
|
|
||||||
configFile,
|
|
||||||
dbLocation,
|
|
||||||
configInput,
|
|
||||||
trapCachingEnabled,
|
|
||||||
debugMode,
|
|
||||||
debugArtifactName,
|
|
||||||
debugDatabaseName,
|
|
||||||
repository,
|
|
||||||
tempDir,
|
|
||||||
codeQL,
|
|
||||||
workspacePath,
|
|
||||||
gitHubVersion,
|
|
||||||
apiDetails,
|
|
||||||
logger,
|
|
||||||
);
|
|
||||||
printPathFiltersWarning(config, logger);
|
printPathFiltersWarning(config, logger);
|
||||||
logger.endGroup();
|
logger.endGroup();
|
||||||
return config;
|
return config;
|
||||||
@@ -124,7 +90,7 @@ export async function runInit(
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw processError(e);
|
throw processError(e);
|
||||||
}
|
}
|
||||||
return await getCombinedTracerConfig(await codeql.getVersion(), config);
|
return await getCombinedTracerConfig(codeql, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function printPathFiltersWarning(
|
export function printPathFiltersWarning(
|
||||||
|
|||||||
@@ -32,12 +32,20 @@ export type ActionName =
|
|||||||
| "upload-sarif";
|
| "upload-sarif";
|
||||||
|
|
||||||
export type ActionStatus =
|
export type ActionStatus =
|
||||||
| "aborted"
|
| "aborted" // Only used in the init Action, if init failed before initializing the tracer due to something other than a configuration error.
|
||||||
| "failure"
|
| "failure"
|
||||||
| "starting"
|
| "starting"
|
||||||
| "success"
|
| "success"
|
||||||
| "user-error";
|
| "user-error";
|
||||||
|
|
||||||
|
/** Overall status of the entire job. String values match the Hydro schema. */
|
||||||
|
export enum JobStatus {
|
||||||
|
Unknown = "JOB_STATUS_UNKNOWN",
|
||||||
|
Success = "JOB_STATUS_SUCCESS",
|
||||||
|
Failure = "JOB_STATUS_FAILURE",
|
||||||
|
ConfigurationError = "JOB_STATUS_CONFIGURATION_ERROR",
|
||||||
|
}
|
||||||
|
|
||||||
export interface StatusReportBase {
|
export interface StatusReportBase {
|
||||||
/** Name of the action being executed. */
|
/** Name of the action being executed. */
|
||||||
action_name: ActionName;
|
action_name: ActionName;
|
||||||
@@ -88,7 +96,7 @@ export interface StatusReportBase {
|
|||||||
/** Action runner hardware architecture (context runner.arch). */
|
/** Action runner hardware architecture (context runner.arch). */
|
||||||
runner_arch?: string;
|
runner_arch?: string;
|
||||||
/** Available disk space on the runner, in bytes. */
|
/** Available disk space on the runner, in bytes. */
|
||||||
runner_available_disk_space_bytes: number;
|
runner_available_disk_space_bytes?: number;
|
||||||
/**
|
/**
|
||||||
* Version of the runner image, for workflows running on GitHub-hosted runners. Absent otherwise.
|
* Version of the runner image, for workflows running on GitHub-hosted runners. Absent otherwise.
|
||||||
*/
|
*/
|
||||||
@@ -98,7 +106,7 @@ export interface StatusReportBase {
|
|||||||
/** Action runner operating system release (x.y.z from os.release()). */
|
/** Action runner operating system release (x.y.z from os.release()). */
|
||||||
runner_os_release?: string;
|
runner_os_release?: string;
|
||||||
/** Total disk space on the runner, in bytes. */
|
/** Total disk space on the runner, in bytes. */
|
||||||
runner_total_disk_space_bytes: number;
|
runner_total_disk_space_bytes?: number;
|
||||||
/** Time the first action started. Normally the init action. */
|
/** Time the first action started. Normally the init action. */
|
||||||
started_at: string;
|
started_at: string;
|
||||||
/** State this action is currently in. */
|
/** State this action is currently in. */
|
||||||
@@ -133,6 +141,25 @@ export function getActionsStatus(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the overall job status environment variable to configuration error
|
||||||
|
* or failure, unless it's already been set to one of these values in a
|
||||||
|
* previous step.
|
||||||
|
*/
|
||||||
|
function setJobStatusIfUnsuccessful(actionStatus: ActionStatus) {
|
||||||
|
if (actionStatus === "user-error") {
|
||||||
|
core.exportVariable(
|
||||||
|
EnvVar.JOB_STATUS,
|
||||||
|
process.env[EnvVar.JOB_STATUS] ?? JobStatus.ConfigurationError,
|
||||||
|
);
|
||||||
|
} else if (actionStatus === "failure" || actionStatus === "aborted") {
|
||||||
|
core.exportVariable(
|
||||||
|
EnvVar.JOB_STATUS,
|
||||||
|
process.env[EnvVar.JOB_STATUS] ?? JobStatus.Failure,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Any status report may include an array of EventReports associated with it.
|
// Any status report may include an array of EventReports associated with it.
|
||||||
export interface EventReport {
|
export interface EventReport {
|
||||||
/** Time this event ended. */
|
/** Time this event ended. */
|
||||||
@@ -165,7 +192,7 @@ export async function createStatusReportBase(
|
|||||||
actionName: ActionName,
|
actionName: ActionName,
|
||||||
status: ActionStatus,
|
status: ActionStatus,
|
||||||
actionStartedAt: Date,
|
actionStartedAt: Date,
|
||||||
diskInfo: DiskUsage,
|
diskInfo: DiskUsage | undefined,
|
||||||
cause?: string,
|
cause?: string,
|
||||||
exception?: string,
|
exception?: string,
|
||||||
): Promise<StatusReportBase> {
|
): Promise<StatusReportBase> {
|
||||||
@@ -203,9 +230,7 @@ export async function createStatusReportBase(
|
|||||||
job_name: jobName,
|
job_name: jobName,
|
||||||
job_run_uuid: jobRunUUID,
|
job_run_uuid: jobRunUUID,
|
||||||
ref,
|
ref,
|
||||||
runner_available_disk_space_bytes: diskInfo.numAvailableBytes,
|
|
||||||
runner_os: runnerOs,
|
runner_os: runnerOs,
|
||||||
runner_total_disk_space_bytes: diskInfo.numTotalBytes,
|
|
||||||
started_at: workflowStartedAt,
|
started_at: workflowStartedAt,
|
||||||
status,
|
status,
|
||||||
testing_environment: testingEnvironment,
|
testing_environment: testingEnvironment,
|
||||||
@@ -214,6 +239,11 @@ export async function createStatusReportBase(
|
|||||||
workflow_run_id: workflowRunID,
|
workflow_run_id: workflowRunID,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (diskInfo) {
|
||||||
|
statusReport.runner_available_disk_space_bytes = diskInfo.numAvailableBytes;
|
||||||
|
statusReport.runner_total_disk_space_bytes = diskInfo.numTotalBytes;
|
||||||
|
}
|
||||||
|
|
||||||
// Add optional parameters
|
// Add optional parameters
|
||||||
if (cause) {
|
if (cause) {
|
||||||
statusReport.cause = cause;
|
statusReport.cause = cause;
|
||||||
@@ -273,6 +303,8 @@ const INCOMPATIBLE_MSG =
|
|||||||
export async function sendStatusReport<S extends StatusReportBase>(
|
export async function sendStatusReport<S extends StatusReportBase>(
|
||||||
statusReport: S,
|
statusReport: S,
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
|
setJobStatusIfUnsuccessful(statusReport.status);
|
||||||
|
|
||||||
const statusReportJSON = JSON.stringify(statusReport);
|
const statusReportJSON = JSON.stringify(statusReport);
|
||||||
core.debug(`Sending status report: ${statusReportJSON}`);
|
core.debug(`Sending status report: ${statusReportJSON}`);
|
||||||
// If in test mode we don't want to upload the results
|
// If in test mode we don't want to upload the results
|
||||||
|
|||||||
@@ -8,14 +8,21 @@ import * as sinon from "sinon";
|
|||||||
|
|
||||||
import * as apiClient from "./api-client";
|
import * as apiClient from "./api-client";
|
||||||
import { GitHubApiDetails } from "./api-client";
|
import { GitHubApiDetails } from "./api-client";
|
||||||
import * as CodeQL from "./codeql";
|
import * as codeql from "./codeql";
|
||||||
|
import { Config } from "./config-utils";
|
||||||
import {
|
import {
|
||||||
CodeQLDefaultVersionInfo,
|
CodeQLDefaultVersionInfo,
|
||||||
Feature,
|
Feature,
|
||||||
FeatureEnablement,
|
FeatureEnablement,
|
||||||
} from "./feature-flags";
|
} from "./feature-flags";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "./logging";
|
||||||
import { HTTPError } from "./util";
|
import {
|
||||||
|
DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
|
GitHubVariant,
|
||||||
|
GitHubVersion,
|
||||||
|
HTTPError,
|
||||||
|
} from "./util";
|
||||||
|
|
||||||
export const SAMPLE_DOTCOM_API_DETAILS = {
|
export const SAMPLE_DOTCOM_API_DETAILS = {
|
||||||
auth: "token",
|
auth: "token",
|
||||||
@@ -73,7 +80,7 @@ export function setupTests(test: TestFn<any>) {
|
|||||||
typedTest.beforeEach((t) => {
|
typedTest.beforeEach((t) => {
|
||||||
// Set an empty CodeQL object so that all method calls will fail
|
// Set an empty CodeQL object so that all method calls will fail
|
||||||
// unless the test explicitly sets one up.
|
// unless the test explicitly sets one up.
|
||||||
CodeQL.setCodeQL({});
|
codeql.setCodeQL({});
|
||||||
|
|
||||||
// Replace stdout and stderr so we can record output during tests
|
// Replace stdout and stderr so we can record output during tests
|
||||||
t.context.testOutput = "";
|
t.context.testOutput = "";
|
||||||
@@ -214,7 +221,7 @@ export function mockLanguagesInRepo(languages: string[]) {
|
|||||||
export const makeVersionInfo = (
|
export const makeVersionInfo = (
|
||||||
version: string,
|
version: string,
|
||||||
features?: { [name: string]: boolean },
|
features?: { [name: string]: boolean },
|
||||||
): CodeQL.VersionInfo => ({
|
): codeql.VersionInfo => ({
|
||||||
version,
|
version,
|
||||||
features,
|
features,
|
||||||
});
|
});
|
||||||
@@ -223,11 +230,11 @@ export function mockCodeQLVersion(
|
|||||||
version: string,
|
version: string,
|
||||||
features?: { [name: string]: boolean },
|
features?: { [name: string]: boolean },
|
||||||
) {
|
) {
|
||||||
return {
|
return codeql.setCodeQL({
|
||||||
async getVersion() {
|
async getVersion() {
|
||||||
return makeVersionInfo(version, features);
|
return makeVersionInfo(version, features);
|
||||||
},
|
},
|
||||||
} as CodeQL.CodeQL;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -291,3 +298,30 @@ export function mockBundleDownloadApi({
|
|||||||
|
|
||||||
return `${baseUrl}${relativeUrl}`;
|
return `${baseUrl}${relativeUrl}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function createTestConfig(overrides: Partial<Config>): Config {
|
||||||
|
return Object.assign(
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
languages: [],
|
||||||
|
buildMode: undefined,
|
||||||
|
originalUserInput: {},
|
||||||
|
tempDir: "",
|
||||||
|
codeQLCmd: "",
|
||||||
|
gitHubVersion: {
|
||||||
|
type: GitHubVariant.DOTCOM,
|
||||||
|
} as GitHubVersion,
|
||||||
|
dbLocation: "",
|
||||||
|
debugMode: false,
|
||||||
|
debugArtifactName: DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||||
|
debugDatabaseName: DEFAULT_DEBUG_DATABASE_NAME,
|
||||||
|
augmentationProperties: {
|
||||||
|
packsInputCombines: false,
|
||||||
|
queriesInputCombines: false,
|
||||||
|
},
|
||||||
|
trapCaches: {},
|
||||||
|
trapCacheDownloadTime: 0,
|
||||||
|
},
|
||||||
|
overrides,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { VersionInfo } from "./codeql";
|
import type { VersionInfo } from "./codeql";
|
||||||
|
|
||||||
export enum ToolsFeature {
|
export enum ToolsFeature {
|
||||||
|
BuildModeOption = "buildModeOption",
|
||||||
IndirectTracingSupportsStaticBinaries = "indirectTracingSupportsStaticBinaries",
|
IndirectTracingSupportsStaticBinaries = "indirectTracingSupportsStaticBinaries",
|
||||||
SetsCodeqlRunnerEnvVar = "setsCodeqlRunnerEnvVar",
|
SetsCodeqlRunnerEnvVar = "setsCodeqlRunnerEnvVar",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,27 +5,22 @@ import test from "ava";
|
|||||||
|
|
||||||
import * as configUtils from "./config-utils";
|
import * as configUtils from "./config-utils";
|
||||||
import { Language } from "./languages";
|
import { Language } from "./languages";
|
||||||
import { makeVersionInfo, setupTests } from "./testing-utils";
|
import {
|
||||||
|
createTestConfig,
|
||||||
|
mockCodeQLVersion,
|
||||||
|
setupTests,
|
||||||
|
} from "./testing-utils";
|
||||||
import { getCombinedTracerConfig } from "./tracer-config";
|
import { getCombinedTracerConfig } from "./tracer-config";
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
|
|
||||||
setupTests(test);
|
setupTests(test);
|
||||||
|
|
||||||
function getTestConfig(tmpDir: string): configUtils.Config {
|
function getTestConfig(tempDir: string): configUtils.Config {
|
||||||
return {
|
return createTestConfig({
|
||||||
languages: [Language.java],
|
languages: [Language.java],
|
||||||
originalUserInput: {},
|
tempDir,
|
||||||
tempDir: tmpDir,
|
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||||
codeQLCmd: "",
|
});
|
||||||
gitHubVersion: { type: util.GitHubVariant.DOTCOM } as util.GitHubVersion,
|
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
|
||||||
debugMode: false,
|
|
||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: configUtils.defaultAugmentationProperties,
|
|
||||||
trapCaches: {},
|
|
||||||
trapCacheDownloadTime: 0,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test("getCombinedTracerConfig - return undefined when no languages are traced languages", async (t) => {
|
test("getCombinedTracerConfig - return undefined when no languages are traced languages", async (t) => {
|
||||||
@@ -34,7 +29,7 @@ test("getCombinedTracerConfig - return undefined when no languages are traced la
|
|||||||
// No traced languages
|
// No traced languages
|
||||||
config.languages = [Language.javascript, Language.python];
|
config.languages = [Language.javascript, Language.python];
|
||||||
t.deepEqual(
|
t.deepEqual(
|
||||||
await getCombinedTracerConfig(makeVersionInfo("1.0.0"), config),
|
await getCombinedTracerConfig(mockCodeQLVersion("1.0.0"), config),
|
||||||
undefined,
|
undefined,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -70,7 +65,7 @@ test("getCombinedTracerConfig - with start-tracing.json environment file", async
|
|||||||
fs.writeFileSync(startTracingJson, JSON.stringify(startTracingEnv));
|
fs.writeFileSync(startTracingJson, JSON.stringify(startTracingEnv));
|
||||||
|
|
||||||
const result = await getCombinedTracerConfig(
|
const result = await getCombinedTracerConfig(
|
||||||
makeVersionInfo("1.0.0"),
|
mockCodeQLVersion("1.0.0"),
|
||||||
config,
|
config,
|
||||||
);
|
);
|
||||||
t.notDeepEqual(result, undefined);
|
t.notDeepEqual(result, undefined);
|
||||||
@@ -130,7 +125,7 @@ test("getCombinedTracerConfig - with SetsCodeqlRunnerEnvVar feature enabled in C
|
|||||||
fs.writeFileSync(startTracingJson, JSON.stringify(startTracingEnv));
|
fs.writeFileSync(startTracingJson, JSON.stringify(startTracingEnv));
|
||||||
|
|
||||||
const result = await getCombinedTracerConfig(
|
const result = await getCombinedTracerConfig(
|
||||||
makeVersionInfo("1.0.0", { setsCodeqlRunnerEnvVar: true }),
|
mockCodeQLVersion("1.0.0", { setsCodeqlRunnerEnvVar: true }),
|
||||||
config,
|
config,
|
||||||
);
|
);
|
||||||
t.notDeepEqual(result, undefined);
|
t.notDeepEqual(result, undefined);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
import { VersionInfo } from "./codeql";
|
import { CodeQL } from "./codeql";
|
||||||
import * as configUtils from "./config-utils";
|
import * as configUtils from "./config-utils";
|
||||||
import { isTracedLanguage } from "./languages";
|
import { isTracedLanguage } from "./languages";
|
||||||
import { ToolsFeature, isSupportedToolsFeature } from "./tools-features";
|
import { ToolsFeature } from "./tools-features";
|
||||||
|
|
||||||
export type TracerConfig = {
|
export type TracerConfig = {
|
||||||
env: { [key: string]: string };
|
env: { [key: string]: string };
|
||||||
@@ -61,7 +61,7 @@ export async function getTracerConfigForCluster(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getCombinedTracerConfig(
|
export async function getCombinedTracerConfig(
|
||||||
versionInfo: VersionInfo,
|
codeql: CodeQL,
|
||||||
config: configUtils.Config,
|
config: configUtils.Config,
|
||||||
): Promise<TracerConfig | undefined> {
|
): Promise<TracerConfig | undefined> {
|
||||||
// Abort if there are no traced languages as there's nothing to do
|
// Abort if there are no traced languages as there's nothing to do
|
||||||
@@ -74,9 +74,7 @@ export async function getCombinedTracerConfig(
|
|||||||
|
|
||||||
// If the CLI doesn't yet support setting the CODEQL_RUNNER environment variable to
|
// If the CLI doesn't yet support setting the CODEQL_RUNNER environment variable to
|
||||||
// the runner executable path, we set it here in the Action.
|
// the runner executable path, we set it here in the Action.
|
||||||
if (
|
if (!(await codeql.supportsFeature(ToolsFeature.SetsCodeqlRunnerEnvVar))) {
|
||||||
!isSupportedToolsFeature(versionInfo, ToolsFeature.SetsCodeqlRunnerEnvVar)
|
|
||||||
) {
|
|
||||||
// On MacOS when System Integrity Protection is enabled, it's necessary to prefix
|
// On MacOS when System Integrity Protection is enabled, it's necessary to prefix
|
||||||
// the build command with the runner executable for indirect tracing, so we expose
|
// the build command with the runner executable for indirect tracing, so we expose
|
||||||
// it here via the CODEQL_RUNNER environment variable.
|
// it here via the CODEQL_RUNNER environment variable.
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import {
|
|||||||
getTrapCachingExtractorConfigArgsForLang,
|
getTrapCachingExtractorConfigArgsForLang,
|
||||||
} from "./codeql";
|
} from "./codeql";
|
||||||
import * as configUtils from "./config-utils";
|
import * as configUtils from "./config-utils";
|
||||||
import { Config } from "./config-utils";
|
|
||||||
import { Language } from "./languages";
|
import { Language } from "./languages";
|
||||||
import {
|
import {
|
||||||
|
createTestConfig,
|
||||||
getRecordingLogger,
|
getRecordingLogger,
|
||||||
makeVersionInfo,
|
makeVersionInfo,
|
||||||
setupTests,
|
setupTests,
|
||||||
@@ -69,49 +69,23 @@ const stubCodeql = setCodeQL({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const testConfigWithoutTmpDir: Config = {
|
const testConfigWithoutTmpDir = createTestConfig({
|
||||||
languages: [Language.javascript, Language.cpp],
|
languages: [Language.javascript, Language.cpp],
|
||||||
originalUserInput: {},
|
|
||||||
tempDir: "",
|
|
||||||
codeQLCmd: "",
|
|
||||||
gitHubVersion: {
|
|
||||||
type: util.GitHubVariant.DOTCOM,
|
|
||||||
} as util.GitHubVersion,
|
|
||||||
dbLocation: "",
|
|
||||||
debugMode: false,
|
|
||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: {
|
|
||||||
packsInputCombines: false,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
},
|
|
||||||
trapCaches: {
|
trapCaches: {
|
||||||
javascript: "/some/cache/dir",
|
javascript: "/some/cache/dir",
|
||||||
},
|
},
|
||||||
trapCacheDownloadTime: 0,
|
});
|
||||||
};
|
|
||||||
|
|
||||||
function getTestConfigWithTempDir(tmpDir: string): configUtils.Config {
|
function getTestConfigWithTempDir(tempDir: string): configUtils.Config {
|
||||||
return {
|
return createTestConfig({
|
||||||
languages: [Language.javascript, Language.ruby],
|
languages: [Language.javascript, Language.ruby],
|
||||||
originalUserInput: {},
|
tempDir,
|
||||||
tempDir: tmpDir,
|
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||||
codeQLCmd: "",
|
|
||||||
gitHubVersion: { type: util.GitHubVariant.DOTCOM } as util.GitHubVersion,
|
|
||||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
|
||||||
debugMode: false,
|
|
||||||
debugArtifactName: util.DEFAULT_DEBUG_ARTIFACT_NAME,
|
|
||||||
debugDatabaseName: util.DEFAULT_DEBUG_DATABASE_NAME,
|
|
||||||
augmentationProperties: {
|
|
||||||
packsInputCombines: false,
|
|
||||||
queriesInputCombines: false,
|
|
||||||
},
|
|
||||||
trapCaches: {
|
trapCaches: {
|
||||||
javascript: path.resolve(tmpDir, "jsCache"),
|
javascript: path.resolve(tempDir, "jsCache"),
|
||||||
ruby: path.resolve(tmpDir, "rubyCache"),
|
ruby: path.resolve(tempDir, "rubyCache"),
|
||||||
},
|
},
|
||||||
trapCacheDownloadTime: 0,
|
});
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test("check flags for JS, analyzing default branch", async (t) => {
|
test("check flags for JS, analyzing default branch", async (t) => {
|
||||||
|
|||||||
47
src/util.ts
47
src/util.ts
@@ -1011,26 +1011,37 @@ export interface DiskUsage {
|
|||||||
numTotalBytes: number;
|
numTotalBytes: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function checkDiskUsage(logger?: Logger): Promise<DiskUsage> {
|
export async function checkDiskUsage(
|
||||||
const diskUsage = await checkDiskSpace(
|
logger?: Logger,
|
||||||
getRequiredEnvParam("GITHUB_WORKSPACE"),
|
): Promise<DiskUsage | undefined> {
|
||||||
);
|
try {
|
||||||
const gbInBytes = 1024 * 1024 * 1024;
|
const diskUsage = await checkDiskSpace(
|
||||||
if (logger && diskUsage.free < 2 * gbInBytes) {
|
getRequiredEnvParam("GITHUB_WORKSPACE"),
|
||||||
const message =
|
);
|
||||||
"The Actions runner is running low on disk space " +
|
const gbInBytes = 1024 * 1024 * 1024;
|
||||||
`(${(diskUsage.free / gbInBytes).toPrecision(4)} GB available).`;
|
if (logger && diskUsage.free < 2 * gbInBytes) {
|
||||||
if (process.env[EnvVar.HAS_WARNED_ABOUT_DISK_SPACE] !== "true") {
|
const message =
|
||||||
logger.warning(message);
|
"The Actions runner is running low on disk space " +
|
||||||
} else {
|
`(${(diskUsage.free / gbInBytes).toPrecision(4)} GB available).`;
|
||||||
logger.debug(message);
|
if (process.env[EnvVar.HAS_WARNED_ABOUT_DISK_SPACE] !== "true") {
|
||||||
|
logger.warning(message);
|
||||||
|
} else {
|
||||||
|
logger.debug(message);
|
||||||
|
}
|
||||||
|
core.exportVariable(EnvVar.HAS_WARNED_ABOUT_DISK_SPACE, "true");
|
||||||
}
|
}
|
||||||
core.exportVariable(EnvVar.HAS_WARNED_ABOUT_DISK_SPACE, "true");
|
return {
|
||||||
|
numAvailableBytes: diskUsage.free,
|
||||||
|
numTotalBytes: diskUsage.size,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
if (logger) {
|
||||||
|
logger.warning(
|
||||||
|
`Failed to check available disk space: ${getErrorMessage(error)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
return {
|
|
||||||
numAvailableBytes: diskUsage.free,
|
|
||||||
numTotalBytes: diskUsage.size,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: ${{ github.workspace }}
|
default: ${{ github.workspace }}
|
||||||
ref:
|
ref:
|
||||||
description: "The ref where results will be uploaded. If not provided, the Action will use the GITHUB_REF environment variable. If provided, the sha input must be provided as well. This input is not available in pull requests from forks."
|
description: "The ref where results will be uploaded. If not provided, the Action will use the GITHUB_REF environment variable. If provided, the sha input must be provided as well. This input is ignored for pull requests from forks."
|
||||||
required: false
|
required: false
|
||||||
sha:
|
sha:
|
||||||
description: "The sha of the HEAD of the ref where results will be uploaded. If not provided, the Action will use the GITHUB_SHA environment variable. If provided, the ref input must be provided as well. This input is not available in pull requests from forks."
|
description: "The sha of the HEAD of the ref where results will be uploaded. If not provided, the Action will use the GITHUB_SHA environment variable. If provided, the ref input must be provided as well. This input is ignored for pull requests from forks."
|
||||||
required: false
|
required: false
|
||||||
token:
|
token:
|
||||||
default: ${{ github.token }}
|
default: ${{ github.token }}
|
||||||
|
|||||||
Reference in New Issue
Block a user