mirror of
https://github.com/github/codeql-action.git
synced 2025-12-08 16:58:06 +08:00
Compare commits
4 Commits
v2.24.0
...
nickfyson/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c1a14580c | ||
|
|
8338b72a73 | ||
|
|
977247109f | ||
|
|
9f17140d3f |
85
.github/workflows/__build-mode-none.yml
generated
vendored
85
.github/workflows/__build-mode-none.yml
generated
vendored
@@ -1,85 +0,0 @@
|
||||
# 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
|
||||
134
.github/workflows/codeql.yml
vendored
134
.github/workflows/codeql.yml
vendored
@@ -1,98 +1,68 @@
|
||||
name: "CodeQL action"
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, releases/v*]
|
||||
pull_request:
|
||||
branches: [main, releases/v*]
|
||||
# Run checks on reopened draft PRs to support triggering PR checks on draft PRs that were opened
|
||||
# by other workflows.
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
schedule:
|
||||
# Weekly on Sunday.
|
||||
- cron: '30 1 * * 0'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CODEQL_ACTION_TESTING_ENVIRONMENT: codeql-action-pr-checks
|
||||
|
||||
jobs:
|
||||
# Identify the CodeQL tool versions to use in the analysis job.
|
||||
check-codeql-versions:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
versions: ${{ steps.compare.outputs.versions }}
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Init with default CodeQL bundle from the VM image
|
||||
id: init-default
|
||||
uses: ./init
|
||||
with:
|
||||
languages: javascript
|
||||
- name: Remove empty database
|
||||
# allows us to run init a second time
|
||||
run: |
|
||||
rm -rf "$RUNNER_TEMP/codeql_databases"
|
||||
- name: Init with latest CodeQL bundle
|
||||
id: init-latest
|
||||
uses: ./init
|
||||
with:
|
||||
tools: latest
|
||||
languages: javascript
|
||||
- name: Compare default and latest CodeQL bundle versions
|
||||
id: compare
|
||||
env:
|
||||
CODEQL_DEFAULT: ${{ steps.init-default.outputs.codeql-path }}
|
||||
CODEQL_LATEST: ${{ steps.init-latest.outputs.codeql-path }}
|
||||
run: |
|
||||
CODEQL_VERSION_DEFAULT="$("$CODEQL_DEFAULT" version --format terse)"
|
||||
CODEQL_VERSION_LATEST="$("$CODEQL_LATEST" version --format terse)"
|
||||
echo "Default CodeQL bundle version is $CODEQL_VERSION_DEFAULT"
|
||||
echo "Latest CodeQL bundle version is $CODEQL_VERSION_LATEST"
|
||||
|
||||
# If we're running on a pull request, run with both bundles, even if `tools: latest` would
|
||||
# be the same as `tools: null`. This allows us to make the job for each of the bundles a
|
||||
# required status check.
|
||||
#
|
||||
# If we're running on push or schedule, then we can skip running with `tools: latest` when it would be
|
||||
# the same as running with `tools: null`.
|
||||
if [[ "$GITHUB_EVENT_NAME" != "pull_request" && "$CODEQL_VERSION_DEFAULT" == "$CODEQL_VERSION_LATEST" ]]; then
|
||||
VERSIONS_JSON='[null]'
|
||||
else
|
||||
VERSIONS_JSON='[null, "latest"]'
|
||||
fi
|
||||
|
||||
# Output a JSON-encoded list with the distinct versions to test against.
|
||||
echo "Suggested matrix config for analysis job: $VERSIONS_JSON"
|
||||
echo "versions=${VERSIONS_JSON}" >> $GITHUB_OUTPUT
|
||||
|
||||
build:
|
||||
needs: [check-codeql-versions]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-20.04,ubuntu-22.04,windows-2019,windows-2022,macos-11,macos-12,macos-13]
|
||||
tools: ${{ fromJson(needs.check-codeql-versions.outputs.versions) }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
permissions:
|
||||
security-events: write
|
||||
language: [ 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: ./init
|
||||
id: init
|
||||
uses: github/codeql-action/init@nickfyson/testing
|
||||
with:
|
||||
languages: javascript
|
||||
config-file: ./.github/codeql/codeql-config.yml
|
||||
tools: ${{ matrix.tools }}
|
||||
# confirm steps.init.outputs.codeql-path points to the codeql binary
|
||||
- name: Print CodeQL Version
|
||||
run: ${{steps.init.outputs.codeql-path}} version --format=json
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
||||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||
# queries: security-extended,security-and-quality
|
||||
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@nickfyson/testing
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||||
|
||||
# - run: |
|
||||
# echo "Run, Build Application using script"
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: ./analyze
|
||||
uses: github/codeql-action/analyze@nickfyson/testing
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
@@ -8,15 +8,6 @@ Note that the only difference between `v2` and `v3` of the CodeQL Action is the
|
||||
|
||||
No user facing changes.
|
||||
|
||||
## 2.24.0 - 02 Feb 2024
|
||||
|
||||
- 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)
|
||||
|
||||
## 2.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)
|
||||
|
||||
## 2.23.1 - 17 Jan 2024
|
||||
|
||||
- Update default CodeQL bundle version to 2.16.0. [#2073](https://github.com/github/codeql-action/pull/2073)
|
||||
|
||||
13
README.md
13
README.md
@@ -16,19 +16,6 @@ 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)."
|
||||
|
||||
## 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
|
||||
|
||||
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.
|
||||
default: ${{ github.workspace }}
|
||||
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 ignored for 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 not available in pull requests from forks."
|
||||
required: false
|
||||
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 ignored for 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 not available in pull requests from forks."
|
||||
required: false
|
||||
category:
|
||||
description: String used by Code Scanning for matching the analyses
|
||||
|
||||
@@ -10,23 +10,6 @@ inputs:
|
||||
description: |
|
||||
A comma-separated value of the languages to be analysed e.g. python,javascript
|
||||
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:
|
||||
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 }}
|
||||
|
||||
18
lib/analyze.test.js
generated
18
lib/analyze.test.js
generated
@@ -95,11 +95,25 @@ const util = __importStar(require("./util"));
|
||||
},
|
||||
databasePrintBaseline: async () => "",
|
||||
});
|
||||
const config = (0, testing_utils_1.createTestConfig)({
|
||||
const config = {
|
||||
languages: [language],
|
||||
originalUserInput: {},
|
||||
tempDir: tmpDir,
|
||||
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: {},
|
||||
trapCacheDownloadTime: 0,
|
||||
};
|
||||
fs.mkdirSync(util.getCodeQLDatabasePath(config, language), {
|
||||
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;AACrC,mDAA0C;AAC1C,2CAAuC;AACvC,uCAA4C;AAC5C,mDAKyB;AACzB,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,C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
const feature_flags_1 = require("./feature-flags");
|
||||
const languages_1 = require("./languages");
|
||||
const setupCodeql = __importStar(require("./setup-codeql"));
|
||||
const tools_features_1 = require("./tools-features");
|
||||
const util = __importStar(require("./util"));
|
||||
const util_1 = require("./util");
|
||||
class CommandInvocationError extends Error {
|
||||
@@ -202,12 +201,10 @@ function resolveFunction(partialCodeql, methodName, defaultImplementation) {
|
||||
function setCodeQL(partialCodeql) {
|
||||
cachedCodeQL = {
|
||||
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
|
||||
getVersion: resolveFunction(partialCodeql, "getVersion", async () => ({
|
||||
getVersion: resolveFunction(partialCodeql, "getVersion", () => new Promise((resolve) => resolve({
|
||||
version: "1.0.0",
|
||||
})),
|
||||
}))),
|
||||
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"),
|
||||
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
|
||||
extractScannedLanguage: resolveFunction(partialCodeql, "extractScannedLanguage"),
|
||||
@@ -282,9 +279,6 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
async printVersion() {
|
||||
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) {
|
||||
const extraArgs = config.languages.map((language) => `--language=${language}`);
|
||||
if (config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l)).length > 0) {
|
||||
@@ -298,10 +292,6 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
if (externalRepositoryToken) {
|
||||
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 &&
|
||||
(await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_INIT_WITH_QLCONFIG))) {
|
||||
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,9 +49,25 @@ const util_1 = require("./util");
|
||||
let stubConfig;
|
||||
ava_1.default.beforeEach(() => {
|
||||
(0, util_1.initializeEnvironment)("1.2.3");
|
||||
stubConfig = (0, testing_utils_1.createTestConfig)({
|
||||
stubConfig = {
|
||||
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, }) {
|
||||
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,17 +212,16 @@ exports.getRawLanguages = getRawLanguages;
|
||||
/**
|
||||
* Get the default config for when the user has not supplied one.
|
||||
*/
|
||||
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 augmentationProperties = calculateAugmentation(packsInput, queriesInput, languages);
|
||||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeql, languages, logger);
|
||||
async function getDefaultConfig(languagesInput, rawQueriesInput, rawPacksInput, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, gitHubVersion, logger) {
|
||||
const languages = await getLanguages(codeQL, languagesInput, repository, logger);
|
||||
const augmentationProperties = calculateAugmentation(rawPacksInput, rawQueriesInput, languages);
|
||||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logger);
|
||||
return {
|
||||
languages,
|
||||
buildMode: buildModeInput,
|
||||
originalUserInput: {},
|
||||
tempDir,
|
||||
codeQLCmd: codeql.getPath(),
|
||||
gitHubVersion: githubVersion,
|
||||
codeQLCmd: codeQL.getPath(),
|
||||
gitHubVersion,
|
||||
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
||||
debugMode,
|
||||
debugArtifactName,
|
||||
@@ -246,7 +245,7 @@ async function downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logg
|
||||
/**
|
||||
* Load the config from the given file.
|
||||
*/
|
||||
async function loadConfig({ languagesInput, queriesInput, packsInput, buildModeInput, configFile, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeql, workspacePath, githubVersion, apiDetails, logger, }) {
|
||||
async function loadConfig(languagesInput, rawQueriesInput, rawPacksInput, configFile, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger) {
|
||||
let parsedYAML;
|
||||
if (isLocal(configFile)) {
|
||||
// Treat the config file as relative to the workspace
|
||||
@@ -256,16 +255,15 @@ async function loadConfig({ languagesInput, queriesInput, packsInput, buildModeI
|
||||
else {
|
||||
parsedYAML = await getRemoteConfig(configFile, apiDetails);
|
||||
}
|
||||
const languages = await getLanguages(codeql, languagesInput, repository, logger);
|
||||
const augmentationProperties = calculateAugmentation(packsInput, queriesInput, languages);
|
||||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeql, languages, logger);
|
||||
const languages = await getLanguages(codeQL, languagesInput, repository, logger);
|
||||
const augmentationProperties = calculateAugmentation(rawPacksInput, rawQueriesInput, languages);
|
||||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(trapCachingEnabled, codeQL, languages, logger);
|
||||
return {
|
||||
languages,
|
||||
buildMode: buildModeInput,
|
||||
originalUserInput: parsedYAML,
|
||||
tempDir,
|
||||
codeQLCmd: codeql.getPath(),
|
||||
gitHubVersion: githubVersion,
|
||||
codeQLCmd: codeQL.getPath(),
|
||||
gitHubVersion,
|
||||
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
||||
debugMode,
|
||||
debugArtifactName,
|
||||
@@ -454,26 +452,24 @@ function dbLocationOrDefault(dbLocation, tempDir) {
|
||||
* 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.
|
||||
*/
|
||||
async function initConfig(inputs) {
|
||||
async function initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, configInput, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger) {
|
||||
let config;
|
||||
const { logger, workspacePath } = inputs;
|
||||
// if configInput is set, it takes precedence over configFile
|
||||
if (inputs.configInput) {
|
||||
if (inputs.configFile) {
|
||||
if (configInput) {
|
||||
if (configFile) {
|
||||
logger.warning(`Both a config file and config input were provided. Ignoring config file.`);
|
||||
}
|
||||
inputs.configFile = path.resolve(workspacePath, "user-config-from-action.yml");
|
||||
fs.writeFileSync(inputs.configFile, inputs.configInput);
|
||||
logger.debug(`Using config from action input: ${inputs.configFile}`);
|
||||
configFile = path.resolve(workspacePath, "user-config-from-action.yml");
|
||||
fs.writeFileSync(configFile, configInput);
|
||||
logger.debug(`Using config from action input: ${configFile}`);
|
||||
}
|
||||
// If no config file was provided create an empty one
|
||||
if (!inputs.configFile) {
|
||||
if (!configFile) {
|
||||
logger.debug("No configuration file was provided");
|
||||
config = await getDefaultConfig(inputs);
|
||||
config = await getDefaultConfig(languagesInput, queriesInput, packsInput, dbLocation, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, gitHubVersion, logger);
|
||||
}
|
||||
else {
|
||||
// Convince the type checker that inputs.configFile is defined.
|
||||
config = await loadConfig({ ...inputs, configFile: inputs.configFile });
|
||||
config = await loadConfig(languagesInput, 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
|
||||
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,35 +41,14 @@ const repository_1 = require("./repository");
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
const util_1 = require("./util");
|
||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||
const githubVersion = { type: util_1.GitHubVariant.DOTCOM };
|
||||
function createTestInitConfigInputs(overrides) {
|
||||
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: {},
|
||||
workspacePath: "",
|
||||
githubVersion,
|
||||
apiDetails: {
|
||||
auth: "token",
|
||||
externalRepoAuth: "token",
|
||||
url: "https://github.example.com",
|
||||
apiURL: undefined,
|
||||
registriesAuthTokens: undefined,
|
||||
},
|
||||
logger: (0, logging_1.getRunnerLogger)(true),
|
||||
}, overrides);
|
||||
}
|
||||
const sampleApiDetails = {
|
||||
auth: "token",
|
||||
externalRepoAuth: "token",
|
||||
url: "https://github.example.com",
|
||||
apiURL: undefined,
|
||||
registriesAuthTokens: undefined,
|
||||
};
|
||||
const gitHubVersion = { type: util_1.GitHubVariant.DOTCOM };
|
||||
// Returns the filepath of the newly-created file
|
||||
function createConfigFile(inputFileContents, tmpDir) {
|
||||
const configFilePath = path.join(tmpDir, "input");
|
||||
@@ -104,10 +83,10 @@ function mockListLanguages(languages) {
|
||||
sinon.stub(api, "getApiClient").value(() => client);
|
||||
}
|
||||
(0, ava_1.default)("load empty config", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||
const languages = "javascript,python";
|
||||
const codeql = (0, codeql_1.setCodeQL)({
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
async resolveQueries() {
|
||||
return {
|
||||
byLanguage: {
|
||||
@@ -122,25 +101,14 @@ function mockListLanguages(languages) {
|
||||
return { packs: [] };
|
||||
},
|
||||
});
|
||||
const config = await configUtils.initConfig(createTestInitConfigInputs({
|
||||
languagesInput: languages,
|
||||
repository: { owner: "github", repo: "example" },
|
||||
tempDir,
|
||||
codeql,
|
||||
logger,
|
||||
}));
|
||||
t.deepEqual(config, await configUtils.getDefaultConfig(createTestInitConfigInputs({
|
||||
languagesInput: languages,
|
||||
tempDir,
|
||||
codeql,
|
||||
logger,
|
||||
})));
|
||||
const config = await configUtils.initConfig(languages, undefined, undefined, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, tmpDir, gitHubVersion, sampleApiDetails, logger);
|
||||
t.deepEqual(config, await configUtils.getDefaultConfig(languages, undefined, undefined, undefined, false, false, "", "", { owner: "github", repo: "example" }, tmpDir, codeQL, gitHubVersion, logger));
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("loading config saves config", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
const logger = (0, logging_1.getRunnerLogger)(true);
|
||||
const codeql = (0, codeql_1.setCodeQL)({
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
async resolveQueries() {
|
||||
return {
|
||||
byLanguage: {
|
||||
@@ -156,20 +124,14 @@ function mockListLanguages(languages) {
|
||||
},
|
||||
});
|
||||
// Sanity check the saved config file does not already exist
|
||||
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tempDir)));
|
||||
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
||||
// Sanity check that getConfig returns undefined before we have called initConfig
|
||||
t.deepEqual(await configUtils.getConfig(tempDir, logger), undefined);
|
||||
const config1 = await configUtils.initConfig(createTestInitConfigInputs({
|
||||
languagesInput: "javascript,python",
|
||||
tempDir,
|
||||
codeql,
|
||||
workspacePath: tempDir,
|
||||
logger,
|
||||
}));
|
||||
t.deepEqual(await configUtils.getConfig(tmpDir, 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);
|
||||
// The saved config file should now exist
|
||||
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tempDir)));
|
||||
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
||||
// And that same newly-initialised config should now be returned by getConfig
|
||||
const config2 = await configUtils.getConfig(tempDir, logger);
|
||||
const config2 = await configUtils.getConfig(tmpDir, logger);
|
||||
t.not(config2, undefined);
|
||||
if (config2 !== undefined) {
|
||||
// removes properties assigned to undefined.
|
||||
@@ -179,32 +141,22 @@ function mockListLanguages(languages) {
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("load input outside of workspace", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
try {
|
||||
await configUtils.initConfig(createTestInitConfigInputs({
|
||||
configFile: "../input",
|
||||
tempDir,
|
||||
codeql: (0, codeql_1.getCachedCodeQL)(),
|
||||
workspacePath: tempDir,
|
||||
}));
|
||||
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));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileOutsideWorkspaceErrorMessage(path.join(tempDir, "../input"))));
|
||||
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileOutsideWorkspaceErrorMessage(path.join(tmpDir, "../input"))));
|
||||
}
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("load non-local input with invalid repo syntax", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
// no filename given, just a repo
|
||||
const configFile = "octo-org/codeql-config@main";
|
||||
try {
|
||||
await configUtils.initConfig(createTestInitConfigInputs({
|
||||
configFile,
|
||||
tempDir,
|
||||
codeql: (0, codeql_1.getCachedCodeQL)(),
|
||||
workspacePath: tempDir,
|
||||
}));
|
||||
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));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -213,28 +165,22 @@ function mockListLanguages(languages) {
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("load non-existent input", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||
const languagesInput = "javascript";
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
const languages = "javascript";
|
||||
const configFile = "input";
|
||||
t.false(fs.existsSync(path.join(tempDir, configFile)));
|
||||
t.false(fs.existsSync(path.join(tmpDir, configFile)));
|
||||
try {
|
||||
await configUtils.initConfig(createTestInitConfigInputs({
|
||||
languagesInput,
|
||||
configFile,
|
||||
tempDir,
|
||||
codeql: (0, codeql_1.getCachedCodeQL)(),
|
||||
workspacePath: tempDir,
|
||||
}));
|
||||
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));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileDoesNotExistErrorMessage(path.join(tempDir, "input"))));
|
||||
t.deepEqual(err, new util_1.UserError(configUtils.getConfigFileDoesNotExistErrorMessage(path.join(tmpDir, "input"))));
|
||||
}
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("load non-empty input", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||
const codeql = (0, codeql_1.setCodeQL)({
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
async resolveQueries() {
|
||||
return {
|
||||
byLanguage: {
|
||||
@@ -262,11 +208,10 @@ function mockListLanguages(languages) {
|
||||
- b
|
||||
paths:
|
||||
- c/d`;
|
||||
fs.mkdirSync(path.join(tempDir, "foo"));
|
||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
||||
// And the config we expect it to parse to
|
||||
const expectedConfig = {
|
||||
languages: [languages_1.Language.javascript],
|
||||
buildMode: "none",
|
||||
originalUserInput: {
|
||||
name: "my config",
|
||||
"disable-default-queries": true,
|
||||
@@ -274,10 +219,10 @@ function mockListLanguages(languages) {
|
||||
"paths-ignore": ["a", "b"],
|
||||
paths: ["c/d"],
|
||||
},
|
||||
tempDir,
|
||||
codeQLCmd: codeql.getPath(),
|
||||
gitHubVersion: githubVersion,
|
||||
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||
tempDir: tmpDir,
|
||||
codeQLCmd: codeQL.getPath(),
|
||||
gitHubVersion,
|
||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||
debugMode: false,
|
||||
debugArtifactName: "my-artifact",
|
||||
debugDatabaseName: "my-db",
|
||||
@@ -285,18 +230,9 @@ function mockListLanguages(languages) {
|
||||
trapCaches: {},
|
||||
trapCacheDownloadTime: 0,
|
||||
};
|
||||
const languagesInput = "javascript";
|
||||
const configFilePath = createConfigFile(inputFileContents, tempDir);
|
||||
const actualConfig = await configUtils.initConfig(createTestInitConfigInputs({
|
||||
languagesInput,
|
||||
buildModeInput: "none",
|
||||
configFile: configFilePath,
|
||||
debugArtifactName: "my-artifact",
|
||||
debugDatabaseName: "my-db",
|
||||
tempDir,
|
||||
codeql,
|
||||
workspacePath: tempDir,
|
||||
}));
|
||||
const languages = "javascript";
|
||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||
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));
|
||||
// Should exactly equal the object we constructed earlier
|
||||
t.deepEqual(actualConfig, expectedConfig);
|
||||
});
|
||||
@@ -320,14 +256,14 @@ function queriesToResolvedQueryForm(queries) {
|
||||
};
|
||||
}
|
||||
(0, ava_1.default)("Using config input and file together, config input should be used.", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||
process.env["RUNNER_TEMP"] = tempDir;
|
||||
process.env["GITHUB_WORKSPACE"] = tempDir;
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
process.env["RUNNER_TEMP"] = tmpDir;
|
||||
process.env["GITHUB_WORKSPACE"] = tmpDir;
|
||||
const inputFileContents = `
|
||||
name: my config
|
||||
queries:
|
||||
- uses: ./foo_file`;
|
||||
const configFilePath = createConfigFile(inputFileContents, tempDir);
|
||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||
const configInput = `
|
||||
name: my config
|
||||
queries:
|
||||
@@ -338,9 +274,9 @@ function queriesToResolvedQueryForm(queries) {
|
||||
python:
|
||||
- c/d@1.2.3
|
||||
`;
|
||||
fs.mkdirSync(path.join(tempDir, "foo"));
|
||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
||||
const resolveQueriesArgs = [];
|
||||
const codeql = (0, codeql_1.setCodeQL)({
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
async resolveQueries(queries, extraSearchPath) {
|
||||
resolveQueriesArgs.push({ queries, extraSearchPath });
|
||||
return queriesToResolvedQueryForm(queries);
|
||||
@@ -350,21 +286,14 @@ function queriesToResolvedQueryForm(queries) {
|
||||
},
|
||||
});
|
||||
// Only JS, python packs will be ignored
|
||||
const languagesInput = "javascript";
|
||||
const config = await configUtils.initConfig(createTestInitConfigInputs({
|
||||
languagesInput,
|
||||
configFile: configFilePath,
|
||||
configInput,
|
||||
tempDir,
|
||||
codeql,
|
||||
workspacePath: tempDir,
|
||||
}));
|
||||
const languages = "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));
|
||||
t.deepEqual(config.originalUserInput, yaml.load(configInput));
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("API client used when reading remote config", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||
const codeql = (0, codeql_1.setCodeQL)({
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
async resolveQueries() {
|
||||
return {
|
||||
byLanguage: {
|
||||
@@ -397,31 +326,20 @@ function queriesToResolvedQueryForm(queries) {
|
||||
};
|
||||
const spyGetContents = mockGetContents(dummyResponse);
|
||||
// Create checkout directory for remote queries repository
|
||||
fs.mkdirSync(path.join(tempDir, "foo/bar/dev"), { recursive: true });
|
||||
fs.mkdirSync(path.join(tmpDir, "foo/bar/dev"), { recursive: true });
|
||||
const configFile = "octo-org/codeql-config/config.yaml@main";
|
||||
const languagesInput = "javascript";
|
||||
await configUtils.initConfig(createTestInitConfigInputs({
|
||||
languagesInput,
|
||||
configFile,
|
||||
tempDir,
|
||||
codeql,
|
||||
workspacePath: tempDir,
|
||||
}));
|
||||
const languages = "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));
|
||||
t.assert(spyGetContents.called);
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("Remote config handles the case where a directory is provided", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
const dummyResponse = []; // directories are returned as arrays
|
||||
mockGetContents(dummyResponse);
|
||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||
try {
|
||||
await configUtils.initConfig(createTestInitConfigInputs({
|
||||
configFile: repoReference,
|
||||
tempDir,
|
||||
codeql: (0, codeql_1.getCachedCodeQL)(),
|
||||
workspacePath: tempDir,
|
||||
}));
|
||||
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));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -430,19 +348,14 @@ function queriesToResolvedQueryForm(queries) {
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("Invalid format of remote config handled correctly", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
const dummyResponse = {
|
||||
// note no "content" property here
|
||||
};
|
||||
mockGetContents(dummyResponse);
|
||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||
try {
|
||||
await configUtils.initConfig(createTestInitConfigInputs({
|
||||
configFile: repoReference,
|
||||
tempDir,
|
||||
codeql: (0, codeql_1.getCachedCodeQL)(),
|
||||
workspacePath: tempDir,
|
||||
}));
|
||||
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));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -451,9 +364,9 @@ function queriesToResolvedQueryForm(queries) {
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("No detected languages", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
mockListLanguages([]);
|
||||
const codeql = (0, codeql_1.setCodeQL)({
|
||||
const codeQL = (0, codeql_1.setCodeQL)({
|
||||
async resolveLanguages() {
|
||||
return {};
|
||||
},
|
||||
@@ -462,11 +375,7 @@ function queriesToResolvedQueryForm(queries) {
|
||||
},
|
||||
});
|
||||
try {
|
||||
await configUtils.initConfig(createTestInitConfigInputs({
|
||||
tempDir,
|
||||
codeql,
|
||||
workspacePath: tempDir,
|
||||
}));
|
||||
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));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
catch (err) {
|
||||
@@ -475,15 +384,10 @@ function queriesToResolvedQueryForm(queries) {
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("Unknown languages", async (t) => {
|
||||
return await (0, util_1.withTmpDir)(async (tempDir) => {
|
||||
const languagesInput = "rubbish,english";
|
||||
return await (0, util_1.withTmpDir)(async (tmpDir) => {
|
||||
const languages = "rubbish,english";
|
||||
try {
|
||||
await configUtils.initConfig(createTestInitConfigInputs({
|
||||
languagesInput,
|
||||
tempDir,
|
||||
codeql: (0, codeql_1.getCachedCodeQL)(),
|
||||
workspacePath: tempDir,
|
||||
}));
|
||||
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));
|
||||
throw new Error("initConfig did not throw error");
|
||||
}
|
||||
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,6 +33,7 @@ const sinon = __importStar(require("sinon"));
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const apiClient = __importStar(require("./api-client"));
|
||||
const codeql_1 = require("./codeql");
|
||||
const config_utils_1 = require("./config-utils");
|
||||
const database_upload_1 = require("./database-upload");
|
||||
const languages_1 = require("./languages");
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
@@ -48,10 +49,20 @@ const testApiDetails = {
|
||||
apiURL: undefined,
|
||||
};
|
||||
function getTestConfig(tmpDir) {
|
||||
return (0, testing_utils_1.createTestConfig)({
|
||||
return {
|
||||
languages: [languages_1.Language.javascript],
|
||||
originalUserInput: {},
|
||||
tempDir: tmpDir,
|
||||
codeQLCmd: "foo",
|
||||
gitHubVersion: { type: util_1.GitHubVariant.DOTCOM },
|
||||
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) {
|
||||
// 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.1",
|
||||
"cliVersion": "2.16.1",
|
||||
"priorBundleVersion": "codeql-bundle-v2.16.0",
|
||||
"priorCliVersion": "2.16.0"
|
||||
"bundleVersion": "codeql-bundle-v2.16.0",
|
||||
"cliVersion": "2.16.0",
|
||||
"priorBundleVersion": "codeql-bundle-v2.15.5",
|
||||
"priorCliVersion": "2.15.5"
|
||||
}
|
||||
|
||||
8
lib/environment.js
generated
8
lib/environment.js
generated
@@ -1,12 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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;
|
||||
(function (EnvVar) {
|
||||
/** Whether the `analyze` Action completes successfully. */
|
||||
@@ -36,8 +30,6 @@ var EnvVar;
|
||||
EnvVar["HAS_WARNED_ABOUT_DISK_SPACE"] = "CODEQL_ACTION_HAS_WARNED_ABOUT_DISK_SPACE";
|
||||
/** UUID representing the current job run. */
|
||||
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";
|
||||
/**
|
||||
* 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;;;;;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"}
|
||||
{"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"}
|
||||
14
lib/feature-flags.js
generated
14
lib/feature-flags.js
generated
@@ -48,8 +48,8 @@ exports.CODEQL_VERSION_FINE_GRAINED_PARALLELISM = "2.15.1";
|
||||
*/
|
||||
var Feature;
|
||||
(function (Feature) {
|
||||
Feature["CodeqlJavaLombokEnabled"] = "codeql_java_lombok_enabled";
|
||||
Feature["CppDependencyInstallation"] = "cpp_dependency_installation_enabled";
|
||||
Feature["CppTrapCachingEnabled"] = "cpp_trap_caching_enabled";
|
||||
Feature["DisableKotlinAnalysisEnabled"] = "disable_kotlin_analysis_enabled";
|
||||
Feature["DisablePythonDependencyInstallationEnabled"] = "disable_python_dependency_installation_enabled";
|
||||
Feature["PythonDefaultIsToSkipDependencyInstallationEnabled"] = "python_default_is_to_skip_dependency_installation_enabled";
|
||||
@@ -58,16 +58,16 @@ var Feature;
|
||||
Feature["QaTelemetryEnabled"] = "qa_telemetry_enabled";
|
||||
})(Feature || (exports.Feature = Feature = {}));
|
||||
exports.featureConfig = {
|
||||
[Feature.CodeqlJavaLombokEnabled]: {
|
||||
envVar: "CODEQL_JAVA_LOMBOK",
|
||||
minimumVersion: "2.14.0",
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.CppDependencyInstallation]: {
|
||||
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
|
||||
minimumVersion: "2.15.0",
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.CppTrapCachingEnabled]: {
|
||||
envVar: "CODEQL_CPP_TRAP_CACHING",
|
||||
minimumVersion: "2.16.1",
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.DisableKotlinAnalysisEnabled]: {
|
||||
envVar: "CODEQL_DISABLE_KOTLIN_ANALYSIS",
|
||||
minimumVersion: undefined,
|
||||
@@ -105,7 +105,7 @@ exports.featureConfig = {
|
||||
// here!
|
||||
envVar: "CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION",
|
||||
minimumVersion: "2.16.0",
|
||||
defaultValue: true,
|
||||
defaultValue: false,
|
||||
},
|
||||
};
|
||||
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,8 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getFinalJobStatus = exports.run = exports.tryUploadSarifIfRunFailed = void 0;
|
||||
const core = __importStar(require("@actions/core"));
|
||||
exports.run = exports.tryUploadSarifIfRunFailed = void 0;
|
||||
const github = __importStar(require("@actions/github"));
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const api_client_1 = require("./api-client");
|
||||
@@ -33,7 +32,6 @@ const config_utils_1 = require("./config-utils");
|
||||
const environment_1 = require("./environment");
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const repository_1 = require("./repository");
|
||||
const status_report_1 = require("./status-report");
|
||||
const uploadLib = __importStar(require("./upload-lib"));
|
||||
const util_1 = require("./util");
|
||||
const workflow_1 = require("./workflow");
|
||||
@@ -83,12 +81,6 @@ async function maybeUploadFailedSarif(config, repositoryNwo, features, logger) {
|
||||
}
|
||||
async function tryUploadSarifIfRunFailed(config, repositoryNwo, features, logger) {
|
||||
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 {
|
||||
return await maybeUploadFailedSarif(config, repositoryNwo, features, logger);
|
||||
}
|
||||
@@ -98,7 +90,6 @@ async function tryUploadSarifIfRunFailed(config, repositoryNwo, features, logger
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.exportVariable(environment_1.EnvVar.JOB_STATUS, process.env[environment_1.EnvVar.JOB_STATUS] ?? status_report_1.JobStatus.Success);
|
||||
return {
|
||||
upload_failed_run_skipped_because: "Analyze Action completed successfully",
|
||||
};
|
||||
@@ -194,19 +185,4 @@ 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.");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
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,7 +59,6 @@ async function runWrapper() {
|
||||
const statusReport = {
|
||||
...statusReportBase,
|
||||
...uploadFailedSarifResult,
|
||||
job_status: initActionPostHelper.getFinalJobStatus(),
|
||||
};
|
||||
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;AAOhB,KAAK,UAAU,UAAU;IACvB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,IAAI,uBAES,CAAC;IACd,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;QAClC,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;QAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAEjD,MAAM,aAAa,GAAG,IAAA,+BAAkB,EACtC,IAAA,0BAAmB,EAAC,mBAAmB,CAAC,CACzC,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,wBAAQ,CAC3B,aAAa,EACb,aAAa,EACb,IAAA,oCAAqB,GAAE,EACvB,MAAM,CACP,CAAC;QAEF,uBAAuB,GAAG,MAAM,oBAAoB,CAAC,GAAG,CACtD,cAAc,CAAC,iCAAiC,EAChD,cAAc,CAAC,uBAAuB,EACtC,6BAAc,EACd,aAAa,EACb,QAAQ,EACR,MAAM,CACP,CAAC;IACJ,CAAC;IAAC,OAAO,cAAc,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,IAAA,gBAAS,EAAC,cAAc,CAAC,CAAC;QACxC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE9B,MAAM,IAAA,gCAAgB,EACpB,MAAM,IAAA,sCAAsB,EAC1B,WAAW,EACX,IAAA,gCAAgB,EAAC,KAAK,CAAC,EACvB,SAAS,EACT,MAAM,IAAA,qBAAc,GAAE,EACtB,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,KAAK,CACZ,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"}
|
||||
{"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,UAA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AAgB,EAAC,YAAY,CAAC,CAAC;AACvC,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
54
lib/init-action.js
generated
54
lib/init-action.js
generated
@@ -137,30 +137,12 @@ async function run() {
|
||||
logger.info("Detected no issues with the code scanning workflow.");
|
||||
}
|
||||
core.endGroup();
|
||||
config = await (0, init_1.initConfig)({
|
||||
languagesInput: (0, actions_util_1.getOptionalInput)("languages"),
|
||||
queriesInput: (0, actions_util_1.getOptionalInput)("queries"),
|
||||
packsInput: (0, actions_util_1.getOptionalInput)("packs"),
|
||||
buildModeInput: (0, actions_util_1.getOptionalInput)("build-mode"),
|
||||
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,
|
||||
});
|
||||
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(),
|
||||
// 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`).
|
||||
(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);
|
||||
await (0, init_1.checkInstallPython311)(config.languages, codeql);
|
||||
if (config.languages.includes(languages_1.Language.python) &&
|
||||
(0, actions_util_1.getRequiredInput)("setup-python-dependencies") === "true") {
|
||||
@@ -185,6 +167,8 @@ async function run() {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// Query CLI for supported features
|
||||
const versionInfo = await codeql.getVersion();
|
||||
// Forward Go flags
|
||||
const goFlags = process.env["GOFLAGS"];
|
||||
if (goFlags) {
|
||||
@@ -201,7 +185,7 @@ async function run() {
|
||||
// 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.
|
||||
if (fileOutput.includes("statically linked") &&
|
||||
!(await codeql.supportsFeature(tools_features_1.ToolsFeature.IndirectTracingSupportsStaticBinaries))) {
|
||||
!(0, tools_features_1.isSupportedToolsFeature)(versionInfo, tools_features_1.ToolsFeature.IndirectTracingSupportsStaticBinaries)) {
|
||||
try {
|
||||
logger.debug(`Applying static binary workaround for Go`);
|
||||
// Create a directory that we can add to the system PATH.
|
||||
@@ -247,31 +231,17 @@ async function run() {
|
||||
!(await (0, util_1.codeQlVersionAbove)(codeql, "2.14.4"))) {
|
||||
core.exportVariable(kotlinLimitVar, "1.9.20");
|
||||
}
|
||||
if (config.languages.includes(languages_1.Language.java) &&
|
||||
// Java Lombok support is enabled by default for >= 2.14.4
|
||||
(await (0, util_1.codeQlVersionAbove)(codeql, "2.14.0")) &&
|
||||
!(await (0, util_1.codeQlVersionAbove)(codeql, "2.14.4"))) {
|
||||
if (config.languages.includes(languages_1.Language.java)) {
|
||||
const envVar = "CODEQL_EXTRACTOR_JAVA_RUN_ANNOTATION_PROCESSORS";
|
||||
if (process.env[envVar]) {
|
||||
logger.info(`Environment variable ${envVar} already set. Not en/disabling CodeQL Java Lombok support`);
|
||||
}
|
||||
else {
|
||||
else if (await features.getValue(feature_flags_1.Feature.CodeqlJavaLombokEnabled, codeql)) {
|
||||
logger.info("Enabling CodeQL Java Lombok support");
|
||||
core.exportVariable(envVar, "true");
|
||||
}
|
||||
}
|
||||
if (config.languages.includes(languages_1.Language.cpp)) {
|
||||
const envVar = "CODEQL_EXTRACTOR_CPP_TRAP_CACHING";
|
||||
if (process.env[envVar]) {
|
||||
logger.info(`Environment variable ${envVar} already set. Not en/disabling CodeQL C++ TRAP caching support`);
|
||||
}
|
||||
else if (getTrapCachingEnabled() &&
|
||||
(await features.getValue(feature_flags_1.Feature.CppTrapCachingEnabled, codeql))) {
|
||||
logger.info("Enabling CodeQL C++ TRAP caching support");
|
||||
core.exportVariable(envVar, "true");
|
||||
}
|
||||
else {
|
||||
logger.info("Disabling CodeQL C++ TRAP caching support");
|
||||
logger.info("Disabling CodeQL Java Lombok support");
|
||||
core.exportVariable(envVar, "false");
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
7
lib/init.js
generated
7
lib/init.js
generated
@@ -41,10 +41,9 @@ async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVe
|
||||
return { codeql, toolsDownloadDurationMs, toolsSource, toolsVersion };
|
||||
}
|
||||
exports.initCodeQL = initCodeQL;
|
||||
async function initConfig(inputs) {
|
||||
const logger = inputs.logger;
|
||||
async function initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, configInput, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger) {
|
||||
logger.startGroup("Load language configuration");
|
||||
const config = await configUtils.initConfig(inputs);
|
||||
const config = await configUtils.initConfig(languagesInput, queriesInput, packsInput, configFile, dbLocation, configInput, trapCachingEnabled, debugMode, debugArtifactName, debugDatabaseName, repository, tempDir, codeQL, workspacePath, gitHubVersion, apiDetails, logger);
|
||||
printPathFiltersWarning(config, logger);
|
||||
logger.endGroup();
|
||||
return config;
|
||||
@@ -64,7 +63,7 @@ async function runInit(codeql, config, sourceRoot, processName, registriesInput,
|
||||
catch (e) {
|
||||
throw processError(e);
|
||||
}
|
||||
return await (0, tracer_config_1.getCombinedTracerConfig)(codeql, config);
|
||||
return await (0, tracer_config_1.getCombinedTracerConfig)(await codeql.getVersion(), config);
|
||||
}
|
||||
exports.runInit = runInit;
|
||||
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;AAG1D,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,CAA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AqG;YACrG,oGAAoG;YACpG,iDAAiD,CACpD,CAAC;QACF,OAAO;IACT,CAAC;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAzCD,8CAyCC"}
|
||||
30
lib/status-report.js
generated
30
lib/status-report.js
generated
@@ -23,21 +23,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.sendStatusReport = exports.createStatusReportBase = exports.getActionsStatus = exports.JobStatus = void 0;
|
||||
exports.sendStatusReport = exports.createStatusReportBase = exports.getActionsStatus = void 0;
|
||||
const os = __importStar(require("os"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const api_client_1 = require("./api-client");
|
||||
const environment_1 = require("./environment");
|
||||
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) {
|
||||
if (error || otherFailureCause) {
|
||||
return error instanceof util_1.UserError ? "user-error" : "failure";
|
||||
@@ -47,19 +39,6 @@ function getActionsStatus(error, otherFailureCause) {
|
||||
}
|
||||
}
|
||||
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.
|
||||
*
|
||||
@@ -103,7 +82,9 @@ async function createStatusReportBase(actionName, status, actionStartedAt, diskI
|
||||
job_name: jobName,
|
||||
job_run_uuid: jobRunUUID,
|
||||
ref,
|
||||
runner_available_disk_space_bytes: diskInfo.numAvailableBytes,
|
||||
runner_os: runnerOs,
|
||||
runner_total_disk_space_bytes: diskInfo.numTotalBytes,
|
||||
started_at: workflowStartedAt,
|
||||
status,
|
||||
testing_environment: testingEnvironment,
|
||||
@@ -111,10 +92,6 @@ async function createStatusReportBase(actionName, status, actionStartedAt, diskI
|
||||
workflow_run_attempt: workflowRunAttempt,
|
||||
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
|
||||
if (cause) {
|
||||
statusReport.cause = cause;
|
||||
@@ -164,7 +141,6 @@ const INCOMPATIBLE_MSG = "CodeQL Action version is incompatible with the code sc
|
||||
* Returns whether sending the status report was successful of not.
|
||||
*/
|
||||
async function sendStatusReport(statusReport) {
|
||||
setJobStatusIfUnsuccessful(statusReport.status);
|
||||
const statusReportJSON = JSON.stringify(statusReport);
|
||||
core.debug(`Sending status report: ${statusReportJSON}`);
|
||||
// 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 };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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;
|
||||
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 path_1 = __importDefault(require("path"));
|
||||
const github = __importStar(require("@actions/github"));
|
||||
const nock_1 = __importDefault(require("nock"));
|
||||
const sinon = __importStar(require("sinon"));
|
||||
const apiClient = __importStar(require("./api-client"));
|
||||
const codeql = __importStar(require("./codeql"));
|
||||
const CodeQL = __importStar(require("./codeql"));
|
||||
const util_1 = require("./util");
|
||||
exports.SAMPLE_DOTCOM_API_DETAILS = {
|
||||
auth: "token",
|
||||
@@ -74,7 +74,7 @@ function setupTests(test) {
|
||||
typedTest.beforeEach((t) => {
|
||||
// Set an empty CodeQL object so that all method calls will fail
|
||||
// unless the test explicitly sets one up.
|
||||
codeql.setCodeQL({});
|
||||
CodeQL.setCodeQL({});
|
||||
// Replace stdout and stderr so we can record output during tests
|
||||
t.context.testOutput = "";
|
||||
const processStdoutWrite = process.stdout.write.bind(process.stdout);
|
||||
@@ -196,11 +196,11 @@ const makeVersionInfo = (version, features) => ({
|
||||
});
|
||||
exports.makeVersionInfo = makeVersionInfo;
|
||||
function mockCodeQLVersion(version, features) {
|
||||
return codeql.setCodeQL({
|
||||
return {
|
||||
async getVersion() {
|
||||
return (0, exports.makeVersionInfo)(version, features);
|
||||
},
|
||||
});
|
||||
};
|
||||
}
|
||||
exports.mockCodeQLVersion = mockCodeQLVersion;
|
||||
/**
|
||||
@@ -241,27 +241,4 @@ function mockBundleDownloadApi({ apiDetails = exports.SAMPLE_DOTCOM_API_DETAILS,
|
||||
return `${baseUrl}${relativeUrl}`;
|
||||
}
|
||||
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
|
||||
File diff suppressed because one or more lines are too long
1
lib/tools-features.js
generated
1
lib/tools-features.js
generated
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isSupportedToolsFeature = exports.ToolsFeature = void 0;
|
||||
var ToolsFeature;
|
||||
(function (ToolsFeature) {
|
||||
ToolsFeature["BuildModeOption"] = "buildModeOption";
|
||||
ToolsFeature["IndirectTracingSupportsStaticBinaries"] = "indirectTracingSupportsStaticBinaries";
|
||||
ToolsFeature["SetsCodeqlRunnerEnvVar"] = "setsCodeqlRunnerEnvVar";
|
||||
})(ToolsFeature || (exports.ToolsFeature = ToolsFeature = {}));
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"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"}
|
||||
{"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"}
|
||||
4
lib/tracer-config.js
generated
4
lib/tracer-config.js
generated
@@ -59,7 +59,7 @@ async function getTracerConfigForCluster(config) {
|
||||
};
|
||||
}
|
||||
exports.getTracerConfigForCluster = getTracerConfigForCluster;
|
||||
async function getCombinedTracerConfig(codeql, config) {
|
||||
async function getCombinedTracerConfig(versionInfo, config) {
|
||||
// Abort if there are no traced languages as there's nothing to do
|
||||
const tracedLanguages = config.languages.filter((l) => (0, languages_1.isTracedLanguage)(l));
|
||||
if (tracedLanguages.length === 0) {
|
||||
@@ -68,7 +68,7 @@ async function getCombinedTracerConfig(codeql, config) {
|
||||
const mainTracerConfig = await getTracerConfigForCluster(config);
|
||||
// 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.
|
||||
if (!(await codeql.supportsFeature(tools_features_1.ToolsFeature.SetsCodeqlRunnerEnvVar))) {
|
||||
if (!(0, tools_features_1.isSupportedToolsFeature)(versionInfo, tools_features_1.ToolsFeature.SetsCodeqlRunnerEnvVar)) {
|
||||
// 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
|
||||
// it here via the CODEQL_RUNNER environment variable.
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"tracer-config.js","sourceRoot":"","sources":["../src/tracer-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAI7B,2CAA+C;AAC/C,qDAAgD;AAMzC,KAAK,UAAU,oBAAoB,CACxC,MAA0B;IAE1B,kEAAkE;IAClE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,4BAAgB,EAAC,CAAC,CAAC,CAAC;QAAE,OAAO;IAE/D,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CACnC,MAAM,CAAC,UAAU,EACjB,0CAA0C,CAC3C,CAAC;IACF,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CACb,kDAAkD,gBAAgB,EAAE,CACrE,CAAC;IACJ,CAAC;IACD,IAAI,CAAC;QACH,MAAM,sBAAsB,GAA+B,IAAI,CAAC,KAAK,CACnE,EAAE,CAAC,YAAY,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAC1C,CAAC;QACF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE,CAAC;YAClE,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBACnB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACN,OAAO,OAAO,C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,CAAC,EACvC,aAAa,CACd,CAAC;IACJ,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAjCD,0DAiCC"}
|
||||
26
lib/tracer-config.test.js
generated
26
lib/tracer-config.test.js
generated
@@ -29,24 +29,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const ava_1 = __importDefault(require("ava"));
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const languages_1 = require("./languages");
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
const tracer_config_1 = require("./tracer-config");
|
||||
const util = __importStar(require("./util"));
|
||||
(0, testing_utils_1.setupTests)(ava_1.default);
|
||||
function getTestConfig(tempDir) {
|
||||
return (0, testing_utils_1.createTestConfig)({
|
||||
function getTestConfig(tmpDir) {
|
||||
return {
|
||||
languages: [languages_1.Language.java],
|
||||
tempDir,
|
||||
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||
});
|
||||
originalUserInput: {},
|
||||
tempDir: tmpDir,
|
||||
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) => {
|
||||
await util.withTmpDir(async (tmpDir) => {
|
||||
const config = getTestConfig(tmpDir);
|
||||
// No traced languages
|
||||
config.languages = [languages_1.Language.javascript, languages_1.Language.python];
|
||||
t.deepEqual(await (0, tracer_config_1.getCombinedTracerConfig)((0, testing_utils_1.mockCodeQLVersion)("1.0.0"), config), undefined);
|
||||
t.deepEqual(await (0, tracer_config_1.getCombinedTracerConfig)((0, testing_utils_1.makeVersionInfo)("1.0.0"), config), undefined);
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("getCombinedTracerConfig - with start-tracing.json environment file", async (t) => {
|
||||
@@ -67,7 +77,7 @@ function getTestConfig(tempDir) {
|
||||
fs.mkdirSync(tracingEnvironmentDir, { recursive: true });
|
||||
const startTracingJson = path.join(tracingEnvironmentDir, "start-tracing.json");
|
||||
fs.writeFileSync(startTracingJson, JSON.stringify(startTracingEnv));
|
||||
const result = await (0, tracer_config_1.getCombinedTracerConfig)((0, testing_utils_1.mockCodeQLVersion)("1.0.0"), config);
|
||||
const result = await (0, tracer_config_1.getCombinedTracerConfig)((0, testing_utils_1.makeVersionInfo)("1.0.0"), config);
|
||||
t.notDeepEqual(result, undefined);
|
||||
const expectedEnv = startTracingEnv;
|
||||
if (process.platform === "win32") {
|
||||
@@ -102,7 +112,7 @@ function getTestConfig(tempDir) {
|
||||
fs.mkdirSync(tracingEnvironmentDir, { recursive: true });
|
||||
const startTracingJson = path.join(tracingEnvironmentDir, "start-tracing.json");
|
||||
fs.writeFileSync(startTracingJson, JSON.stringify(startTracingEnv));
|
||||
const result = await (0, tracer_config_1.getCombinedTracerConfig)((0, testing_utils_1.mockCodeQLVersion)("1.0.0", { setsCodeqlRunnerEnvVar: true }), config);
|
||||
const result = await (0, tracer_config_1.getCombinedTracerConfig)((0, testing_utils_1.makeVersionInfo)("1.0.0", { setsCodeqlRunnerEnvVar: true }), config);
|
||||
t.notDeepEqual(result, undefined);
|
||||
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;AAGvB,2CA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rC,MAAM,CAAC,UAAU,EACjB,MAAM,EACN,oBAAoB,CACrB,CAAC;QACF,EAAE,CAAC,SAAS,CAAC,qBAAqB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAChC,qBAAqB,EACrB,oBAAoB,CACrB,CAAC;QACF,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC;QAEpE,MAAM,MAAM,GAAG,MAAM,IAAA,uCAAuB,EAC1C,IAAA,+BAAe,EAAC,OAAO,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,EAC1D,MAAM,CACP,CAAC;QACF,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAElC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,eAAe,CAAC,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
||||
46
lib/trap-caching.test.js
generated
46
lib/trap-caching.test.js
generated
@@ -78,22 +78,48 @@ const stubCodeql = (0, codeql_1.setCodeQL)({
|
||||
};
|
||||
},
|
||||
});
|
||||
const testConfigWithoutTmpDir = (0, testing_utils_1.createTestConfig)({
|
||||
const testConfigWithoutTmpDir = {
|
||||
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: {
|
||||
javascript: "/some/cache/dir",
|
||||
},
|
||||
});
|
||||
function getTestConfigWithTempDir(tempDir) {
|
||||
return (0, testing_utils_1.createTestConfig)({
|
||||
trapCacheDownloadTime: 0,
|
||||
};
|
||||
function getTestConfigWithTempDir(tmpDir) {
|
||||
return {
|
||||
languages: [languages_1.Language.javascript, languages_1.Language.ruby],
|
||||
tempDir,
|
||||
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||
trapCaches: {
|
||||
javascript: path.resolve(tempDir, "jsCache"),
|
||||
ruby: path.resolve(tempDir, "rubyCache"),
|
||||
originalUserInput: {},
|
||||
tempDir: tmpDir,
|
||||
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: {
|
||||
javascript: path.resolve(tmpDir, "jsCache"),
|
||||
ruby: path.resolve(tmpDir, "rubyCache"),
|
||||
},
|
||||
trapCacheDownloadTime: 0,
|
||||
};
|
||||
}
|
||||
(0, ava_1.default)("check flags for JS, analyzing default branch", async (t) => {
|
||||
await util.withTmpDir(async (tmpDir) => {
|
||||
|
||||
File diff suppressed because one or more lines are too long
101
lib/util.js
generated
101
lib/util.js
generated
@@ -247,18 +247,7 @@ exports.getAddSnippetsFlag = getAddSnippetsFlag;
|
||||
*/
|
||||
function getThreadsFlagValue(userInput, logger) {
|
||||
let numThreads;
|
||||
const maxThreadsCandidates = [os.cpus().length];
|
||||
if (os.platform() === "linux") {
|
||||
maxThreadsCandidates.push(...["/sys/fs/cgroup/cpuset.cpus.effective", "/sys/fs/cgroup/cpuset.cpus"]
|
||||
.map((file) => getCgroupCpuCountFromCpus(file, logger))
|
||||
.filter((count) => count !== undefined && count > 0)
|
||||
.map((count) => count));
|
||||
maxThreadsCandidates.push(...["/sys/fs/cgroup/cpu.max"]
|
||||
.map((file) => getCgroupCpuCountFromCpuMax(file, logger))
|
||||
.filter((count) => count !== undefined && count > 0)
|
||||
.map((count) => count));
|
||||
}
|
||||
const maxThreads = Math.min(...maxThreadsCandidates);
|
||||
const maxThreads = os.cpus().length;
|
||||
if (userInput) {
|
||||
numThreads = Number(userInput);
|
||||
if (Number.isNaN(numThreads)) {
|
||||
@@ -281,56 +270,6 @@ function getThreadsFlagValue(userInput, logger) {
|
||||
return numThreads;
|
||||
}
|
||||
exports.getThreadsFlagValue = getThreadsFlagValue;
|
||||
/**
|
||||
* Gets the number of available cores specified by the cgroup cpu.max file at the given path.
|
||||
* Format of file: two values, the limit and the duration (period). If the limit is "max" then
|
||||
* we return undefined and do not use this file to determine CPU limits.
|
||||
*/
|
||||
function getCgroupCpuCountFromCpuMax(cpuMaxFile, logger) {
|
||||
if (!fs.existsSync(cpuMaxFile)) {
|
||||
logger.debug(`While resolving threads, did not find a cgroup CPU file at ${cpuMaxFile}.`);
|
||||
return undefined;
|
||||
}
|
||||
const cpuMaxString = fs.readFileSync(cpuMaxFile, "utf-8");
|
||||
const cpuMaxStringSplit = cpuMaxString.split(" ");
|
||||
if (cpuMaxStringSplit.length !== 2) {
|
||||
logger.debug(`While resolving threads, did not use cgroup CPU file at ${cpuMaxFile} because it contained ${cpuMaxStringSplit.length} value(s) rather than the two expected.`);
|
||||
return undefined;
|
||||
}
|
||||
const cpuLimit = cpuMaxStringSplit[0];
|
||||
if (cpuLimit === "max") {
|
||||
return undefined;
|
||||
}
|
||||
const duration = cpuMaxStringSplit[1];
|
||||
const cpuCount = Math.floor(parseInt(cpuLimit) / parseInt(duration));
|
||||
logger.info(`While resolving threads, found a cgroup CPU file with ${cpuCount} CPUs in ${cpuMaxFile}.`);
|
||||
return cpuCount;
|
||||
}
|
||||
/**
|
||||
* Gets the number of available cores listed in the cgroup cpuset.cpus file at the given path.
|
||||
*/
|
||||
function getCgroupCpuCountFromCpus(cpusFile, logger) {
|
||||
if (!fs.existsSync(cpusFile)) {
|
||||
logger.debug(`While resolving threads, did not find a cgroup CPUs file at ${cpusFile}.`);
|
||||
return undefined;
|
||||
}
|
||||
let cpuCount = 0;
|
||||
// Comma-separated numbers and ranges, for eg. 0-1,3
|
||||
const cpusString = fs.readFileSync(cpusFile, "utf-8");
|
||||
for (const token of cpusString.split(",")) {
|
||||
if (!token.includes("-")) {
|
||||
// Not a range
|
||||
++cpuCount;
|
||||
}
|
||||
else {
|
||||
const cpuStartIndex = parseInt(token.split("-")[0]);
|
||||
const cpuEndIndex = parseInt(token.split("-")[1]);
|
||||
cpuCount += cpuEndIndex - cpuStartIndex + 1;
|
||||
}
|
||||
}
|
||||
logger.info(`While resolving threads, found a cgroup CPUs file with ${cpuCount} CPUs in ${cpusFile}.`);
|
||||
return cpuCount;
|
||||
}
|
||||
/**
|
||||
* Get the codeql `--threads` flag specified for the `threads` input.
|
||||
* If no value was specified, all available threads will be used.
|
||||
@@ -789,35 +728,27 @@ function prettyPrintPack(pack) {
|
||||
}
|
||||
exports.prettyPrintPack = prettyPrintPack;
|
||||
async function checkDiskUsage(logger) {
|
||||
try {
|
||||
const diskUsage = await (0, check_disk_space_1.default)(getRequiredEnvParam("GITHUB_WORKSPACE"));
|
||||
const gbInBytes = 1024 * 1024 * 1024;
|
||||
if (logger && diskUsage.free < 2 * gbInBytes) {
|
||||
const message = "The Actions runner is running low on disk space " +
|
||||
`(${(diskUsage.free / gbInBytes).toPrecision(4)} GB available).`;
|
||||
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");
|
||||
const diskUsage = await (0, check_disk_space_1.default)(getRequiredEnvParam("GITHUB_WORKSPACE"));
|
||||
const gbInBytes = 1024 * 1024 * 1024;
|
||||
if (logger && diskUsage.free < 2 * gbInBytes) {
|
||||
const message = "The Actions runner is running low on disk space " +
|
||||
`(${(diskUsage.free / gbInBytes).toPrecision(4)} GB available).`;
|
||||
if (process.env[environment_1.EnvVar.HAS_WARNED_ABOUT_DISK_SPACE] !== "true") {
|
||||
logger.warning(message);
|
||||
}
|
||||
return {
|
||||
numAvailableBytes: diskUsage.free,
|
||||
numTotalBytes: diskUsage.size,
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
if (logger) {
|
||||
logger.warning(`Failed to check available disk space: ${getErrorMessage(error)}`);
|
||||
else {
|
||||
logger.debug(message);
|
||||
}
|
||||
return undefined;
|
||||
core.exportVariable(environment_1.EnvVar.HAS_WARNED_ABOUT_DISK_SPACE, "true");
|
||||
}
|
||||
return {
|
||||
numAvailableBytes: diskUsage.free,
|
||||
numTotalBytes: diskUsage.size,
|
||||
};
|
||||
}
|
||||
exports.checkDiskUsage = checkDiskUsage;
|
||||
/**
|
||||
* Prompt the customer to upgrade to CodeQL Action v3, if appropriate.
|
||||
* Prompt the customer to upgrade to CodeQL Action v2, if appropriate.
|
||||
*
|
||||
* Check whether a customer is running v2. If they are, and we can determine that the GitHub
|
||||
* instance supports v3, then log a warning about v2's upcoming deprecation prompting the customer
|
||||
|
||||
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",
|
||||
"version": "2.24.0",
|
||||
"version": "2.23.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
@@ -952,21 +952,21 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/uuid": {
|
||||
"version": "9.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz",
|
||||
"integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="
|
||||
"version": "9.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.7.tgz",
|
||||
"integrity": "sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g=="
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.20.0.tgz",
|
||||
"integrity": "sha512-fTwGQUnjhoYHeSF6m5pWNkzmDDdsKELYrOBxhjMrofPqCkoC2k3B2wvGHFxa1CTIqkEn88nlW1HVMztjo2K8Hg==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.0.tgz",
|
||||
"integrity": "sha512-DUCUkQNklCQYnrBSSikjVChdc84/vMPDQSgJTHBZ64G9bA9w0Crc0rd2diujKbTdp6w2J47qkeHQLoi0rpLCdg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.5.1",
|
||||
"@typescript-eslint/scope-manager": "6.20.0",
|
||||
"@typescript-eslint/type-utils": "6.20.0",
|
||||
"@typescript-eslint/utils": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||
"@typescript-eslint/scope-manager": "6.19.0",
|
||||
"@typescript-eslint/type-utils": "6.19.0",
|
||||
"@typescript-eslint/utils": "6.19.0",
|
||||
"@typescript-eslint/visitor-keys": "6.19.0",
|
||||
"debug": "^4.3.4",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.2.4",
|
||||
@@ -992,15 +992,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz",
|
||||
"integrity": "sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.19.0.tgz",
|
||||
"integrity": "sha512-1DyBLG5SH7PYCd00QlroiW60YJ4rWMuUGa/JBV0iZuqi4l4IK3twKPq5ZkEebmGqRjXWVgsUzfd3+nZveewgow==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "6.20.0",
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||
"@typescript-eslint/scope-manager": "6.19.0",
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"@typescript-eslint/typescript-estree": "6.19.0",
|
||||
"@typescript-eslint/visitor-keys": "6.19.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1020,13 +1020,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.20.0.tgz",
|
||||
"integrity": "sha512-p4rvHQRDTI1tGGMDFQm+GtxP1ZHyAh64WANVoyEcNMpaTFn3ox/3CcgtIlELnRfKzSs/DwYlDccJEtr3O6qBvA==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.19.0.tgz",
|
||||
"integrity": "sha512-dO1XMhV2ehBI6QN8Ufi7I10wmUovmLU0Oru3n5LVlM2JuzB4M+dVphCPLkVpKvGij2j/pHBWuJ9piuXx+BhzxQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0"
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"@typescript-eslint/visitor-keys": "6.19.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^16.0.0 || >=18.0.0"
|
||||
@@ -1037,13 +1037,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.20.0.tgz",
|
||||
"integrity": "sha512-qnSobiJQb1F5JjN0YDRPHruQTrX7ICsmltXhkV536mp4idGAYrIyr47zF/JmkJtEcAVnIz4gUYJ7gOZa6SmN4g==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.19.0.tgz",
|
||||
"integrity": "sha512-mcvS6WSWbjiSxKCwBcXtOM5pRkPQ6kcDds/juxcy/727IQr3xMEcwr/YLHW2A2+Fp5ql6khjbKBzOyjuPqGi/w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||
"@typescript-eslint/utils": "6.20.0",
|
||||
"@typescript-eslint/typescript-estree": "6.19.0",
|
||||
"@typescript-eslint/utils": "6.19.0",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^1.0.1"
|
||||
},
|
||||
@@ -1064,9 +1064,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz",
|
||||
"integrity": "sha512-MM9mfZMAhiN4cOEcUOEx+0HmuaW3WBfukBZPCfwSqFnQy0grXYtngKCqpQN339X3RrwtzspWJrpbrupKYUSBXQ==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.19.0.tgz",
|
||||
"integrity": "sha512-lFviGV/vYhOy3m8BJ/nAKoAyNhInTdXpftonhWle66XHAtT1ouBlkjL496b5H5hb8dWXHwtypTqgtb/DEa+j5A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^16.0.0 || >=18.0.0"
|
||||
@@ -1077,13 +1077,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.20.0.tgz",
|
||||
"integrity": "sha512-RnRya9q5m6YYSpBN7IzKu9FmLcYtErkDkc8/dKv81I9QiLLtVBHrjz+Ev/crAqgMNW2FCsoZF4g2QUylMnJz+g==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.0.tgz",
|
||||
"integrity": "sha512-o/zefXIbbLBZ8YJ51NlkSAt2BamrK6XOmuxSR3hynMIzzyMY33KuJ9vuMdFSXW+H0tVvdF9qBPTHA91HDb4BIQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"@typescript-eslint/visitor-keys": "6.19.0",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
@@ -1129,17 +1129,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.20.0.tgz",
|
||||
"integrity": "sha512-/EKuw+kRu2vAqCoDwDCBtDRU6CTKbUmwwI7SH7AashZ+W+7o8eiyy6V2cdOqN49KsTcASWsC5QeghYuRDTyOOg==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.19.0.tgz",
|
||||
"integrity": "sha512-QR41YXySiuN++/dC9UArYOg4X86OAYP83OWTewpVx5ct1IZhjjgTLocj7QNxGhWoTqknsgpl7L+hGygCO+sdYw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@types/json-schema": "^7.0.12",
|
||||
"@types/semver": "^7.5.0",
|
||||
"@typescript-eslint/scope-manager": "6.20.0",
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||
"@typescript-eslint/scope-manager": "6.19.0",
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"@typescript-eslint/typescript-estree": "6.19.0",
|
||||
"semver": "^7.5.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1154,12 +1154,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.20.0.tgz",
|
||||
"integrity": "sha512-E8Cp98kRe4gKHjJD4NExXKz/zOJ1A2hhZc+IMVD6i7w4yjIvh6VyuRI0gRtxAsXtoC35uGMaQ9rjI2zJaXDEAw==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.0.tgz",
|
||||
"integrity": "sha512-hZaUCORLgubBvtGpp1JEFEazcuEdfxta9j4iUwdSAr7mEsYYAp3EAUyCZk3VEEqGj6W+AV4uWyrDGtrlawAsgQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"eslint-visitor-keys": "^3.4.1"
|
||||
},
|
||||
"engines": {
|
||||
@@ -4561,9 +4561,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/nock": {
|
||||
"version": "13.5.1",
|
||||
"resolved": "https://registry.npmjs.org/nock/-/nock-13.5.1.tgz",
|
||||
"integrity": "sha512-+s7b73fzj5KnxbKH4Oaqz07tQ8degcMilU4rrmnKvI//b0JMBU4wEXFQ8zqr+3+L4eWSfU3H/UoIVGUV0tue1Q==",
|
||||
"version": "13.5.0",
|
||||
"resolved": "https://registry.npmjs.org/nock/-/nock-13.5.0.tgz",
|
||||
"integrity": "sha512-9hc1eCS2HtOz+sE9W7JQw/tXJktg0zoPSu48s/pYe73e25JW9ywiowbqnUSd7iZPeVawLcVpPZeZS312fwSY+g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"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.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Thu, 25 Jan 2024 23:07:19 GMT
|
||||
* Last updated: Tue, 07 Nov 2023 20:08:00 GMT
|
||||
* Dependencies: none
|
||||
|
||||
# Credits
|
||||
|
||||
2
node_modules/@types/uuid/index.d.mts
generated
vendored
2
node_modules/@types/uuid/index.d.mts
generated
vendored
@@ -8,5 +8,3 @@ export import version = uuid.version;
|
||||
export import validate = uuid.validate;
|
||||
export import stringify = uuid.stringify;
|
||||
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",
|
||||
"version": "9.0.8",
|
||||
"version": "9.0.7",
|
||||
"description": "TypeScript definitions for uuid",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uuid",
|
||||
"license": "MIT",
|
||||
@@ -49,6 +49,6 @@
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "ee6ba7ad17fbbead7a508faf213a9ad0f49c12929e8c6b0f05fb35129bc72d61",
|
||||
"typeScriptVersion": "4.6"
|
||||
"typesPublisherContentHash": "71fc550147b942c5824c8f2b1b9d6788b5342357a90b8f7d76e60260d05180c0",
|
||||
"typeScriptVersion": "4.5"
|
||||
}
|
||||
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: {
|
||||
type: 'boolean',
|
||||
description: 'Ignore members marked with the `override` modifier',
|
||||
description: 'Ingore members marked with the `override` modifier',
|
||||
},
|
||||
ignoreClassesThatImplementAnInterface: {
|
||||
oneOf: [
|
||||
|
||||
@@ -49,7 +49,7 @@ exports.default = (0, util_1.createRule)({
|
||||
type: 'boolean',
|
||||
},
|
||||
allowTypedFunctionExpressions: {
|
||||
description: 'Whether to ignore type annotations on the variable of a function expression.',
|
||||
description: 'Whether to ignore type annotations on the variable of a function expresion.',
|
||||
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,9 +537,7 @@ exports.default = (0, util_1.createRule)({
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
default: {
|
||||
memberTypes: exports.defaultOrder,
|
||||
},
|
||||
default: exports.defaultOrder,
|
||||
},
|
||||
],
|
||||
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
8
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-condition.js
generated
vendored
8
node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-condition.js
generated
vendored
@@ -195,10 +195,7 @@ exports.default = (0, util_1.createRule)({
|
||||
function checkNodeForNullish(node) {
|
||||
const type = (0, util_1.getConstrainedTypeAtLocation)(services, node);
|
||||
// Conditional is always necessary if it involves `any`, `unknown` or a naked type parameter
|
||||
if ((0, util_1.isTypeFlagSet)(type, ts.TypeFlags.Any |
|
||||
ts.TypeFlags.Unknown |
|
||||
ts.TypeFlags.TypeParameter |
|
||||
ts.TypeFlags.TypeVariable)) {
|
||||
if ((0, util_1.isTypeFlagSet)(type, ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.TypeParameter)) {
|
||||
return;
|
||||
}
|
||||
let messageId = null;
|
||||
@@ -263,8 +260,7 @@ exports.default = (0, util_1.createRule)({
|
||||
flag |=
|
||||
ts.TypeFlags.Any |
|
||||
ts.TypeFlags.Unknown |
|
||||
ts.TypeFlags.TypeParameter |
|
||||
ts.TypeFlags.TypeVariable;
|
||||
ts.TypeFlags.TypeParameter;
|
||||
// Allow loose comparison to nullish values.
|
||||
if (node.operator === '==' || node.operator === '!=') {
|
||||
flag |= NULL | UNDEFINED | VOID;
|
||||
|
||||
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,17 +57,6 @@ exports.default = (0, util_1.createRule)({
|
||||
}
|
||||
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 {
|
||||
TemplateLiteral(node) {
|
||||
if (node.parent.type === utils_1.AST_NODE_TYPES.TaggedTemplateExpression) {
|
||||
@@ -99,11 +88,9 @@ exports.default = (0, util_1.createRule)({
|
||||
});
|
||||
return;
|
||||
}
|
||||
const fixableExpressions = node.expressions.filter((expression) => isLiteral(expression) ||
|
||||
(0, util_1.isUndefinedIdentifier)(expression) ||
|
||||
isInfinityIdentifier(expression) ||
|
||||
isNaNIdentifier(expression));
|
||||
fixableExpressions.forEach(expression => {
|
||||
const literalsOrUndefinedExpressions = node.expressions.filter((expression) => expression.type === utils_1.AST_NODE_TYPES.Literal ||
|
||||
(0, util_1.isUndefinedIdentifier)(expression));
|
||||
literalsOrUndefinedExpressions.forEach(expression => {
|
||||
context.report({
|
||||
node: expression,
|
||||
messageId: 'noUselessTemplateLiteral',
|
||||
@@ -122,9 +109,11 @@ exports.default = (0, util_1.createRule)({
|
||||
nextQuasi.range[0] + 1,
|
||||
]),
|
||||
];
|
||||
const stringValue = (0, util_1.getStaticStringValue)(expression);
|
||||
if (stringValue != null) {
|
||||
const escapedValue = stringValue.replace(/([`$\\])/g, '\\$1');
|
||||
// Remove quotes for string literals (i.e. `'a'` will become `a`).
|
||||
const isStringLiteral = isUnderlyingTypeString(expression) &&
|
||||
expression.type === utils_1.AST_NODE_TYPES.Literal;
|
||||
if (isStringLiteral) {
|
||||
const escapedValue = expression.value.replace(/([`$\\])/g, '\\$1');
|
||||
fixes.push(fixer.replaceText(expression, escapedValue));
|
||||
}
|
||||
return fixes;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"no-useless-template-literals.js","source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MAAM,WAAW,GAAG,IAAA,2BAAoB,EAAC,UAAU,CAAC,CAAC;4BAErD,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;gCACxB,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC,WAAW,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"}
|
||||
{"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,EAAE;QACJ,OAAO,EAAE,MAAM;QACf,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,wCAAwC;YACrD,WAAW,EAAE,QAAQ;YACrB,oBAAoB,EAAE,IAAI;SAC3B;QACD,QAAQ,EAAE;YACR,wBAAwB,EACtB,mEAAmE;SACtE;QACD,MAAM,EAAE,EAAE;KACX;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,QAAQ,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;QAE5C,SAAS,sBAAsB,CAC7B,UAA+B;YAE/B,MAAM,IAAI,GAAG,IAAA,mCAA4B,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YAEhE,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAW,EAAE;gBACvC,OAAO,IAAA,oBAAa,EAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,UA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E;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"}
|
||||
@@ -350,7 +350,7 @@ function verifyForAlways(context, prevNode, nextNode, paddingLines) {
|
||||
}
|
||||
return true;
|
||||
},
|
||||
}) ?? nextNode;
|
||||
}) || nextNode;
|
||||
const insertText = (0, util_1.isTokenOnSameLine)(prevToken, nextToken)
|
||||
? '\n\n'
|
||||
: '\n';
|
||||
|
||||
@@ -240,7 +240,7 @@ exports.default = (0, util_1.createRule)({
|
||||
'LogicalExpression[operator = "||"]'(node) {
|
||||
const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);
|
||||
const type = checker.getTypeAtLocation(tsNode.left);
|
||||
if (!(0, util_1.isTypeFlagSet)(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined)) {
|
||||
if (!(0, util_1.isNullableType)(type)) {
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
if (!(tsutils.isModifierFlagSet(node, ts.ModifierFlags.Private) ||
|
||||
node.name.kind === ts.SyntaxKind.PrivateIdentifier) ||
|
||||
tsutils.isModifierFlagSet(node, ts.ModifierFlags.Accessor | ts.ModifierFlags.Readonly) ||
|
||||
tsutils.isModifierFlagSet(node, ts.ModifierFlags.Readonly) ||
|
||||
ts.isComputedPropertyName(node.name)) {
|
||||
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 typeContainsTypeParameter(type.typeAnnotation ??
|
||||
return typeContainsTypeParameter(type.typeAnnotation ||
|
||||
type.elementType);
|
||||
}
|
||||
}
|
||||
@@ -308,7 +308,7 @@ exports.default = (0, util_1.createRule)({
|
||||
function addOverload(signature, key, containingNode) {
|
||||
key ??= getOverloadKey(signature);
|
||||
if (currentScope &&
|
||||
(containingNode ?? signature).parent === currentScope.parent) {
|
||||
(containingNode || signature).parent === currentScope.parent) {
|
||||
const overloads = currentScope.overloads.get(key);
|
||||
if (overloads !== undefined) {
|
||||
overloads.push(signature);
|
||||
|
||||
329
node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md
generated
vendored
329
node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md
generated
vendored
@@ -25,7 +25,7 @@ type OrderConfig = MemberType[] | SortedOrderConfig | 'never';
|
||||
interface SortedOrderConfig {
|
||||
memberTypes?: MemberType[] | 'never';
|
||||
optionalityOrder?: 'optional-first' | 'required-first';
|
||||
order?:
|
||||
order:
|
||||
| 'alphabetically'
|
||||
| 'alphabetically-case-insensitive'
|
||||
| 'as-written'
|
||||
@@ -80,178 +80,176 @@ The default configuration looks as follows:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"default": {
|
||||
"memberTypes": [
|
||||
// Index signature
|
||||
"signature",
|
||||
"call-signature",
|
||||
"default": [
|
||||
// Index signature
|
||||
"signature",
|
||||
"call-signature",
|
||||
|
||||
// Fields
|
||||
"public-static-field",
|
||||
"protected-static-field",
|
||||
"private-static-field",
|
||||
"#private-static-field",
|
||||
// Fields
|
||||
"public-static-field",
|
||||
"protected-static-field",
|
||||
"private-static-field",
|
||||
"#private-static-field",
|
||||
|
||||
"public-decorated-field",
|
||||
"protected-decorated-field",
|
||||
"private-decorated-field",
|
||||
"public-decorated-field",
|
||||
"protected-decorated-field",
|
||||
"private-decorated-field",
|
||||
|
||||
"public-instance-field",
|
||||
"protected-instance-field",
|
||||
"private-instance-field",
|
||||
"#private-instance-field",
|
||||
"public-instance-field",
|
||||
"protected-instance-field",
|
||||
"private-instance-field",
|
||||
"#private-instance-field",
|
||||
|
||||
"public-abstract-field",
|
||||
"protected-abstract-field",
|
||||
"public-abstract-field",
|
||||
"protected-abstract-field",
|
||||
|
||||
"public-field",
|
||||
"protected-field",
|
||||
"private-field",
|
||||
"#private-field",
|
||||
"public-field",
|
||||
"protected-field",
|
||||
"private-field",
|
||||
"#private-field",
|
||||
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"abstract-field",
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"abstract-field",
|
||||
|
||||
"decorated-field",
|
||||
"decorated-field",
|
||||
|
||||
"field",
|
||||
"field",
|
||||
|
||||
// Static initialization
|
||||
"static-initialization",
|
||||
// Static initialization
|
||||
"static-initialization",
|
||||
|
||||
// Constructors
|
||||
"public-constructor",
|
||||
"protected-constructor",
|
||||
"private-constructor",
|
||||
// Constructors
|
||||
"public-constructor",
|
||||
"protected-constructor",
|
||||
"private-constructor",
|
||||
|
||||
"constructor",
|
||||
"constructor",
|
||||
|
||||
// Accessors
|
||||
"public-static-accessor",
|
||||
"protected-static-accessor",
|
||||
"private-static-accessor",
|
||||
"#private-static-accessor",
|
||||
// Accessors
|
||||
"public-static-accessor",
|
||||
"protected-static-accessor",
|
||||
"private-static-accessor",
|
||||
"#private-static-accessor",
|
||||
|
||||
"public-decorated-accessor",
|
||||
"protected-decorated-accessor",
|
||||
"private-decorated-accessor",
|
||||
"public-decorated-accessor",
|
||||
"protected-decorated-accessor",
|
||||
"private-decorated-accessor",
|
||||
|
||||
"public-instance-accessor",
|
||||
"protected-instance-accessor",
|
||||
"private-instance-accessor",
|
||||
"#private-instance-accessor",
|
||||
"public-instance-accessor",
|
||||
"protected-instance-accessor",
|
||||
"private-instance-accessor",
|
||||
"#private-instance-accessor",
|
||||
|
||||
"public-abstract-accessor",
|
||||
"protected-abstract-accessor",
|
||||
"public-abstract-accessor",
|
||||
"protected-abstract-accessor",
|
||||
|
||||
"public-accessor",
|
||||
"protected-accessor",
|
||||
"private-accessor",
|
||||
"#private-accessor",
|
||||
"public-accessor",
|
||||
"protected-accessor",
|
||||
"private-accessor",
|
||||
"#private-accessor",
|
||||
|
||||
"static-accessor",
|
||||
"instance-accessor",
|
||||
"abstract-accessor",
|
||||
"static-accessor",
|
||||
"instance-accessor",
|
||||
"abstract-accessor",
|
||||
|
||||
"decorated-accessor",
|
||||
"decorated-accessor",
|
||||
|
||||
"accessor",
|
||||
"accessor",
|
||||
|
||||
// Getters
|
||||
"public-static-get",
|
||||
"protected-static-get",
|
||||
"private-static-get",
|
||||
"#private-static-get",
|
||||
// Getters
|
||||
"public-static-get",
|
||||
"protected-static-get",
|
||||
"private-static-get",
|
||||
"#private-static-get",
|
||||
|
||||
"public-decorated-get",
|
||||
"protected-decorated-get",
|
||||
"private-decorated-get",
|
||||
"public-decorated-get",
|
||||
"protected-decorated-get",
|
||||
"private-decorated-get",
|
||||
|
||||
"public-instance-get",
|
||||
"protected-instance-get",
|
||||
"private-instance-get",
|
||||
"#private-instance-get",
|
||||
"public-instance-get",
|
||||
"protected-instance-get",
|
||||
"private-instance-get",
|
||||
"#private-instance-get",
|
||||
|
||||
"public-abstract-get",
|
||||
"protected-abstract-get",
|
||||
"public-abstract-get",
|
||||
"protected-abstract-get",
|
||||
|
||||
"public-get",
|
||||
"protected-get",
|
||||
"private-get",
|
||||
"#private-get",
|
||||
"public-get",
|
||||
"protected-get",
|
||||
"private-get",
|
||||
"#private-get",
|
||||
|
||||
"static-get",
|
||||
"instance-get",
|
||||
"abstract-get",
|
||||
"static-get",
|
||||
"instance-get",
|
||||
"abstract-get",
|
||||
|
||||
"decorated-get",
|
||||
"decorated-get",
|
||||
|
||||
"get",
|
||||
"get",
|
||||
|
||||
// Setters
|
||||
"public-static-set",
|
||||
"protected-static-set",
|
||||
"private-static-set",
|
||||
"#private-static-set",
|
||||
// Setters
|
||||
"public-static-set",
|
||||
"protected-static-set",
|
||||
"private-static-set",
|
||||
"#private-static-set",
|
||||
|
||||
"public-decorated-set",
|
||||
"protected-decorated-set",
|
||||
"private-decorated-set",
|
||||
"public-decorated-set",
|
||||
"protected-decorated-set",
|
||||
"private-decorated-set",
|
||||
|
||||
"public-instance-set",
|
||||
"protected-instance-set",
|
||||
"private-instance-set",
|
||||
"#private-instance-set",
|
||||
"public-instance-set",
|
||||
"protected-instance-set",
|
||||
"private-instance-set",
|
||||
"#private-instance-set",
|
||||
|
||||
"public-abstract-set",
|
||||
"protected-abstract-set",
|
||||
"public-abstract-set",
|
||||
"protected-abstract-set",
|
||||
|
||||
"public-set",
|
||||
"protected-set",
|
||||
"private-set",
|
||||
"#private-set",
|
||||
"public-set",
|
||||
"protected-set",
|
||||
"private-set",
|
||||
"#private-set",
|
||||
|
||||
"static-set",
|
||||
"instance-set",
|
||||
"abstract-set",
|
||||
"static-set",
|
||||
"instance-set",
|
||||
"abstract-set",
|
||||
|
||||
"decorated-set",
|
||||
"decorated-set",
|
||||
|
||||
"set",
|
||||
"set",
|
||||
|
||||
// Methods
|
||||
"public-static-method",
|
||||
"protected-static-method",
|
||||
"private-static-method",
|
||||
"#private-static-method",
|
||||
// Methods
|
||||
"public-static-method",
|
||||
"protected-static-method",
|
||||
"private-static-method",
|
||||
"#private-static-method",
|
||||
|
||||
"public-decorated-method",
|
||||
"protected-decorated-method",
|
||||
"private-decorated-method",
|
||||
"public-decorated-method",
|
||||
"protected-decorated-method",
|
||||
"private-decorated-method",
|
||||
|
||||
"public-instance-method",
|
||||
"protected-instance-method",
|
||||
"private-instance-method",
|
||||
"#private-instance-method",
|
||||
"public-instance-method",
|
||||
"protected-instance-method",
|
||||
"private-instance-method",
|
||||
"#private-instance-method",
|
||||
|
||||
"public-abstract-method",
|
||||
"protected-abstract-method",
|
||||
"public-abstract-method",
|
||||
"protected-abstract-method",
|
||||
|
||||
"public-method",
|
||||
"protected-method",
|
||||
"private-method",
|
||||
"#private-method",
|
||||
"public-method",
|
||||
"protected-method",
|
||||
"private-method",
|
||||
"#private-method",
|
||||
|
||||
"static-method",
|
||||
"instance-method",
|
||||
"abstract-method",
|
||||
"static-method",
|
||||
"instance-method",
|
||||
"abstract-method",
|
||||
|
||||
"decorated-method",
|
||||
"decorated-method",
|
||||
|
||||
"method"
|
||||
]
|
||||
}
|
||||
"method"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
@@ -794,8 +792,7 @@ type Foo = {
|
||||
#### Sorting Alphabetically Within Member Groups
|
||||
|
||||
This config specifies that within each `memberTypes` group, members are in an alphabetic case-sensitive order.
|
||||
The default member order will be applied if `memberTypes` is not specified.
|
||||
You can see the default order in [Default Configuration](#default-configuration).
|
||||
You can copy and paste the default order from [Default Configuration](#default-configuration).
|
||||
|
||||
```jsonc
|
||||
// .eslintrc.json
|
||||
@@ -805,6 +802,9 @@ You can see the default order in [Default Configuration](#default-configuration)
|
||||
"error",
|
||||
{
|
||||
"default": {
|
||||
"memberTypes": [
|
||||
/* <Default Order> */
|
||||
],
|
||||
"order": "alphabetically"
|
||||
}
|
||||
}
|
||||
@@ -817,7 +817,7 @@ You can see the default order in [Default Configuration](#default-configuration)
|
||||
|
||||
##### ❌ Incorrect
|
||||
|
||||
```ts option='{"default":{"order":"alphabetically"}}'
|
||||
```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"}}'
|
||||
interface Foo {
|
||||
a: x;
|
||||
B: x;
|
||||
@@ -831,7 +831,7 @@ interface Foo {
|
||||
|
||||
##### ✅ Correct
|
||||
|
||||
```ts option='{"default":{"order":"alphabetically"}}'
|
||||
```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"}}'
|
||||
interface Foo {
|
||||
B: x;
|
||||
a: x;
|
||||
@@ -843,62 +843,10 @@ interface Foo {
|
||||
}
|
||||
```
|
||||
|
||||
#### Sorting Alphabetically Within Custom Member Groups
|
||||
|
||||
This config specifies that within each custom `memberTypes` group, members are in an alphabetic case-sensitive order.
|
||||
|
||||
```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).
|
||||
You can copy and paste the default order from [Default Configuration](#default-configuration).
|
||||
|
||||
```jsonc
|
||||
// .eslintrc.json
|
||||
@@ -908,6 +856,9 @@ You can see the default order in [Default Configuration](#default-configuration)
|
||||
"error",
|
||||
{
|
||||
"default": {
|
||||
"memberTypes": [
|
||||
/* <Default Order> */
|
||||
],
|
||||
"order": "alphabetically-case-insensitive"
|
||||
}
|
||||
}
|
||||
@@ -920,7 +871,7 @@ You can see the default order in [Default Configuration](#default-configuration)
|
||||
|
||||
##### ❌ Incorrect
|
||||
|
||||
```ts option='{"default":{"order":"alphabetically-case-insensitive"}}'
|
||||
```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"}}'
|
||||
interface Foo {
|
||||
B: x;
|
||||
a: x;
|
||||
@@ -934,7 +885,7 @@ interface Foo {
|
||||
|
||||
##### ✅ Correct
|
||||
|
||||
```ts option='{"default":{"order":"alphabetically-case-insensitive"}}'
|
||||
```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"}}'
|
||||
interface Foo {
|
||||
a: 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",
|
||||
"version": "6.20.0",
|
||||
"version": "6.19.0",
|
||||
"description": "TypeScript plugin for ESLint",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -57,10 +57,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.5.1",
|
||||
"@typescript-eslint/scope-manager": "6.20.0",
|
||||
"@typescript-eslint/type-utils": "6.20.0",
|
||||
"@typescript-eslint/utils": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||
"@typescript-eslint/scope-manager": "6.19.0",
|
||||
"@typescript-eslint/type-utils": "6.19.0",
|
||||
"@typescript-eslint/utils": "6.19.0",
|
||||
"@typescript-eslint/visitor-keys": "6.19.0",
|
||||
"debug": "^4.3.4",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.2.4",
|
||||
@@ -73,8 +73,8 @@
|
||||
"@types/debug": "*",
|
||||
"@types/marked": "*",
|
||||
"@types/natural-compare": "*",
|
||||
"@typescript-eslint/rule-schema-to-typescript-types": "6.20.0",
|
||||
"@typescript-eslint/rule-tester": "6.20.0",
|
||||
"@typescript-eslint/rule-schema-to-typescript-types": "6.19.0",
|
||||
"@typescript-eslint/rule-tester": "6.19.0",
|
||||
"ajv": "^6.12.6",
|
||||
"chalk": "^5.3.0",
|
||||
"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",
|
||||
"version": "6.20.0",
|
||||
"version": "6.19.0",
|
||||
"description": "An ESLint custom parser which leverages TypeScript ESTree",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -51,10 +51,10 @@
|
||||
"eslint": "^7.0.0 || ^8.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "6.20.0",
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||
"@typescript-eslint/scope-manager": "6.19.0",
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"@typescript-eslint/typescript-estree": "6.19.0",
|
||||
"@typescript-eslint/visitor-keys": "6.19.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"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",
|
||||
"version": "6.20.0",
|
||||
"version": "6.19.0",
|
||||
"description": "TypeScript scope analyser for ESLint",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -44,13 +44,13 @@
|
||||
"typecheck": "npx nx typecheck"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0"
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"@typescript-eslint/visitor-keys": "6.19.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@prettier/sync": "*",
|
||||
"@types/glob": "*",
|
||||
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||
"@typescript-eslint/typescript-estree": "6.19.0",
|
||||
"glob": "*",
|
||||
"jest-specific-snapshot": "*",
|
||||
"make-dir": "*",
|
||||
|
||||
2
node_modules/@typescript-eslint/type-utils/dist/isUnsafeAssignment.d.ts.map
generated
vendored
2
node_modules/@typescript-eslint/type-utils/dist/isUnsafeAssignment.d.ts.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"isUnsafeAssignment.d.ts","sourceRoot":"","sources":["../src/isUnsafeAssignment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAItC;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,QAAQ,EAAE,EAAE,CAAC,IAAI,EACjB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,UAAU,EAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,GAC/B,KAAK,GAAG;IAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC;IAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAA;CAAE,CAQhD"}
|
||||
{"version":3,"file":"isUnsafeAssignment.d.ts","sourceRoot":"","sources":["../src/isUnsafeAssignment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAItC;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,EAAE,CAAC,IAAI,EACb,QAAQ,EAAE,EAAE,CAAC,IAAI,EACjB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,UAAU,EAAE,QAAQ,CAAC,IAAI,GAAG,IAAI,GAC/B,KAAK,GAAG;IAAE,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC;IAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAA;CAAE,CA8DhD"}
|
||||
17
node_modules/@typescript-eslint/type-utils/dist/isUnsafeAssignment.js
generated
vendored
17
node_modules/@typescript-eslint/type-utils/dist/isUnsafeAssignment.js
generated
vendored
@@ -38,10 +38,6 @@ const predicates_1 = require("./predicates");
|
||||
* @returns false if it's safe, or an object with the two types if it's unsafe
|
||||
*/
|
||||
function isUnsafeAssignment(type, receiver, checker, senderNode) {
|
||||
return isUnsafeAssignmentWorker(type, receiver, checker, senderNode, new Map());
|
||||
}
|
||||
exports.isUnsafeAssignment = isUnsafeAssignment;
|
||||
function isUnsafeAssignmentWorker(type, receiver, checker, senderNode, visited) {
|
||||
if ((0, predicates_1.isTypeAnyType)(type)) {
|
||||
// Allow assignment of any ==> unknown.
|
||||
if ((0, predicates_1.isTypeUnknownType)(receiver)) {
|
||||
@@ -51,16 +47,6 @@ function isUnsafeAssignmentWorker(type, receiver, checker, senderNode, visited)
|
||||
return { sender: type, receiver };
|
||||
}
|
||||
}
|
||||
const typeAlreadyVisited = visited.get(type);
|
||||
if (typeAlreadyVisited) {
|
||||
if (typeAlreadyVisited.has(receiver)) {
|
||||
return false;
|
||||
}
|
||||
typeAlreadyVisited.add(receiver);
|
||||
}
|
||||
else {
|
||||
visited.set(type, new Set([receiver]));
|
||||
}
|
||||
if (tsutils.isTypeReference(type) && tsutils.isTypeReference(receiver)) {
|
||||
// TODO - figure out how to handle cases like this,
|
||||
// where the types are assignable, but not the same type
|
||||
@@ -94,7 +80,7 @@ function isUnsafeAssignmentWorker(type, receiver, checker, senderNode, visited)
|
||||
for (let i = 0; i < typeArguments.length; i += 1) {
|
||||
const arg = typeArguments[i];
|
||||
const receiverArg = receiverTypeArguments[i];
|
||||
const unsafe = isUnsafeAssignmentWorker(arg, receiverArg, checker, senderNode, visited);
|
||||
const unsafe = isUnsafeAssignment(arg, receiverArg, checker, senderNode);
|
||||
if (unsafe) {
|
||||
return { sender: type, receiver };
|
||||
}
|
||||
@@ -103,4 +89,5 @@ function isUnsafeAssignmentWorker(type, receiver, checker, senderNode, visited)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.isUnsafeAssignment = isUnsafeAssignment;
|
||||
//# sourceMappingURL=isUnsafeAssignment.js.map
|
||||
2
node_modules/@typescript-eslint/type-utils/dist/isUnsafeAssignment.js.map
generated
vendored
2
node_modules/@typescript-eslint/type-utils/dist/isUnsafeAssignment.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"isUnsafeAssignment.js","sourceRoot":"","sources":["../src/isUnsafeAssignment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;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,CAAC,EAAE,CAAC;YACjD,MAAM,GAAG,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YAC7B,MAAM,WAAW,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;YAE7C,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YACzE,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YACpC,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAnED,gDAmEC"}
|
||||
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",
|
||||
"version": "6.20.0",
|
||||
"version": "6.19.0",
|
||||
"description": "Type utilities for working with TypeScript + ESLint together",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -45,13 +45,13 @@
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||
"@typescript-eslint/utils": "6.20.0",
|
||||
"@typescript-eslint/typescript-estree": "6.19.0",
|
||||
"@typescript-eslint/utils": "6.19.0",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/parser": "6.20.0",
|
||||
"@typescript-eslint/parser": "6.19.0",
|
||||
"ajv": "^6.10.0",
|
||||
"downlevel-dts": "*",
|
||||
"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",
|
||||
"version": "6.20.0",
|
||||
"version": "6.19.0",
|
||||
"description": "Types for the TypeScript-ESTree AST spec",
|
||||
"files": [
|
||||
"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",
|
||||
"version": "6.20.0",
|
||||
"version": "6.19.0",
|
||||
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -52,8 +52,8 @@
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"@typescript-eslint/visitor-keys": "6.19.0",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"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",
|
||||
"version": "6.20.0",
|
||||
"version": "6.19.0",
|
||||
"description": "Utilities for working with TypeScript + ESLint together",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -68,16 +68,16 @@
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@types/json-schema": "^7.0.12",
|
||||
"@types/semver": "^7.5.0",
|
||||
"@typescript-eslint/scope-manager": "6.20.0",
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||
"@typescript-eslint/scope-manager": "6.19.0",
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"@typescript-eslint/typescript-estree": "6.19.0",
|
||||
"semver": "^7.5.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^7.0.0 || ^8.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/parser": "6.20.0",
|
||||
"@typescript-eslint/parser": "6.19.0",
|
||||
"downlevel-dts": "*",
|
||||
"jest": "29.7.0",
|
||||
"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",
|
||||
"version": "6.20.0",
|
||||
"version": "6.19.0",
|
||||
"description": "Visitor keys used to help traverse the TypeScript-ESTree AST",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -45,7 +45,7 @@
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"eslint-visitor-keys": "^3.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
6
node_modules/nock/README.md
generated
vendored
6
node_modules/nock/README.md
generated
vendored
@@ -66,7 +66,6 @@ For instance, if a module performs HTTP requests to a CouchDB server or makes HT
|
||||
- [.pendingMocks()](#pendingmocks)
|
||||
- [.activeMocks()](#activemocks)
|
||||
- [.isActive()](#isactive)
|
||||
- [.clone()](#clone)
|
||||
- [Restoring](#restoring)
|
||||
- [Activating](#activating)
|
||||
- [Turning Nock Off (experimental!)](#turning-nock-off-experimental)
|
||||
@@ -90,8 +89,6 @@ For instance, if a module performs HTTP requests to a CouchDB server or makes HT
|
||||
- [Options](#options-1)
|
||||
- [Example](#example)
|
||||
- [Modes](#modes)
|
||||
- [Verifying recorded fixtures](#verifying-recorded-fixtures)
|
||||
- [Example](#example-1)
|
||||
- [Common issues](#common-issues)
|
||||
- [Axios](#axios)
|
||||
- [Memory issues with Jest](#memory-issues-with-jest)
|
||||
@@ -1696,9 +1693,6 @@ 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/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>
|
||||
<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>
|
||||
</table>
|
||||
|
||||
|
||||
5
node_modules/nock/lib/common.js
generated
vendored
5
node_modules/nock/lib/common.js
generated
vendored
@@ -70,7 +70,10 @@ function overrideRequests(newRequest) {
|
||||
debug('- overriding request for', proto)
|
||||
|
||||
const moduleName = proto // 1 to 1 match of protocol and module is fortunate :)
|
||||
const module = require(proto)
|
||||
const module = {
|
||||
http: require('http'),
|
||||
https: require('https'),
|
||||
}[moduleName]
|
||||
const overriddenRequest = module.request
|
||||
const overriddenGet = module.get
|
||||
|
||||
|
||||
4
node_modules/nock/lib/intercept.js
generated
vendored
4
node_modules/nock/lib/intercept.js
generated
vendored
@@ -370,6 +370,8 @@ function activate() {
|
||||
throw new Error('Nock already active')
|
||||
}
|
||||
|
||||
overrideClientRequest()
|
||||
|
||||
// ----- Overriding http.request and https.request:
|
||||
|
||||
common.overrideRequests(function (proto, overriddenRequest, args) {
|
||||
@@ -433,8 +435,6 @@ function activate() {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
overrideClientRequest()
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
6
node_modules/nock/package.json
generated
vendored
6
node_modules/nock/package.json
generated
vendored
@@ -7,7 +7,7 @@
|
||||
"testing",
|
||||
"isolation"
|
||||
],
|
||||
"version": "13.5.1",
|
||||
"version": "13.5.0",
|
||||
"author": "Pedro Teixeira <pedro.teixeira@gmail.com>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -41,7 +41,6 @@
|
||||
"eslint-plugin-promise": "^6.0.0",
|
||||
"form-data": "^4.0.0",
|
||||
"got": "^11.3.0",
|
||||
"jest": "^29.7.0",
|
||||
"mocha": "^9.1.3",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"nyc": "^15.0.0",
|
||||
@@ -61,8 +60,7 @@
|
||||
"lint:js:fix": "eslint --cache --cache-location './.cache/eslint' --fix '**/*.js'",
|
||||
"lint:ts": "dtslint --expectOnly types",
|
||||
"test": "nyc --reporter=lcov --reporter=text mocha --recursive tests",
|
||||
"test:coverage": "open coverage/lcov-report/index.html",
|
||||
"test:jest": "jest tests_jest --detectLeaks"
|
||||
"test:coverage": "open coverage/lcov-report/index.html"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
|
||||
108
package-lock.json
generated
108
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "2.24.0",
|
||||
"version": "2.23.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "codeql",
|
||||
"version": "2.24.0",
|
||||
"version": "2.23.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/artifact": "^1.1.2",
|
||||
@@ -20,7 +20,7 @@
|
||||
"@octokit/plugin-retry": "^5.0.2",
|
||||
"@octokit/types": "^12.4.0",
|
||||
"@schemastore/package": "0.0.10",
|
||||
"@types/uuid": "^9.0.8",
|
||||
"@types/uuid": "^9.0.7",
|
||||
"adm-zip": "^0.5.10",
|
||||
"check-disk-space": "^3.4.0",
|
||||
"console-log-level": "^1.4.1",
|
||||
@@ -45,8 +45,8 @@
|
||||
"@types/node": "16.11.22",
|
||||
"@types/semver": "^7.5.6",
|
||||
"@types/sinon": "^17.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
||||
"@typescript-eslint/parser": "^6.20.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
||||
"@typescript-eslint/parser": "^6.19.0",
|
||||
"ava": "^5.3.1",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
@@ -55,7 +55,7 @@
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-no-async-foreach": "^0.1.1",
|
||||
"micromatch": "4.0.5",
|
||||
"nock": "^13.5.1",
|
||||
"nock": "^13.5.0",
|
||||
"removeNPMAbsolutePaths": "3.0.1",
|
||||
"sinon": "^17.0.1",
|
||||
"typescript": "^5.3.3"
|
||||
@@ -1009,21 +1009,21 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/uuid": {
|
||||
"version": "9.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz",
|
||||
"integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA=="
|
||||
"version": "9.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.7.tgz",
|
||||
"integrity": "sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g=="
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.20.0.tgz",
|
||||
"integrity": "sha512-fTwGQUnjhoYHeSF6m5pWNkzmDDdsKELYrOBxhjMrofPqCkoC2k3B2wvGHFxa1CTIqkEn88nlW1HVMztjo2K8Hg==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.19.0.tgz",
|
||||
"integrity": "sha512-DUCUkQNklCQYnrBSSikjVChdc84/vMPDQSgJTHBZ64G9bA9w0Crc0rd2diujKbTdp6w2J47qkeHQLoi0rpLCdg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.5.1",
|
||||
"@typescript-eslint/scope-manager": "6.20.0",
|
||||
"@typescript-eslint/type-utils": "6.20.0",
|
||||
"@typescript-eslint/utils": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||
"@typescript-eslint/scope-manager": "6.19.0",
|
||||
"@typescript-eslint/type-utils": "6.19.0",
|
||||
"@typescript-eslint/utils": "6.19.0",
|
||||
"@typescript-eslint/visitor-keys": "6.19.0",
|
||||
"debug": "^4.3.4",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.2.4",
|
||||
@@ -1049,15 +1049,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz",
|
||||
"integrity": "sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.19.0.tgz",
|
||||
"integrity": "sha512-1DyBLG5SH7PYCd00QlroiW60YJ4rWMuUGa/JBV0iZuqi4l4IK3twKPq5ZkEebmGqRjXWVgsUzfd3+nZveewgow==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "6.20.0",
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||
"@typescript-eslint/scope-manager": "6.19.0",
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"@typescript-eslint/typescript-estree": "6.19.0",
|
||||
"@typescript-eslint/visitor-keys": "6.19.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1077,13 +1077,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.20.0.tgz",
|
||||
"integrity": "sha512-p4rvHQRDTI1tGGMDFQm+GtxP1ZHyAh64WANVoyEcNMpaTFn3ox/3CcgtIlELnRfKzSs/DwYlDccJEtr3O6qBvA==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.19.0.tgz",
|
||||
"integrity": "sha512-dO1XMhV2ehBI6QN8Ufi7I10wmUovmLU0Oru3n5LVlM2JuzB4M+dVphCPLkVpKvGij2j/pHBWuJ9piuXx+BhzxQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0"
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"@typescript-eslint/visitor-keys": "6.19.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^16.0.0 || >=18.0.0"
|
||||
@@ -1094,13 +1094,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.20.0.tgz",
|
||||
"integrity": "sha512-qnSobiJQb1F5JjN0YDRPHruQTrX7ICsmltXhkV536mp4idGAYrIyr47zF/JmkJtEcAVnIz4gUYJ7gOZa6SmN4g==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.19.0.tgz",
|
||||
"integrity": "sha512-mcvS6WSWbjiSxKCwBcXtOM5pRkPQ6kcDds/juxcy/727IQr3xMEcwr/YLHW2A2+Fp5ql6khjbKBzOyjuPqGi/w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||
"@typescript-eslint/utils": "6.20.0",
|
||||
"@typescript-eslint/typescript-estree": "6.19.0",
|
||||
"@typescript-eslint/utils": "6.19.0",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^1.0.1"
|
||||
},
|
||||
@@ -1121,9 +1121,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.20.0.tgz",
|
||||
"integrity": "sha512-MM9mfZMAhiN4cOEcUOEx+0HmuaW3WBfukBZPCfwSqFnQy0grXYtngKCqpQN339X3RrwtzspWJrpbrupKYUSBXQ==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.19.0.tgz",
|
||||
"integrity": "sha512-lFviGV/vYhOy3m8BJ/nAKoAyNhInTdXpftonhWle66XHAtT1ouBlkjL496b5H5hb8dWXHwtypTqgtb/DEa+j5A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^16.0.0 || >=18.0.0"
|
||||
@@ -1134,13 +1134,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.20.0.tgz",
|
||||
"integrity": "sha512-RnRya9q5m6YYSpBN7IzKu9FmLcYtErkDkc8/dKv81I9QiLLtVBHrjz+Ev/crAqgMNW2FCsoZF4g2QUylMnJz+g==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.19.0.tgz",
|
||||
"integrity": "sha512-o/zefXIbbLBZ8YJ51NlkSAt2BamrK6XOmuxSR3hynMIzzyMY33KuJ9vuMdFSXW+H0tVvdF9qBPTHA91HDb4BIQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/visitor-keys": "6.20.0",
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"@typescript-eslint/visitor-keys": "6.19.0",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
@@ -1186,17 +1186,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.20.0.tgz",
|
||||
"integrity": "sha512-/EKuw+kRu2vAqCoDwDCBtDRU6CTKbUmwwI7SH7AashZ+W+7o8eiyy6V2cdOqN49KsTcASWsC5QeghYuRDTyOOg==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.19.0.tgz",
|
||||
"integrity": "sha512-QR41YXySiuN++/dC9UArYOg4X86OAYP83OWTewpVx5ct1IZhjjgTLocj7QNxGhWoTqknsgpl7L+hGygCO+sdYw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@types/json-schema": "^7.0.12",
|
||||
"@types/semver": "^7.5.0",
|
||||
"@typescript-eslint/scope-manager": "6.20.0",
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/typescript-estree": "6.20.0",
|
||||
"@typescript-eslint/scope-manager": "6.19.0",
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"@typescript-eslint/typescript-estree": "6.19.0",
|
||||
"semver": "^7.5.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1211,12 +1211,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.20.0.tgz",
|
||||
"integrity": "sha512-E8Cp98kRe4gKHjJD4NExXKz/zOJ1A2hhZc+IMVD6i7w4yjIvh6VyuRI0gRtxAsXtoC35uGMaQ9rjI2zJaXDEAw==",
|
||||
"version": "6.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.19.0.tgz",
|
||||
"integrity": "sha512-hZaUCORLgubBvtGpp1JEFEazcuEdfxta9j4iUwdSAr7mEsYYAp3EAUyCZk3VEEqGj6W+AV4uWyrDGtrlawAsgQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.20.0",
|
||||
"@typescript-eslint/types": "6.19.0",
|
||||
"eslint-visitor-keys": "^3.4.1"
|
||||
},
|
||||
"engines": {
|
||||
@@ -4618,9 +4618,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/nock": {
|
||||
"version": "13.5.1",
|
||||
"resolved": "https://registry.npmjs.org/nock/-/nock-13.5.1.tgz",
|
||||
"integrity": "sha512-+s7b73fzj5KnxbKH4Oaqz07tQ8degcMilU4rrmnKvI//b0JMBU4wEXFQ8zqr+3+L4eWSfU3H/UoIVGUV0tue1Q==",
|
||||
"version": "13.5.0",
|
||||
"resolved": "https://registry.npmjs.org/nock/-/nock-13.5.0.tgz",
|
||||
"integrity": "sha512-9hc1eCS2HtOz+sE9W7JQw/tXJktg0zoPSu48s/pYe73e25JW9ywiowbqnUSd7iZPeVawLcVpPZeZS312fwSY+g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"debug": "^4.1.0",
|
||||
|
||||
10
package.json
10
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "2.24.0",
|
||||
"version": "2.23.1",
|
||||
"private": true,
|
||||
"description": "CodeQL action",
|
||||
"scripts": {
|
||||
@@ -32,7 +32,7 @@
|
||||
"@octokit/plugin-retry": "^5.0.2",
|
||||
"@octokit/types": "^12.4.0",
|
||||
"@schemastore/package": "0.0.10",
|
||||
"@types/uuid": "^9.0.8",
|
||||
"@types/uuid": "^9.0.7",
|
||||
"adm-zip": "^0.5.10",
|
||||
"check-disk-space": "^3.4.0",
|
||||
"console-log-level": "^1.4.1",
|
||||
@@ -60,8 +60,8 @@
|
||||
"@types/node": "16.11.22",
|
||||
"@types/semver": "^7.5.6",
|
||||
"@types/sinon": "^17.0.3",
|
||||
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
||||
"@typescript-eslint/parser": "^6.20.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
||||
"@typescript-eslint/parser": "^6.19.0",
|
||||
"ava": "^5.3.1",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
@@ -70,7 +70,7 @@
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-no-async-foreach": "^0.1.1",
|
||||
"micromatch": "4.0.5",
|
||||
"nock": "^13.5.1",
|
||||
"nock": "^13.5.0",
|
||||
"removeNPMAbsolutePaths": "3.0.1",
|
||||
"sinon": "^17.0.1",
|
||||
"typescript": "^5.3.3"
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
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")
|
||||
}
|
||||
|
||||
YamlDocument getRootNode() {
|
||||
YAMLDocument getRootNode() {
|
||||
result.getFile() = this
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class ActionDeclaration extends File {
|
||||
* The name of any input to this action.
|
||||
*/
|
||||
string getAnInput() {
|
||||
result = getRootNode().(YamlMapping).lookup("inputs").(YamlMapping).getKey(_).(YamlString).getValue()
|
||||
result = getRootNode().(YAMLMapping).lookup("inputs").(YAMLMapping).getKey(_).(YAMLString).getValue()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,10 +35,21 @@ class ActionDeclaration extends File {
|
||||
* or because it has a default value.
|
||||
*/
|
||||
predicate inputAlwaysHasValue(string input) {
|
||||
exists(YamlMapping value |
|
||||
value = getRootNode().(YamlMapping).lookup("inputs").(YamlMapping).lookup(input) and
|
||||
exists(YAMLMapping value |
|
||||
value = getRootNode().(YAMLMapping).lookup("inputs").(YAMLMapping).lookup(input) and
|
||||
(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)
|
||||
}
|
||||
|
||||
YamlDocument getRootNode() {
|
||||
YAMLDocument getRootNode() {
|
||||
result.getFile() = this
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class ActionDeclaration extends File {
|
||||
* The name of any input to this action.
|
||||
*/
|
||||
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() {
|
||||
result.getFile().getRelativePath() = getRootNode().
|
||||
(YamlMapping).lookup("runs").
|
||||
(YamlMapping).lookup("main").
|
||||
(YamlString).getValue().regexpReplaceAll("\\.\\./lib/(.*)\\.js", "src/$1.ts") and
|
||||
(YAMLMapping).lookup("runs").
|
||||
(YAMLMapping).lookup("main").
|
||||
(YAMLString).getValue().regexpReplaceAll("\\.\\./lib/(.*)\\.js", "src/$1.ts") and
|
||||
result.getName() = "run"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,15 +6,11 @@ import * as sinon from "sinon";
|
||||
|
||||
import { runQueries } from "./analyze";
|
||||
import { setCodeQL } from "./codeql";
|
||||
import { Config } from "./config-utils";
|
||||
import { Feature } from "./feature-flags";
|
||||
import { Language } from "./languages";
|
||||
import { getRunnerLogger } from "./logging";
|
||||
import {
|
||||
setupTests,
|
||||
setupActionsVars,
|
||||
createFeatures,
|
||||
createTestConfig,
|
||||
} from "./testing-utils";
|
||||
import { setupTests, setupActionsVars, createFeatures } from "./testing-utils";
|
||||
import * as uploadLib from "./upload-lib";
|
||||
import * as util from "./util";
|
||||
|
||||
@@ -86,11 +82,25 @@ test("status report fields", async (t) => {
|
||||
databasePrintBaseline: async () => "",
|
||||
});
|
||||
|
||||
const config = createTestConfig({
|
||||
const config: Config = {
|
||||
languages: [language],
|
||||
originalUserInput: {},
|
||||
tempDir: tmpDir,
|
||||
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: {},
|
||||
trapCacheDownloadTime: 0,
|
||||
};
|
||||
fs.mkdirSync(util.getCodeQLDatabasePath(config, language), {
|
||||
recursive: true,
|
||||
});
|
||||
|
||||
@@ -26,7 +26,6 @@ import {
|
||||
SAMPLE_DEFAULT_CLI_VERSION,
|
||||
mockBundleDownloadApi,
|
||||
makeVersionInfo,
|
||||
createTestConfig,
|
||||
} from "./testing-utils";
|
||||
import * as util from "./util";
|
||||
import { initializeEnvironment } from "./util";
|
||||
@@ -38,9 +37,25 @@ let stubConfig: Config;
|
||||
test.beforeEach(() => {
|
||||
initializeEnvironment("1.2.3");
|
||||
|
||||
stubConfig = createTestConfig({
|
||||
stubConfig = {
|
||||
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({
|
||||
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
import { isTracedLanguage, Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
import * as setupCodeql from "./setup-codeql";
|
||||
import { ToolsFeature, isSupportedToolsFeature } from "./tools-features";
|
||||
import * as util from "./util";
|
||||
import { wrapError } from "./util";
|
||||
|
||||
@@ -91,10 +90,6 @@ export interface CodeQL {
|
||||
* Print version information about CodeQL.
|
||||
*/
|
||||
printVersion(): Promise<void>;
|
||||
/**
|
||||
* Returns whether the CodeQL executable supports the specified feature.
|
||||
*/
|
||||
supportsFeature(feature: ToolsFeature): Promise<boolean>;
|
||||
/**
|
||||
* Run 'codeql database init --db-cluster'.
|
||||
*/
|
||||
@@ -457,17 +452,17 @@ function resolveFunction<T>(
|
||||
export function setCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
|
||||
cachedCodeQL = {
|
||||
getPath: resolveFunction(partialCodeql, "getPath", () => "/tmp/dummy-path"),
|
||||
getVersion: resolveFunction(partialCodeql, "getVersion", async () => ({
|
||||
version: "1.0.0",
|
||||
})),
|
||||
printVersion: resolveFunction(partialCodeql, "printVersion"),
|
||||
supportsFeature: resolveFunction(
|
||||
getVersion: resolveFunction(
|
||||
partialCodeql,
|
||||
"supportsFeature",
|
||||
async (feature) =>
|
||||
!!partialCodeql.getVersion &&
|
||||
isSupportedToolsFeature(await partialCodeql.getVersion(), feature),
|
||||
"getVersion",
|
||||
() =>
|
||||
new Promise((resolve) =>
|
||||
resolve({
|
||||
version: "1.0.0",
|
||||
}),
|
||||
),
|
||||
),
|
||||
printVersion: resolveFunction(partialCodeql, "printVersion"),
|
||||
databaseInitCluster: resolveFunction(partialCodeql, "databaseInitCluster"),
|
||||
runAutobuild: resolveFunction(partialCodeql, "runAutobuild"),
|
||||
extractScannedLanguage: resolveFunction(
|
||||
@@ -566,9 +561,6 @@ export async function getCodeQLForCmd(
|
||||
async printVersion() {
|
||||
await runTool(cmd, ["version", "--format=json"]);
|
||||
},
|
||||
async supportsFeature(feature: ToolsFeature) {
|
||||
return isSupportedToolsFeature(await this.getVersion(), feature);
|
||||
},
|
||||
async databaseInitCluster(
|
||||
config: Config,
|
||||
sourceRoot: string,
|
||||
@@ -597,12 +589,6 @@ export async function getCodeQLForCmd(
|
||||
extraArgs.push("--external-repository-token-stdin");
|
||||
}
|
||||
|
||||
if (
|
||||
config.buildMode !== undefined &&
|
||||
(await this.supportsFeature(ToolsFeature.BuildModeOption))
|
||||
) {
|
||||
extraArgs.push(`--build-mode=${config.buildMode}`);
|
||||
}
|
||||
if (
|
||||
qlconfigFile !== undefined &&
|
||||
(await util.codeQlVersionAbove(this, CODEQL_VERSION_INIT_WITH_QLCONFIG))
|
||||
|
||||
@@ -7,12 +7,7 @@ import * as yaml from "js-yaml";
|
||||
import * as sinon from "sinon";
|
||||
|
||||
import * as api from "./api-client";
|
||||
import {
|
||||
CodeQL,
|
||||
getCachedCodeQL,
|
||||
PackDownloadOutput,
|
||||
setCodeQL,
|
||||
} from "./codeql";
|
||||
import { getCachedCodeQL, PackDownloadOutput, setCodeQL } from "./codeql";
|
||||
import * as configUtils from "./config-utils";
|
||||
import { Language } from "./languages";
|
||||
import { getRunnerLogger } from "./logging";
|
||||
@@ -31,42 +26,15 @@ import {
|
||||
|
||||
setupTests(test);
|
||||
|
||||
const githubVersion = { type: GitHubVariant.DOTCOM } as GitHubVersion;
|
||||
const sampleApiDetails = {
|
||||
auth: "token",
|
||||
externalRepoAuth: "token",
|
||||
url: "https://github.example.com",
|
||||
apiURL: undefined,
|
||||
registriesAuthTokens: undefined,
|
||||
};
|
||||
|
||||
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,
|
||||
);
|
||||
}
|
||||
const gitHubVersion = { type: GitHubVariant.DOTCOM } as GitHubVersion;
|
||||
|
||||
// Returns the filepath of the newly-created file
|
||||
function createConfigFile(inputFileContents: string, tmpDir: string): string {
|
||||
@@ -109,11 +77,11 @@ function mockListLanguages(languages: string[]) {
|
||||
}
|
||||
|
||||
test("load empty config", async (t) => {
|
||||
return await withTmpDir(async (tempDir) => {
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
const logger = getRunnerLogger(true);
|
||||
const languages = "javascript,python";
|
||||
|
||||
const codeql = setCodeQL({
|
||||
const codeQL = setCodeQL({
|
||||
async resolveQueries() {
|
||||
return {
|
||||
byLanguage: {
|
||||
@@ -130,34 +98,51 @@ test("load empty config", async (t) => {
|
||||
});
|
||||
|
||||
const config = await configUtils.initConfig(
|
||||
createTestInitConfigInputs({
|
||||
languagesInput: languages,
|
||||
repository: { owner: "github", repo: "example" },
|
||||
tempDir,
|
||||
codeql,
|
||||
logger,
|
||||
}),
|
||||
languages,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
codeQL,
|
||||
tmpDir,
|
||||
gitHubVersion,
|
||||
sampleApiDetails,
|
||||
logger,
|
||||
);
|
||||
|
||||
t.deepEqual(
|
||||
config,
|
||||
await configUtils.getDefaultConfig(
|
||||
createTestInitConfigInputs({
|
||||
languagesInput: languages,
|
||||
tempDir,
|
||||
codeql,
|
||||
logger,
|
||||
}),
|
||||
languages,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
codeQL,
|
||||
gitHubVersion,
|
||||
logger,
|
||||
),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
test("loading config saves config", async (t) => {
|
||||
return await withTmpDir(async (tempDir) => {
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
const logger = getRunnerLogger(true);
|
||||
|
||||
const codeql = setCodeQL({
|
||||
const codeQL = setCodeQL({
|
||||
async resolveQueries() {
|
||||
return {
|
||||
byLanguage: {
|
||||
@@ -174,26 +159,36 @@ test("loading config saves config", async (t) => {
|
||||
});
|
||||
|
||||
// Sanity check the saved config file does not already exist
|
||||
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tempDir)));
|
||||
t.false(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
||||
|
||||
// Sanity check that getConfig returns undefined before we have called initConfig
|
||||
t.deepEqual(await configUtils.getConfig(tempDir, logger), undefined);
|
||||
t.deepEqual(await configUtils.getConfig(tmpDir, logger), undefined);
|
||||
|
||||
const config1 = await configUtils.initConfig(
|
||||
createTestInitConfigInputs({
|
||||
languagesInput: "javascript,python",
|
||||
tempDir,
|
||||
codeql,
|
||||
workspacePath: tempDir,
|
||||
logger,
|
||||
}),
|
||||
"javascript,python",
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
codeQL,
|
||||
tmpDir,
|
||||
gitHubVersion,
|
||||
sampleApiDetails,
|
||||
logger,
|
||||
);
|
||||
|
||||
// The saved config file should now exist
|
||||
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tempDir)));
|
||||
t.true(fs.existsSync(configUtils.getPathToParsedConfigFile(tmpDir)));
|
||||
|
||||
// And that same newly-initialised config should now be returned by getConfig
|
||||
const config2 = await configUtils.getConfig(tempDir, logger);
|
||||
const config2 = await configUtils.getConfig(tmpDir, logger);
|
||||
t.not(config2, undefined);
|
||||
if (config2 !== undefined) {
|
||||
// removes properties assigned to undefined.
|
||||
@@ -204,15 +199,26 @@ test("loading config saves config", async (t) => {
|
||||
});
|
||||
|
||||
test("load input outside of workspace", async (t) => {
|
||||
return await withTmpDir(async (tempDir) => {
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
try {
|
||||
await configUtils.initConfig(
|
||||
createTestInitConfigInputs({
|
||||
configFile: "../input",
|
||||
tempDir,
|
||||
codeql: getCachedCodeQL(),
|
||||
workspacePath: tempDir,
|
||||
}),
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
"../input",
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
getCachedCodeQL(),
|
||||
tmpDir,
|
||||
gitHubVersion,
|
||||
sampleApiDetails,
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
throw new Error("initConfig did not throw error");
|
||||
} catch (err) {
|
||||
@@ -220,7 +226,7 @@ test("load input outside of workspace", async (t) => {
|
||||
err,
|
||||
new UserError(
|
||||
configUtils.getConfigFileOutsideWorkspaceErrorMessage(
|
||||
path.join(tempDir, "../input"),
|
||||
path.join(tmpDir, "../input"),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -229,18 +235,29 @@ test("load input outside of workspace", async (t) => {
|
||||
});
|
||||
|
||||
test("load non-local input with invalid repo syntax", async (t) => {
|
||||
return await withTmpDir(async (tempDir) => {
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
// no filename given, just a repo
|
||||
const configFile = "octo-org/codeql-config@main";
|
||||
|
||||
try {
|
||||
await configUtils.initConfig(
|
||||
createTestInitConfigInputs({
|
||||
configFile,
|
||||
tempDir,
|
||||
codeql: getCachedCodeQL(),
|
||||
workspacePath: tempDir,
|
||||
}),
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
configFile,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
getCachedCodeQL(),
|
||||
tmpDir,
|
||||
gitHubVersion,
|
||||
sampleApiDetails,
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
throw new Error("initConfig did not throw error");
|
||||
} catch (err) {
|
||||
@@ -257,20 +274,30 @@ test("load non-local input with invalid repo syntax", async (t) => {
|
||||
});
|
||||
|
||||
test("load non-existent input", async (t) => {
|
||||
return await withTmpDir(async (tempDir) => {
|
||||
const languagesInput = "javascript";
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
const languages = "javascript";
|
||||
const configFile = "input";
|
||||
t.false(fs.existsSync(path.join(tempDir, configFile)));
|
||||
t.false(fs.existsSync(path.join(tmpDir, configFile)));
|
||||
|
||||
try {
|
||||
await configUtils.initConfig(
|
||||
createTestInitConfigInputs({
|
||||
languagesInput,
|
||||
configFile,
|
||||
tempDir,
|
||||
codeql: getCachedCodeQL(),
|
||||
workspacePath: tempDir,
|
||||
}),
|
||||
languages,
|
||||
undefined,
|
||||
undefined,
|
||||
configFile,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
getCachedCodeQL(),
|
||||
tmpDir,
|
||||
gitHubVersion,
|
||||
sampleApiDetails,
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
throw new Error("initConfig did not throw error");
|
||||
} catch (err) {
|
||||
@@ -278,7 +305,7 @@ test("load non-existent input", async (t) => {
|
||||
err,
|
||||
new UserError(
|
||||
configUtils.getConfigFileDoesNotExistErrorMessage(
|
||||
path.join(tempDir, "input"),
|
||||
path.join(tmpDir, "input"),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -287,8 +314,8 @@ test("load non-existent input", async (t) => {
|
||||
});
|
||||
|
||||
test("load non-empty input", async (t) => {
|
||||
return await withTmpDir(async (tempDir) => {
|
||||
const codeql = setCodeQL({
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
const codeQL = setCodeQL({
|
||||
async resolveQueries() {
|
||||
return {
|
||||
byLanguage: {
|
||||
@@ -318,12 +345,11 @@ test("load non-empty input", async (t) => {
|
||||
paths:
|
||||
- c/d`;
|
||||
|
||||
fs.mkdirSync(path.join(tempDir, "foo"));
|
||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
||||
|
||||
// And the config we expect it to parse to
|
||||
const expectedConfig: configUtils.Config = {
|
||||
languages: [Language.javascript],
|
||||
buildMode: "none",
|
||||
originalUserInput: {
|
||||
name: "my config",
|
||||
"disable-default-queries": true,
|
||||
@@ -331,10 +357,10 @@ test("load non-empty input", async (t) => {
|
||||
"paths-ignore": ["a", "b"],
|
||||
paths: ["c/d"],
|
||||
},
|
||||
tempDir,
|
||||
codeQLCmd: codeql.getPath(),
|
||||
gitHubVersion: githubVersion,
|
||||
dbLocation: path.resolve(tempDir, "codeql_databases"),
|
||||
tempDir: tmpDir,
|
||||
codeQLCmd: codeQL.getPath(),
|
||||
gitHubVersion,
|
||||
dbLocation: path.resolve(tmpDir, "codeql_databases"),
|
||||
debugMode: false,
|
||||
debugArtifactName: "my-artifact",
|
||||
debugDatabaseName: "my-db",
|
||||
@@ -343,20 +369,27 @@ test("load non-empty input", async (t) => {
|
||||
trapCacheDownloadTime: 0,
|
||||
};
|
||||
|
||||
const languagesInput = "javascript";
|
||||
const configFilePath = createConfigFile(inputFileContents, tempDir);
|
||||
const languages = "javascript";
|
||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||
|
||||
const actualConfig = await configUtils.initConfig(
|
||||
createTestInitConfigInputs({
|
||||
languagesInput,
|
||||
buildModeInput: "none",
|
||||
configFile: configFilePath,
|
||||
debugArtifactName: "my-artifact",
|
||||
debugDatabaseName: "my-db",
|
||||
tempDir,
|
||||
codeql,
|
||||
workspacePath: tempDir,
|
||||
}),
|
||||
languages,
|
||||
undefined,
|
||||
undefined,
|
||||
configFilePath,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
"my-artifact",
|
||||
"my-db",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
codeQL,
|
||||
tmpDir,
|
||||
gitHubVersion,
|
||||
sampleApiDetails,
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
|
||||
// Should exactly equal the object we constructed earlier
|
||||
@@ -384,15 +417,15 @@ function queriesToResolvedQueryForm(queries: string[]) {
|
||||
}
|
||||
|
||||
test("Using config input and file together, config input should be used.", async (t) => {
|
||||
return await withTmpDir(async (tempDir) => {
|
||||
process.env["RUNNER_TEMP"] = tempDir;
|
||||
process.env["GITHUB_WORKSPACE"] = tempDir;
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
process.env["RUNNER_TEMP"] = tmpDir;
|
||||
process.env["GITHUB_WORKSPACE"] = tmpDir;
|
||||
|
||||
const inputFileContents = `
|
||||
name: my config
|
||||
queries:
|
||||
- uses: ./foo_file`;
|
||||
const configFilePath = createConfigFile(inputFileContents, tempDir);
|
||||
const configFilePath = createConfigFile(inputFileContents, tmpDir);
|
||||
|
||||
const configInput = `
|
||||
name: my config
|
||||
@@ -405,13 +438,13 @@ test("Using config input and file together, config input should be used.", async
|
||||
- c/d@1.2.3
|
||||
`;
|
||||
|
||||
fs.mkdirSync(path.join(tempDir, "foo"));
|
||||
fs.mkdirSync(path.join(tmpDir, "foo"));
|
||||
|
||||
const resolveQueriesArgs: Array<{
|
||||
queries: string[];
|
||||
extraSearchPath: string | undefined;
|
||||
}> = [];
|
||||
const codeql = setCodeQL({
|
||||
const codeQL = setCodeQL({
|
||||
async resolveQueries(
|
||||
queries: string[],
|
||||
extraSearchPath: string | undefined,
|
||||
@@ -425,17 +458,26 @@ test("Using config input and file together, config input should be used.", async
|
||||
});
|
||||
|
||||
// Only JS, python packs will be ignored
|
||||
const languagesInput = "javascript";
|
||||
const languages = "javascript";
|
||||
|
||||
const config = await configUtils.initConfig(
|
||||
createTestInitConfigInputs({
|
||||
languagesInput,
|
||||
configFile: configFilePath,
|
||||
configInput,
|
||||
tempDir,
|
||||
codeql,
|
||||
workspacePath: tempDir,
|
||||
}),
|
||||
languages,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
configFilePath,
|
||||
configInput,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
codeQL,
|
||||
tmpDir,
|
||||
gitHubVersion,
|
||||
sampleApiDetails,
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
|
||||
t.deepEqual(config.originalUserInput, yaml.load(configInput));
|
||||
@@ -443,8 +485,8 @@ test("Using config input and file together, config input should be used.", async
|
||||
});
|
||||
|
||||
test("API client used when reading remote config", async (t) => {
|
||||
return await withTmpDir(async (tempDir) => {
|
||||
const codeql = setCodeQL({
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
const codeQL = setCodeQL({
|
||||
async resolveQueries() {
|
||||
return {
|
||||
byLanguage: {
|
||||
@@ -479,38 +521,59 @@ test("API client used when reading remote config", async (t) => {
|
||||
const spyGetContents = mockGetContents(dummyResponse);
|
||||
|
||||
// Create checkout directory for remote queries repository
|
||||
fs.mkdirSync(path.join(tempDir, "foo/bar/dev"), { recursive: true });
|
||||
fs.mkdirSync(path.join(tmpDir, "foo/bar/dev"), { recursive: true });
|
||||
|
||||
const configFile = "octo-org/codeql-config/config.yaml@main";
|
||||
const languagesInput = "javascript";
|
||||
const languages = "javascript";
|
||||
|
||||
await configUtils.initConfig(
|
||||
createTestInitConfigInputs({
|
||||
languagesInput,
|
||||
configFile,
|
||||
tempDir,
|
||||
codeql,
|
||||
workspacePath: tempDir,
|
||||
}),
|
||||
languages,
|
||||
undefined,
|
||||
undefined,
|
||||
configFile,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
codeQL,
|
||||
tmpDir,
|
||||
gitHubVersion,
|
||||
sampleApiDetails,
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
t.assert(spyGetContents.called);
|
||||
});
|
||||
});
|
||||
|
||||
test("Remote config handles the case where a directory is provided", async (t) => {
|
||||
return await withTmpDir(async (tempDir) => {
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
const dummyResponse = []; // directories are returned as arrays
|
||||
mockGetContents(dummyResponse);
|
||||
|
||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||
try {
|
||||
await configUtils.initConfig(
|
||||
createTestInitConfigInputs({
|
||||
configFile: repoReference,
|
||||
tempDir,
|
||||
codeql: getCachedCodeQL(),
|
||||
workspacePath: tempDir,
|
||||
}),
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
repoReference,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
getCachedCodeQL(),
|
||||
tmpDir,
|
||||
gitHubVersion,
|
||||
sampleApiDetails,
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
throw new Error("initConfig did not throw error");
|
||||
} catch (err) {
|
||||
@@ -525,7 +588,7 @@ test("Remote config handles the case where a directory is provided", async (t) =
|
||||
});
|
||||
|
||||
test("Invalid format of remote config handled correctly", async (t) => {
|
||||
return await withTmpDir(async (tempDir) => {
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
const dummyResponse = {
|
||||
// note no "content" property here
|
||||
};
|
||||
@@ -534,12 +597,23 @@ test("Invalid format of remote config handled correctly", async (t) => {
|
||||
const repoReference = "octo-org/codeql-config/config.yaml@main";
|
||||
try {
|
||||
await configUtils.initConfig(
|
||||
createTestInitConfigInputs({
|
||||
configFile: repoReference,
|
||||
tempDir,
|
||||
codeql: getCachedCodeQL(),
|
||||
workspacePath: tempDir,
|
||||
}),
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
repoReference,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
getCachedCodeQL(),
|
||||
tmpDir,
|
||||
gitHubVersion,
|
||||
sampleApiDetails,
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
throw new Error("initConfig did not throw error");
|
||||
} catch (err) {
|
||||
@@ -554,9 +628,9 @@ test("Invalid format of remote config handled correctly", async (t) => {
|
||||
});
|
||||
|
||||
test("No detected languages", async (t) => {
|
||||
return await withTmpDir(async (tempDir) => {
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
mockListLanguages([]);
|
||||
const codeql = setCodeQL({
|
||||
const codeQL = setCodeQL({
|
||||
async resolveLanguages() {
|
||||
return {};
|
||||
},
|
||||
@@ -567,11 +641,23 @@ test("No detected languages", async (t) => {
|
||||
|
||||
try {
|
||||
await configUtils.initConfig(
|
||||
createTestInitConfigInputs({
|
||||
tempDir,
|
||||
codeql,
|
||||
workspacePath: tempDir,
|
||||
}),
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
codeQL,
|
||||
tmpDir,
|
||||
gitHubVersion,
|
||||
sampleApiDetails,
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
throw new Error("initConfig did not throw error");
|
||||
} catch (err) {
|
||||
@@ -581,17 +667,28 @@ test("No detected languages", async (t) => {
|
||||
});
|
||||
|
||||
test("Unknown languages", async (t) => {
|
||||
return await withTmpDir(async (tempDir) => {
|
||||
const languagesInput = "rubbish,english";
|
||||
return await withTmpDir(async (tmpDir) => {
|
||||
const languages = "rubbish,english";
|
||||
|
||||
try {
|
||||
await configUtils.initConfig(
|
||||
createTestInitConfigInputs({
|
||||
languagesInput,
|
||||
tempDir,
|
||||
codeql: getCachedCodeQL(),
|
||||
workspacePath: tempDir,
|
||||
}),
|
||||
languages,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
false,
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
{ owner: "github", repo: "example" },
|
||||
tmpDir,
|
||||
getCachedCodeQL(),
|
||||
tmpDir,
|
||||
gitHubVersion,
|
||||
sampleApiDetails,
|
||||
getRunnerLogger(true),
|
||||
);
|
||||
throw new Error("initConfig did not throw error");
|
||||
} catch (err) {
|
||||
|
||||
@@ -80,10 +80,6 @@ export interface Config {
|
||||
* Set of languages to run analysis for.
|
||||
*/
|
||||
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.
|
||||
* Mainly intended to be used for status reporting.
|
||||
@@ -395,82 +391,49 @@ export async function getRawLanguages(
|
||||
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.
|
||||
*/
|
||||
export async function getDefaultConfig({
|
||||
languagesInput,
|
||||
queriesInput,
|
||||
packsInput,
|
||||
buildModeInput,
|
||||
dbLocation,
|
||||
trapCachingEnabled,
|
||||
debugMode,
|
||||
debugArtifactName,
|
||||
debugDatabaseName,
|
||||
repository,
|
||||
tempDir,
|
||||
codeql,
|
||||
githubVersion,
|
||||
logger,
|
||||
}: GetDefaultConfigInputs): Promise<Config> {
|
||||
export async function getDefaultConfig(
|
||||
languagesInput: string | undefined,
|
||||
rawQueriesInput: string | undefined,
|
||||
rawPacksInput: string | undefined,
|
||||
dbLocation: string | undefined,
|
||||
trapCachingEnabled: boolean,
|
||||
debugMode: boolean,
|
||||
debugArtifactName: string,
|
||||
debugDatabaseName: string,
|
||||
repository: RepositoryNwo,
|
||||
tempDir: string,
|
||||
codeQL: CodeQL,
|
||||
gitHubVersion: GitHubVersion,
|
||||
logger: Logger,
|
||||
): Promise<Config> {
|
||||
const languages = await getLanguages(
|
||||
codeql,
|
||||
codeQL,
|
||||
languagesInput,
|
||||
repository,
|
||||
logger,
|
||||
);
|
||||
const augmentationProperties = calculateAugmentation(
|
||||
packsInput,
|
||||
queriesInput,
|
||||
rawPacksInput,
|
||||
rawQueriesInput,
|
||||
languages,
|
||||
);
|
||||
|
||||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(
|
||||
trapCachingEnabled,
|
||||
codeql,
|
||||
codeQL,
|
||||
languages,
|
||||
logger,
|
||||
);
|
||||
|
||||
return {
|
||||
languages,
|
||||
buildMode: buildModeInput,
|
||||
originalUserInput: {},
|
||||
tempDir,
|
||||
codeQLCmd: codeql.getPath(),
|
||||
gitHubVersion: githubVersion,
|
||||
codeQLCmd: codeQL.getPath(),
|
||||
gitHubVersion,
|
||||
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
||||
debugMode,
|
||||
debugArtifactName,
|
||||
@@ -503,25 +466,24 @@ async function downloadCacheWithTime(
|
||||
/**
|
||||
* Load the config from the given file.
|
||||
*/
|
||||
async function loadConfig({
|
||||
languagesInput,
|
||||
queriesInput,
|
||||
packsInput,
|
||||
buildModeInput,
|
||||
configFile,
|
||||
dbLocation,
|
||||
trapCachingEnabled,
|
||||
debugMode,
|
||||
debugArtifactName,
|
||||
debugDatabaseName,
|
||||
repository,
|
||||
tempDir,
|
||||
codeql,
|
||||
workspacePath,
|
||||
githubVersion,
|
||||
apiDetails,
|
||||
logger,
|
||||
}: LoadConfigInputs): Promise<Config> {
|
||||
async function loadConfig(
|
||||
languagesInput: string | undefined,
|
||||
rawQueriesInput: string | undefined,
|
||||
rawPacksInput: string | undefined,
|
||||
configFile: string,
|
||||
dbLocation: 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 parsedYAML: UserConfig;
|
||||
|
||||
if (isLocal(configFile)) {
|
||||
@@ -533,32 +495,31 @@ async function loadConfig({
|
||||
}
|
||||
|
||||
const languages = await getLanguages(
|
||||
codeql,
|
||||
codeQL,
|
||||
languagesInput,
|
||||
repository,
|
||||
logger,
|
||||
);
|
||||
|
||||
const augmentationProperties = calculateAugmentation(
|
||||
packsInput,
|
||||
queriesInput,
|
||||
rawPacksInput,
|
||||
rawQueriesInput,
|
||||
languages,
|
||||
);
|
||||
|
||||
const { trapCaches, trapCacheDownloadTime } = await downloadCacheWithTime(
|
||||
trapCachingEnabled,
|
||||
codeql,
|
||||
codeQL,
|
||||
languages,
|
||||
logger,
|
||||
);
|
||||
|
||||
return {
|
||||
languages,
|
||||
buildMode: buildModeInput,
|
||||
originalUserInput: parsedYAML,
|
||||
tempDir,
|
||||
codeQLCmd: codeql.getPath(),
|
||||
gitHubVersion: githubVersion,
|
||||
codeQLCmd: codeQL.getPath(),
|
||||
gitHubVersion,
|
||||
dbLocation: dbLocationOrDefault(dbLocation, tempDir),
|
||||
debugMode,
|
||||
debugArtifactName,
|
||||
@@ -804,33 +765,76 @@ function dbLocationOrDefault(
|
||||
* 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.
|
||||
*/
|
||||
export async function initConfig(inputs: InitConfigInputs): Promise<Config> {
|
||||
export async function initConfig(
|
||||
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;
|
||||
|
||||
const { logger, workspacePath } = inputs;
|
||||
|
||||
// if configInput is set, it takes precedence over configFile
|
||||
if (inputs.configInput) {
|
||||
if (inputs.configFile) {
|
||||
if (configInput) {
|
||||
if (configFile) {
|
||||
logger.warning(
|
||||
`Both a config file and config input were provided. Ignoring config file.`,
|
||||
);
|
||||
}
|
||||
inputs.configFile = path.resolve(
|
||||
workspacePath,
|
||||
"user-config-from-action.yml",
|
||||
);
|
||||
fs.writeFileSync(inputs.configFile, inputs.configInput);
|
||||
logger.debug(`Using config from action input: ${inputs.configFile}`);
|
||||
configFile = path.resolve(workspacePath, "user-config-from-action.yml");
|
||||
fs.writeFileSync(configFile, configInput);
|
||||
logger.debug(`Using config from action input: ${configFile}`);
|
||||
}
|
||||
|
||||
// If no config file was provided create an empty one
|
||||
if (!inputs.configFile) {
|
||||
if (!configFile) {
|
||||
logger.debug("No configuration file was provided");
|
||||
config = await getDefaultConfig(inputs);
|
||||
config = await getDefaultConfig(
|
||||
languagesInput,
|
||||
queriesInput,
|
||||
packsInput,
|
||||
dbLocation,
|
||||
trapCachingEnabled,
|
||||
debugMode,
|
||||
debugArtifactName,
|
||||
debugDatabaseName,
|
||||
repository,
|
||||
tempDir,
|
||||
codeQL,
|
||||
gitHubVersion,
|
||||
logger,
|
||||
);
|
||||
} else {
|
||||
// Convince the type checker that inputs.configFile is defined.
|
||||
config = await loadConfig({ ...inputs, configFile: inputs.configFile });
|
||||
config = await loadConfig(
|
||||
languagesInput,
|
||||
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
|
||||
|
||||
@@ -8,18 +8,19 @@ import * as actionsUtil from "./actions-util";
|
||||
import { GitHubApiDetails } from "./api-client";
|
||||
import * as apiClient from "./api-client";
|
||||
import { setCodeQL } from "./codeql";
|
||||
import { Config } from "./config-utils";
|
||||
import { Config, defaultAugmentationProperties } from "./config-utils";
|
||||
import { uploadDatabases } from "./database-upload";
|
||||
import { Language } from "./languages";
|
||||
import { RepositoryNwo } from "./repository";
|
||||
import {
|
||||
createTestConfig,
|
||||
getRecordingLogger,
|
||||
LoggedMessage,
|
||||
setupActionsVars,
|
||||
setupTests,
|
||||
} from "./testing-utils";
|
||||
import {
|
||||
DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
DEFAULT_DEBUG_DATABASE_NAME,
|
||||
GitHubVariant,
|
||||
HTTPError,
|
||||
initializeEnvironment,
|
||||
@@ -40,10 +41,20 @@ const testApiDetails: GitHubApiDetails = {
|
||||
};
|
||||
|
||||
function getTestConfig(tmpDir: string): Config {
|
||||
return createTestConfig({
|
||||
return {
|
||||
languages: [Language.javascript],
|
||||
originalUserInput: {},
|
||||
tempDir: tmpDir,
|
||||
codeQLCmd: "foo",
|
||||
gitHubVersion: { type: GitHubVariant.DOTCOM },
|
||||
dbLocation: tmpDir,
|
||||
});
|
||||
debugMode: false,
|
||||
debugArtifactName: DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
debugDatabaseName: DEFAULT_DEBUG_DATABASE_NAME,
|
||||
augmentationProperties: defaultAugmentationProperties,
|
||||
trapCaches: {},
|
||||
trapCacheDownloadTime: 0,
|
||||
};
|
||||
}
|
||||
|
||||
async function mockHttpRequests(databaseUploadStatusCode: number) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"bundleVersion": "codeql-bundle-v2.16.1",
|
||||
"cliVersion": "2.16.1",
|
||||
"priorBundleVersion": "codeql-bundle-v2.16.0",
|
||||
"priorCliVersion": "2.16.0"
|
||||
"bundleVersion": "codeql-bundle-v2.16.0",
|
||||
"cliVersion": "2.16.0",
|
||||
"priorBundleVersion": "codeql-bundle-v2.15.5",
|
||||
"priorCliVersion": "2.15.5"
|
||||
}
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
/**
|
||||
* 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 {
|
||||
/** Whether the `analyze` Action completes successfully. */
|
||||
ANALYZE_DID_COMPLETE_SUCCESSFULLY = "CODEQL_ACTION_ANALYZE_DID_COMPLETE_SUCCESSFULLY",
|
||||
@@ -41,9 +35,6 @@ export enum EnvVar {
|
||||
/** UUID representing the current job run. */
|
||||
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",
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,8 +44,8 @@ export interface FeatureEnablement {
|
||||
* Each value of this enum should end with `_enabled`.
|
||||
*/
|
||||
export enum Feature {
|
||||
CodeqlJavaLombokEnabled = "codeql_java_lombok_enabled",
|
||||
CppDependencyInstallation = "cpp_dependency_installation_enabled",
|
||||
CppTrapCachingEnabled = "cpp_trap_caching_enabled",
|
||||
DisableKotlinAnalysisEnabled = "disable_kotlin_analysis_enabled",
|
||||
DisablePythonDependencyInstallationEnabled = "disable_python_dependency_installation_enabled",
|
||||
PythonDefaultIsToSkipDependencyInstallationEnabled = "python_default_is_to_skip_dependency_installation_enabled",
|
||||
@@ -58,16 +58,16 @@ export const featureConfig: Record<
|
||||
Feature,
|
||||
{ envVar: string; minimumVersion: string | undefined; defaultValue: boolean }
|
||||
> = {
|
||||
[Feature.CodeqlJavaLombokEnabled]: {
|
||||
envVar: "CODEQL_JAVA_LOMBOK",
|
||||
minimumVersion: "2.14.0",
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.CppDependencyInstallation]: {
|
||||
envVar: "CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES",
|
||||
minimumVersion: "2.15.0",
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.CppTrapCachingEnabled]: {
|
||||
envVar: "CODEQL_CPP_TRAP_CACHING",
|
||||
minimumVersion: "2.16.1",
|
||||
defaultValue: false,
|
||||
},
|
||||
[Feature.DisableKotlinAnalysisEnabled]: {
|
||||
envVar: "CODEQL_DISABLE_KOTLIN_ANALYSIS",
|
||||
minimumVersion: undefined,
|
||||
@@ -105,7 +105,7 @@ export const featureConfig: Record<
|
||||
// here!
|
||||
envVar: "CODEQL_ACTION_DISABLE_PYTHON_DEPENDENCY_INSTALLATION",
|
||||
minimumVersion: "2.16.0",
|
||||
defaultValue: true,
|
||||
defaultValue: false,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as core from "@actions/core";
|
||||
import * as github from "@actions/github";
|
||||
|
||||
import * as actionsUtil from "./actions-util";
|
||||
@@ -9,7 +8,6 @@ import { EnvVar } from "./environment";
|
||||
import { Feature, FeatureEnablement } from "./feature-flags";
|
||||
import { Logger } from "./logging";
|
||||
import { RepositoryNwo, parseRepositoryNwo } from "./repository";
|
||||
import { JobStatus } from "./status-report";
|
||||
import * as uploadLib from "./upload-lib";
|
||||
import {
|
||||
delay,
|
||||
@@ -38,10 +36,6 @@ export interface UploadFailedSarifResult extends uploadLib.UploadStatusReport {
|
||||
sarifID?: string;
|
||||
}
|
||||
|
||||
export interface JobStatusReport {
|
||||
job_status: JobStatus;
|
||||
}
|
||||
|
||||
function createFailedUploadFailedSarifResult(
|
||||
error: unknown,
|
||||
): UploadFailedSarifResult {
|
||||
@@ -127,15 +121,6 @@ export async function tryUploadSarifIfRunFailed(
|
||||
logger: Logger,
|
||||
): Promise<UploadFailedSarifResult> {
|
||||
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 {
|
||||
return await maybeUploadFailedSarif(
|
||||
config,
|
||||
@@ -150,10 +135,6 @@ export async function tryUploadSarifIfRunFailed(
|
||||
return createFailedUploadFailedSarifResult(e);
|
||||
}
|
||||
} else {
|
||||
core.exportVariable(
|
||||
EnvVar.JOB_STATUS,
|
||||
process.env[EnvVar.JOB_STATUS] ?? JobStatus.Success,
|
||||
);
|
||||
return {
|
||||
upload_failed_run_skipped_because:
|
||||
"Analyze Action completed successfully",
|
||||
@@ -301,20 +282,3 @@ 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,8 +28,7 @@ import {
|
||||
|
||||
interface InitPostStatusReport
|
||||
extends StatusReportBase,
|
||||
initActionPostHelper.UploadFailedSarifResult,
|
||||
initActionPostHelper.JobStatusReport {}
|
||||
initActionPostHelper.UploadFailedSarifResult {}
|
||||
|
||||
async function runWrapper() {
|
||||
const startedAt = new Date();
|
||||
@@ -84,7 +83,6 @@ async function runWrapper() {
|
||||
const statusReport: InitPostStatusReport = {
|
||||
...statusReportBase,
|
||||
...uploadFailedSarifResult,
|
||||
job_status: initActionPostHelper.getFinalJobStatus(),
|
||||
};
|
||||
await sendStatusReport(statusReport);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import {
|
||||
getActionsStatus,
|
||||
sendStatusReport,
|
||||
} from "./status-report";
|
||||
import { ToolsFeature } from "./tools-features";
|
||||
import { ToolsFeature, isSupportedToolsFeature } from "./tools-features";
|
||||
import { getTotalCacheSize } from "./trap-caching";
|
||||
import {
|
||||
checkDiskUsage,
|
||||
@@ -265,32 +265,29 @@ async function run() {
|
||||
}
|
||||
core.endGroup();
|
||||
|
||||
config = await initConfig({
|
||||
languagesInput: getOptionalInput("languages"),
|
||||
queriesInput: getOptionalInput("queries"),
|
||||
packsInput: getOptionalInput("packs"),
|
||||
buildModeInput: getOptionalInput("build-mode"),
|
||||
configFile: getOptionalInput("config-file"),
|
||||
dbLocation: getOptionalInput("db-location"),
|
||||
configInput: getOptionalInput("config"),
|
||||
trapCachingEnabled: getTrapCachingEnabled(),
|
||||
config = await initConfig(
|
||||
getOptionalInput("languages"),
|
||||
getOptionalInput("queries"),
|
||||
getOptionalInput("packs"),
|
||||
getOptionalInput("config-file"),
|
||||
getOptionalInput("db-location"),
|
||||
getOptionalInput("config"),
|
||||
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: getOptionalInput("debug") === "true" || core.isDebug(),
|
||||
debugArtifactName:
|
||||
getOptionalInput("debug-artifact-name") || DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
debugDatabaseName:
|
||||
getOptionalInput("debug-database-name") || DEFAULT_DEBUG_DATABASE_NAME,
|
||||
repository: repositoryNwo,
|
||||
tempDir: getTemporaryDirectory(),
|
||||
getOptionalInput("debug") === "true" || core.isDebug(),
|
||||
getOptionalInput("debug-artifact-name") || DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
getOptionalInput("debug-database-name") || DEFAULT_DEBUG_DATABASE_NAME,
|
||||
repositoryNwo,
|
||||
getTemporaryDirectory(),
|
||||
codeql,
|
||||
workspacePath: getRequiredEnvParam("GITHUB_WORKSPACE"),
|
||||
githubVersion: gitHubVersion,
|
||||
getRequiredEnvParam("GITHUB_WORKSPACE"),
|
||||
gitHubVersion,
|
||||
apiDetails,
|
||||
logger,
|
||||
});
|
||||
);
|
||||
|
||||
await checkInstallPython311(config.languages, codeql);
|
||||
|
||||
@@ -328,6 +325,9 @@ async function run() {
|
||||
}
|
||||
|
||||
try {
|
||||
// Query CLI for supported features
|
||||
const versionInfo = await codeql.getVersion();
|
||||
|
||||
// Forward Go flags
|
||||
const goFlags = process.env["GOFLAGS"];
|
||||
if (goFlags) {
|
||||
@@ -351,9 +351,10 @@ async function run() {
|
||||
// typically dynamically linked, this provides a suitable entry point for the CodeQL tracer.
|
||||
if (
|
||||
fileOutput.includes("statically linked") &&
|
||||
!(await codeql.supportsFeature(
|
||||
!isSupportedToolsFeature(
|
||||
versionInfo,
|
||||
ToolsFeature.IndirectTracingSupportsStaticBinaries,
|
||||
))
|
||||
)
|
||||
) {
|
||||
try {
|
||||
logger.debug(`Applying static binary workaround for Go`);
|
||||
@@ -424,37 +425,19 @@ async function run() {
|
||||
core.exportVariable(kotlinLimitVar, "1.9.20");
|
||||
}
|
||||
|
||||
if (
|
||||
config.languages.includes(Language.java) &&
|
||||
// Java Lombok support is enabled by default for >= 2.14.4
|
||||
(await codeQlVersionAbove(codeql, "2.14.0")) &&
|
||||
!(await codeQlVersionAbove(codeql, "2.14.4"))
|
||||
) {
|
||||
if (config.languages.includes(Language.java)) {
|
||||
const envVar = "CODEQL_EXTRACTOR_JAVA_RUN_ANNOTATION_PROCESSORS";
|
||||
if (process.env[envVar]) {
|
||||
logger.info(
|
||||
`Environment variable ${envVar} already set. Not en/disabling CodeQL Java Lombok support`,
|
||||
);
|
||||
} else {
|
||||
} else if (
|
||||
await features.getValue(Feature.CodeqlJavaLombokEnabled, codeql)
|
||||
) {
|
||||
logger.info("Enabling CodeQL Java Lombok support");
|
||||
core.exportVariable(envVar, "true");
|
||||
}
|
||||
}
|
||||
|
||||
if (config.languages.includes(Language.cpp)) {
|
||||
const envVar = "CODEQL_EXTRACTOR_CPP_TRAP_CACHING";
|
||||
if (process.env[envVar]) {
|
||||
logger.info(
|
||||
`Environment variable ${envVar} already set. Not en/disabling CodeQL C++ TRAP caching support`,
|
||||
);
|
||||
} else if (
|
||||
getTrapCachingEnabled() &&
|
||||
(await features.getValue(Feature.CppTrapCachingEnabled, codeql))
|
||||
) {
|
||||
logger.info("Enabling CodeQL C++ TRAP caching support");
|
||||
core.exportVariable(envVar, "true");
|
||||
} else {
|
||||
logger.info("Disabling CodeQL C++ TRAP caching support");
|
||||
logger.info("Disabling CodeQL Java Lombok support");
|
||||
core.exportVariable(envVar, "false");
|
||||
}
|
||||
}
|
||||
|
||||
42
src/init.ts
42
src/init.ts
@@ -10,6 +10,7 @@ import * as configUtils from "./config-utils";
|
||||
import { CodeQLDefaultVersionInfo } from "./feature-flags";
|
||||
import { Language, isScannedLanguage } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
import { RepositoryNwo } from "./repository";
|
||||
import { ToolsSource } from "./setup-codeql";
|
||||
import { TracerConfig, getCombinedTracerConfig } from "./tracer-config";
|
||||
import * as util from "./util";
|
||||
@@ -44,11 +45,44 @@ export async function initCodeQL(
|
||||
}
|
||||
|
||||
export async function initConfig(
|
||||
inputs: configUtils.InitConfigInputs,
|
||||
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: util.GitHubVersion,
|
||||
apiDetails: GitHubApiCombinedDetails,
|
||||
logger: Logger,
|
||||
): Promise<configUtils.Config> {
|
||||
const logger = inputs.logger;
|
||||
logger.startGroup("Load language configuration");
|
||||
const config = await configUtils.initConfig(inputs);
|
||||
const config = await configUtils.initConfig(
|
||||
languagesInput,
|
||||
queriesInput,
|
||||
packsInput,
|
||||
configFile,
|
||||
dbLocation,
|
||||
configInput,
|
||||
trapCachingEnabled,
|
||||
debugMode,
|
||||
debugArtifactName,
|
||||
debugDatabaseName,
|
||||
repository,
|
||||
tempDir,
|
||||
codeQL,
|
||||
workspacePath,
|
||||
gitHubVersion,
|
||||
apiDetails,
|
||||
logger,
|
||||
);
|
||||
printPathFiltersWarning(config, logger);
|
||||
logger.endGroup();
|
||||
return config;
|
||||
@@ -90,7 +124,7 @@ export async function runInit(
|
||||
} catch (e) {
|
||||
throw processError(e);
|
||||
}
|
||||
return await getCombinedTracerConfig(codeql, config);
|
||||
return await getCombinedTracerConfig(await codeql.getVersion(), config);
|
||||
}
|
||||
|
||||
export function printPathFiltersWarning(
|
||||
|
||||
@@ -32,20 +32,12 @@ export type ActionName =
|
||||
| "upload-sarif";
|
||||
|
||||
export type ActionStatus =
|
||||
| "aborted" // Only used in the init Action, if init failed before initializing the tracer due to something other than a configuration error.
|
||||
| "aborted"
|
||||
| "failure"
|
||||
| "starting"
|
||||
| "success"
|
||||
| "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 {
|
||||
/** Name of the action being executed. */
|
||||
action_name: ActionName;
|
||||
@@ -96,7 +88,7 @@ export interface StatusReportBase {
|
||||
/** Action runner hardware architecture (context runner.arch). */
|
||||
runner_arch?: string;
|
||||
/** 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.
|
||||
*/
|
||||
@@ -106,7 +98,7 @@ export interface StatusReportBase {
|
||||
/** Action runner operating system release (x.y.z from os.release()). */
|
||||
runner_os_release?: string;
|
||||
/** 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. */
|
||||
started_at: string;
|
||||
/** State this action is currently in. */
|
||||
@@ -141,25 +133,6 @@ 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.
|
||||
export interface EventReport {
|
||||
/** Time this event ended. */
|
||||
@@ -192,7 +165,7 @@ export async function createStatusReportBase(
|
||||
actionName: ActionName,
|
||||
status: ActionStatus,
|
||||
actionStartedAt: Date,
|
||||
diskInfo: DiskUsage | undefined,
|
||||
diskInfo: DiskUsage,
|
||||
cause?: string,
|
||||
exception?: string,
|
||||
): Promise<StatusReportBase> {
|
||||
@@ -230,7 +203,9 @@ export async function createStatusReportBase(
|
||||
job_name: jobName,
|
||||
job_run_uuid: jobRunUUID,
|
||||
ref,
|
||||
runner_available_disk_space_bytes: diskInfo.numAvailableBytes,
|
||||
runner_os: runnerOs,
|
||||
runner_total_disk_space_bytes: diskInfo.numTotalBytes,
|
||||
started_at: workflowStartedAt,
|
||||
status,
|
||||
testing_environment: testingEnvironment,
|
||||
@@ -239,11 +214,6 @@ export async function createStatusReportBase(
|
||||
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
|
||||
if (cause) {
|
||||
statusReport.cause = cause;
|
||||
@@ -303,8 +273,6 @@ const INCOMPATIBLE_MSG =
|
||||
export async function sendStatusReport<S extends StatusReportBase>(
|
||||
statusReport: S,
|
||||
): Promise<boolean> {
|
||||
setJobStatusIfUnsuccessful(statusReport.status);
|
||||
|
||||
const statusReportJSON = JSON.stringify(statusReport);
|
||||
core.debug(`Sending status report: ${statusReportJSON}`);
|
||||
// If in test mode we don't want to upload the results
|
||||
|
||||
@@ -8,21 +8,14 @@ import * as sinon from "sinon";
|
||||
|
||||
import * as apiClient from "./api-client";
|
||||
import { GitHubApiDetails } from "./api-client";
|
||||
import * as codeql from "./codeql";
|
||||
import { Config } from "./config-utils";
|
||||
import * as CodeQL from "./codeql";
|
||||
import {
|
||||
CodeQLDefaultVersionInfo,
|
||||
Feature,
|
||||
FeatureEnablement,
|
||||
} from "./feature-flags";
|
||||
import { Logger } from "./logging";
|
||||
import {
|
||||
DEFAULT_DEBUG_ARTIFACT_NAME,
|
||||
DEFAULT_DEBUG_DATABASE_NAME,
|
||||
GitHubVariant,
|
||||
GitHubVersion,
|
||||
HTTPError,
|
||||
} from "./util";
|
||||
import { HTTPError } from "./util";
|
||||
|
||||
export const SAMPLE_DOTCOM_API_DETAILS = {
|
||||
auth: "token",
|
||||
@@ -80,7 +73,7 @@ export function setupTests(test: TestFn<any>) {
|
||||
typedTest.beforeEach((t) => {
|
||||
// Set an empty CodeQL object so that all method calls will fail
|
||||
// unless the test explicitly sets one up.
|
||||
codeql.setCodeQL({});
|
||||
CodeQL.setCodeQL({});
|
||||
|
||||
// Replace stdout and stderr so we can record output during tests
|
||||
t.context.testOutput = "";
|
||||
@@ -221,7 +214,7 @@ export function mockLanguagesInRepo(languages: string[]) {
|
||||
export const makeVersionInfo = (
|
||||
version: string,
|
||||
features?: { [name: string]: boolean },
|
||||
): codeql.VersionInfo => ({
|
||||
): CodeQL.VersionInfo => ({
|
||||
version,
|
||||
features,
|
||||
});
|
||||
@@ -230,11 +223,11 @@ export function mockCodeQLVersion(
|
||||
version: string,
|
||||
features?: { [name: string]: boolean },
|
||||
) {
|
||||
return codeql.setCodeQL({
|
||||
return {
|
||||
async getVersion() {
|
||||
return makeVersionInfo(version, features);
|
||||
},
|
||||
});
|
||||
} as CodeQL.CodeQL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,30 +291,3 @@ export function mockBundleDownloadApi({
|
||||
|
||||
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,
|
||||
);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user