mirror of
https://github.com/github/codeql-action.git
synced 2025-12-22 23:30:05 +08:00
Compare commits
93 Commits
codeql-bun
...
v2.22.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0116bc2df5 | ||
|
|
f5a984b113 | ||
|
|
82ba90b1d9 | ||
|
|
34f97d7a16 | ||
|
|
74442e0a95 | ||
|
|
bd32fab74f | ||
|
|
b584cf8321 | ||
|
|
761255a4a3 | ||
|
|
346d5c4b07 | ||
|
|
5950d13564 | ||
|
|
c1a0ad9a04 | ||
|
|
76a9f5c431 | ||
|
|
d90b8d79de | ||
|
|
175f696a4d | ||
|
|
8a2cbabd43 | ||
|
|
a5cf70c3f1 | ||
|
|
a67b110795 | ||
|
|
0eb279015c | ||
|
|
275f994944 | ||
|
|
d5d445b7af | ||
|
|
2a7218bdef | ||
|
|
78bfd29301 | ||
|
|
dfb913f660 | ||
|
|
e62d946796 | ||
|
|
026e833827 | ||
|
|
5d6442e87d | ||
|
|
4ab92370dd | ||
|
|
83d1db3366 | ||
|
|
2125352e3e | ||
|
|
d52a751f8f | ||
|
|
947b43a6b6 | ||
|
|
788783aba5 | ||
|
|
fdcae64e14 | ||
|
|
8554648f41 | ||
|
|
18e6c398ce | ||
|
|
5e34d08d9e | ||
|
|
faf91ca6bd | ||
|
|
8193a92e41 | ||
|
|
ffaea6c837 | ||
|
|
0a0988c4b2 | ||
|
|
0d5c2e0228 | ||
|
|
94b6970619 | ||
|
|
669c61022c | ||
|
|
028bacb8e9 | ||
|
|
d0916526cd | ||
|
|
102a12bba4 | ||
|
|
8295705640 | ||
|
|
4eccc6dac4 | ||
|
|
aed2e7f47f | ||
|
|
a2dc5ffaff | ||
|
|
b6ea09e3e4 | ||
|
|
fd3d78671c | ||
|
|
2cb752a87e | ||
|
|
e50f53baa1 | ||
|
|
0a65c007f6 | ||
|
|
3f7850a179 | ||
|
|
27235304e0 | ||
|
|
8f0e8b0890 | ||
|
|
f243294ab7 | ||
|
|
075eb6aaea | ||
|
|
1ea6a10947 | ||
|
|
e26ed57a22 | ||
|
|
0ac7669167 | ||
|
|
235bdca565 | ||
|
|
94f3e9b563 | ||
|
|
3b2fee487e | ||
|
|
a144bf5d7f | ||
|
|
4154eb799b | ||
|
|
7f4a9481a7 | ||
|
|
faf7528b44 | ||
|
|
2b193c5ab5 | ||
|
|
eb71a60380 | ||
|
|
36777d2236 | ||
|
|
1727de39fe | ||
|
|
c8dd2bc90f | ||
|
|
db9f2c5968 | ||
|
|
738030674f | ||
|
|
68d0b65ee5 | ||
|
|
bb70bab648 | ||
|
|
41a13ec084 | ||
|
|
9a5a628613 | ||
|
|
8ac187720c | ||
|
|
f6d9b6bcfa | ||
|
|
7b0b42afec | ||
|
|
abb71f14cf | ||
|
|
604448043e | ||
|
|
4cee553ea6 | ||
|
|
df098abd11 | ||
|
|
4611ff9b23 | ||
|
|
2bd75f528c | ||
|
|
3c15d2383b | ||
|
|
c08086a26a | ||
|
|
d718153f0a |
42
.github/workflows/__analyze-ref-input.yml
generated
vendored
42
.github/workflows/__analyze-ref-input.yml
generated
vendored
@@ -25,54 +25,12 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
version: stable-20220908
|
||||
- os: windows-latest
|
||||
version: stable-20220908
|
||||
- os: ubuntu-latest
|
||||
version: stable-20221211
|
||||
- os: macos-latest
|
||||
version: stable-20221211
|
||||
- os: windows-latest
|
||||
version: stable-20221211
|
||||
- os: ubuntu-latest
|
||||
version: stable-20230418
|
||||
- os: macos-latest
|
||||
version: stable-20230418
|
||||
- os: windows-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: macos-latest
|
||||
version: stable-v2.13.5
|
||||
- os: windows-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.14.6
|
||||
- os: windows-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
version: default
|
||||
- os: windows-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
version: latest
|
||||
- os: macos-latest
|
||||
version: latest
|
||||
- os: windows-latest
|
||||
version: latest
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
- os: macos-latest
|
||||
version: nightly-latest
|
||||
- os: windows-latest
|
||||
version: nightly-latest
|
||||
name: "Analyze: 'ref' and 'sha' from inputs"
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
9
.github/workflows/__export-file-baseline-information.yml
generated
vendored
9
.github/workflows/__export-file-baseline-information.yml
generated
vendored
@@ -59,8 +59,6 @@ jobs:
|
||||
with:
|
||||
languages: javascript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
env:
|
||||
CODEQL_FILE_BASELINE_INFORMATION: true
|
||||
- uses: ./../action/.github/actions/setup-swift
|
||||
with:
|
||||
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||
@@ -70,8 +68,6 @@ jobs:
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
env:
|
||||
CODEQL_FILE_BASELINE_INFORMATION: true
|
||||
- name: Upload SARIF
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
@@ -82,13 +78,13 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
expected_baseline_languages="cpp cs go java js py rb"
|
||||
expected_baseline_languages="c csharp go java kotlin javascript python ruby"
|
||||
if [[ $RUNNER_OS != "Windows" ]]; then
|
||||
expected_baseline_languages+=" swift"
|
||||
fi
|
||||
|
||||
for lang in ${expected_baseline_languages}; do
|
||||
rule_name="${lang}/baseline/expected-extracted-files"
|
||||
rule_name="cli/expected-extracted-files/${lang}"
|
||||
found_notification=$(jq --arg rule_name "${rule_name}" '[.runs[0].tool.driver.notifications |
|
||||
select(. != null) | flatten | .[].id] | any(. == $rule_name)' javascript.sarif)
|
||||
if [[ "${found_notification}" != "true" ]]; then
|
||||
@@ -99,4 +95,5 @@ jobs:
|
||||
fi
|
||||
done
|
||||
env:
|
||||
CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
|
||||
96
.github/workflows/__go-indirect-tracing-workaround-diagnostic.yml
generated
vendored
Normal file
96
.github/workflows/__go-indirect-tracing-workaround-diagnostic.yml
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
# 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 - Go: diagnostic when Go is changed after init step'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
go-indirect-tracing-workaround-diagnostic:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
name: 'Go: diagnostic when Go is changed after init step'
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- 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 == '20220908' ||
|
||||
matrix.version == '20221211'
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
# We need a Go version that ships with statically linked binaries on Linux
|
||||
go-version: '>=1.21.0'
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
# Deliberately change Go after the `init` step
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.20'
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: go build main.go
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
upload-database: false
|
||||
- name: Check diagnostic appears in SARIF
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
SARIF_PATH: ${{ runner.temp }}/results/go.sarif
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
|
||||
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
|
||||
const run = sarif.runs[0];
|
||||
|
||||
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
|
||||
const statusPageNotifications = toolExecutionNotifications.filter(n =>
|
||||
n.descriptor.id === 'go/workflow/go-installed-after-codeql-init' && n.properties?.visibility?.statusPage
|
||||
);
|
||||
if (statusPageNotifications.length !== 1) {
|
||||
core.setFailed(
|
||||
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
|
||||
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
|
||||
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
|
||||
`${JSON.stringify(toolExecutionNotifications)}.`
|
||||
);
|
||||
}
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
94
.github/workflows/__go-indirect-tracing-workaround.yml
generated
vendored
Normal file
94
.github/workflows/__go-indirect-tracing-workaround.yml
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
# 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 - Go: workaround for indirect tracing'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
CODEQL_EXTRACTOR_JAVA_AGENT_DISABLE_KOTLIN: 'true'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/v2
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
go-indirect-tracing-workaround:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
name: 'Go: workaround for indirect tracing'
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- 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 == '20220908' ||
|
||||
matrix.version == '20221211'
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
# We need a Go version that ships with statically linked binaries on Linux
|
||||
go-version: '>=1.21.0'
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: go build main.go
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
- shell: bash
|
||||
run: |
|
||||
if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then
|
||||
echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \
|
||||
"CODEQL_ACTION_GO_BINARY environment variable is not set."
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${CODEQL_ACTION_GO_BINARY}" ]]; then
|
||||
echo "CODEQL_ACTION_GO_BINARY is set, but the corresponding script does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Once we start running Bash 4.2 in all environments, we can replace the
|
||||
# `! -z` flag with the more elegant `-v` which confirms that the variable
|
||||
# is actually unset and not potentially set to a blank value.
|
||||
if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then
|
||||
echo "Expected the Go autobuilder not to be run, but the" \
|
||||
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set."
|
||||
exit 1
|
||||
fi
|
||||
cd "$RUNNER_TEMP/codeql_databases"
|
||||
if [[ ! -d go ]]; then
|
||||
echo "Did not find a Go database"
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
3
.github/workflows/__go-tracing-autobuilder.yml
generated
vendored
3
.github/workflows/__go-tracing-autobuilder.yml
generated
vendored
@@ -80,6 +80,9 @@ jobs:
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ~1.21.1
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
|
||||
3
.github/workflows/__go-tracing-custom-build-steps.yml
generated
vendored
3
.github/workflows/__go-tracing-custom-build-steps.yml
generated
vendored
@@ -80,6 +80,9 @@ jobs:
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ~1.21.1
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
|
||||
3
.github/workflows/__go-tracing-legacy-workflow.yml
generated
vendored
3
.github/workflows/__go-tracing-legacy-workflow.yml
generated
vendored
@@ -80,6 +80,9 @@ jobs:
|
||||
)
|
||||
shell: bash
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ~1.21.1
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
|
||||
42
.github/workflows/__resolve-environment-action.yml
generated
vendored
42
.github/workflows/__resolve-environment-action.yml
generated
vendored
@@ -31,6 +31,24 @@ jobs:
|
||||
version: stable-v2.13.4
|
||||
- os: windows-latest
|
||||
version: stable-v2.13.4
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
version: default
|
||||
- os: windows-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
version: latest
|
||||
- os: macos-latest
|
||||
version: latest
|
||||
- os: windows-latest
|
||||
version: latest
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
- os: macos-latest
|
||||
version: nightly-latest
|
||||
- os: windows-latest
|
||||
version: nightly-latest
|
||||
name: Resolve environment
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -56,16 +74,30 @@ jobs:
|
||||
run: echo "CODEQL_ENABLE_EXPERIMENTAL_FEATURES_SWIFT=true" >> $GITHUB_ENV
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
languages: ${{ matrix.version == 'stable-v2.13.4' && 'go' || 'go,javascript-typescript'
|
||||
}}
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
||||
- uses: ./../action/resolve-environment
|
||||
id: resolve-environment
|
||||
- name: Resolve environment for Go
|
||||
uses: ./../action/resolve-environment
|
||||
id: resolve-environment-go
|
||||
with:
|
||||
language: go
|
||||
|
||||
- name: Fail if no Go configuration was returned
|
||||
if: (!fromJSON(steps.resolve-environment.outputs.environment).configuration.go)
|
||||
- name: Fail if Go configuration missing
|
||||
if: (!fromJSON(steps.resolve-environment-go.outputs.environment).configuration.go)
|
||||
run: exit 1
|
||||
|
||||
- name: Resolve environment for JavaScript/TypeScript
|
||||
if: matrix.version != 'stable-v2.13.4'
|
||||
uses: ./../action/resolve-environment
|
||||
id: resolve-environment-js
|
||||
with:
|
||||
language: javascript-typescript
|
||||
|
||||
- name: Fail if JavaScript/TypeScript configuration present
|
||||
if: matrix.version != 'stable-v2.13.4' &&
|
||||
fromJSON(steps.resolve-environment-js.outputs.environment).configuration.javascript
|
||||
run: exit 1
|
||||
env:
|
||||
CODEQL_ACTION_TEST_MODE: true
|
||||
|
||||
42
.github/workflows/__upload-ref-sha-input.yml
generated
vendored
42
.github/workflows/__upload-ref-sha-input.yml
generated
vendored
@@ -25,54 +25,12 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
version: stable-20220908
|
||||
- os: macos-latest
|
||||
version: stable-20220908
|
||||
- os: windows-latest
|
||||
version: stable-20220908
|
||||
- os: ubuntu-latest
|
||||
version: stable-20221211
|
||||
- os: macos-latest
|
||||
version: stable-20221211
|
||||
- os: windows-latest
|
||||
version: stable-20221211
|
||||
- os: ubuntu-latest
|
||||
version: stable-20230418
|
||||
- os: macos-latest
|
||||
version: stable-20230418
|
||||
- os: windows-latest
|
||||
version: stable-20230418
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.13.5
|
||||
- os: macos-latest
|
||||
version: stable-v2.13.5
|
||||
- os: windows-latest
|
||||
version: stable-v2.13.5
|
||||
- os: ubuntu-latest
|
||||
version: stable-v2.14.6
|
||||
- os: macos-latest
|
||||
version: stable-v2.14.6
|
||||
- os: windows-latest
|
||||
version: stable-v2.14.6
|
||||
- os: ubuntu-latest
|
||||
version: default
|
||||
- os: macos-latest
|
||||
version: default
|
||||
- os: windows-latest
|
||||
version: default
|
||||
- os: ubuntu-latest
|
||||
version: latest
|
||||
- os: macos-latest
|
||||
version: latest
|
||||
- os: windows-latest
|
||||
version: latest
|
||||
- os: ubuntu-latest
|
||||
version: nightly-latest
|
||||
- os: macos-latest
|
||||
version: nightly-latest
|
||||
- os: windows-latest
|
||||
version: nightly-latest
|
||||
name: "Upload-sarif: 'ref' and 'sha' from inputs"
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
41
.github/workflows/python312-windows.yml
vendored
Normal file
41
.github/workflows/python312-windows.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Test that the workaround for python 3.12 on windows works
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, releases/v2]
|
||||
pull_request:
|
||||
# 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 Monday.
|
||||
- cron: '0 0 * * 1'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test-setup-python-scripts:
|
||||
timeout-minutes: 45
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.12
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Prepare test
|
||||
uses: ./.github/actions/prepare-test
|
||||
with:
|
||||
version: default
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: ./../action/init
|
||||
with:
|
||||
tools: latest
|
||||
languages: python
|
||||
|
||||
- name: Analyze
|
||||
uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
16
CHANGELOG.md
16
CHANGELOG.md
@@ -2,10 +2,24 @@
|
||||
|
||||
See the [releases page](https://github.com/github/codeql-action/releases) for the relevant changes to the CodeQL CLI and language packs.
|
||||
|
||||
## [UNRELEASED]
|
||||
## 2.22.3 - 13 Oct 2023
|
||||
|
||||
- Provide an authentication token when downloading the CodeQL Bundle from the API of a GitHub Enterprise Server instance. [#1945](https://github.com/github/codeql-action/pull/1945)
|
||||
|
||||
## 2.22.2 - 12 Oct 2023
|
||||
|
||||
- Update default CodeQL bundle version to 2.15.0. [#1938](https://github.com/github/codeql-action/pull/1938)
|
||||
- Improve the log output when an error occurs in an invocation of the CodeQL CLI. [#1927](https://github.com/github/codeql-action/pull/1927)
|
||||
|
||||
## 2.22.1 - 09 Oct 2023
|
||||
|
||||
- Add a workaround for Python 3.12, which is not supported in CodeQL CLI version 2.14.6 or earlier. If you are running an analysis on Windows and using Python 3.12 or later, the CodeQL Action will switch to running Python 3.11. In this case, if Python 3.11 is not found, then the workflow will fail. [#1928](https://github.com/github/codeql-action/pull/1928)
|
||||
|
||||
## 2.22.0 - 06 Oct 2023
|
||||
|
||||
- The CodeQL Action now requires CodeQL version 2.10.5 or later. For more information, see the corresponding changelog entry for CodeQL Action version 2.21.8. [#1907](https://github.com/github/codeql-action/pull/1907)
|
||||
- The CodeQL Action no longer runs ML-powered queries. For more information, including details on our investment in AI-powered security technology, see ["CodeQL code scanning deprecates ML-powered alerts."](https://github.blog/changelog/2023-09-29-codeql-code-scanning-deprecates-ml-powered-alerts/) [#1910](https://github.com/github/codeql-action/pull/1910)
|
||||
- Fix a bug which prevented tracing of projects using Go 1.21 and above on Linux. [#1909](https://github.com/github/codeql-action/pull/1909)
|
||||
|
||||
## 2.21.9 - 27 Sep 2023
|
||||
|
||||
|
||||
32
lib/actions-util.js
generated
32
lib/actions-util.js
generated
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getWorkflowRunAttempt = exports.getWorkflowRunID = exports.getUploadValue = exports.printDebugLogs = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.getWorkflowEventName = exports.getActionVersion = exports.getRef = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0;
|
||||
exports.getFileType = exports.getWorkflowRunAttempt = exports.getWorkflowRunID = exports.getUploadValue = exports.printDebugLogs = exports.isAnalyzingDefaultBranch = exports.getRelativeScriptPath = exports.isRunningLocalAction = exports.getWorkflowEventName = exports.getActionVersion = exports.getRef = exports.determineMergeBaseCommitOid = exports.getCommitOid = exports.getTemporaryDirectory = exports.getOptionalInput = exports.getRequiredInput = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
@@ -380,4 +380,34 @@ function getWorkflowRunAttempt() {
|
||||
return workflowRunAttempt;
|
||||
}
|
||||
exports.getWorkflowRunAttempt = getWorkflowRunAttempt;
|
||||
/**
|
||||
* Tries to obtain the output of the `file` command for the file at the specified path.
|
||||
* The output will vary depending on the type of `file`, which operating system we are running on, etc.
|
||||
*/
|
||||
const getFileType = async (filePath) => {
|
||||
let stderr = "";
|
||||
let stdout = "";
|
||||
try {
|
||||
// The `file` command will output information about the type of file pointed at by `filePath`.
|
||||
// For binary files, this may include e.g. whether they are static of dynamic binaries.
|
||||
// The `-L` switch instructs the command to follow symbolic links.
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("file"), ["-L", filePath], {
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
stdout += data.toString();
|
||||
},
|
||||
stderr: (data) => {
|
||||
stderr += data.toString();
|
||||
},
|
||||
},
|
||||
}).exec();
|
||||
return stdout.trim();
|
||||
}
|
||||
catch (e) {
|
||||
core.info(`Could not determine type of ${filePath} from ${stdout}. ${stderr}`);
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
exports.getFileType = getFileType;
|
||||
//# sourceMappingURL=actions-util.js.map
|
||||
File diff suppressed because one or more lines are too long
23
lib/analyze-action.js
generated
23
lib/analyze-action.js
generated
@@ -31,6 +31,7 @@ const fs = __importStar(require("fs"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const perf_hooks_1 = require("perf_hooks");
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const safe_which_1 = require("@chrisgavin/safe-which");
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const analyze_1 = require("./analyze");
|
||||
const api_client_1 = require("./api-client");
|
||||
@@ -38,6 +39,7 @@ const autobuild_1 = require("./autobuild");
|
||||
const codeql_1 = require("./codeql");
|
||||
const config_utils_1 = require("./config-utils");
|
||||
const database_upload_1 = require("./database-upload");
|
||||
const diagnostics_1 = require("./diagnostics");
|
||||
const environment_1 = require("./environment");
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const languages_1 = require("./languages");
|
||||
@@ -159,6 +161,27 @@ async function run() {
|
||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||
const features = new feature_flags_1.Features(gitHubVersion, repositoryNwo, actionsUtil.getTemporaryDirectory(), logger);
|
||||
const memory = util.getMemoryFlag(actionsUtil.getOptionalInput("ram") || process.env["CODEQL_RAM"], logger);
|
||||
// Check that `which go` still points at the wrapper script we installed in the `init` Action,
|
||||
// if the corresponding environment variable is set. This is to ensure that there isn't a step
|
||||
// in the workflow after the `init` step which installs a different version of Go and takes
|
||||
// precedence in the PATH, thus potentially circumventing our workaround that allows tracing to work.
|
||||
const goWrapperPath = process.env[environment_1.EnvVar.GO_BINARY_LOCATION];
|
||||
if (process.env[environment_1.EnvVar.DID_AUTOBUILD_GOLANG] !== "true" &&
|
||||
goWrapperPath !== undefined) {
|
||||
const goBinaryPath = await (0, safe_which_1.safeWhich)("go");
|
||||
if (goWrapperPath !== goBinaryPath) {
|
||||
core.warning(`Expected \`which go\` to return ${goWrapperPath}, but got ${goBinaryPath}: please ensure that the correct version of Go is installed before the \`codeql-action/init\` Action is used.`);
|
||||
(0, diagnostics_1.addDiagnostic)(config, languages_1.Language.go, (0, diagnostics_1.makeDiagnostic)("go/workflow/go-installed-after-codeql-init", "Go was installed after the `codeql-action/init` Action was run", {
|
||||
markdownMessage: "To avoid interfering with the CodeQL analysis, perform all installation steps before calling the `github/codeql-action/init` Action.",
|
||||
visibility: {
|
||||
statusPage: true,
|
||||
telemetry: true,
|
||||
cliSummaryTable: true,
|
||||
},
|
||||
severity: "warning",
|
||||
}));
|
||||
}
|
||||
}
|
||||
await runAutobuildIfLegacyGoWorkflow(config, logger);
|
||||
dbCreationTimings = await (0, analyze_1.runFinalize)(outputDir, threads, memory, config, logger, features);
|
||||
if (actionsUtil.getRequiredInput("skip-queries") !== "true") {
|
||||
|
||||
File diff suppressed because one or more lines are too long
6
lib/analyze.js
generated
6
lib/analyze.js
generated
@@ -237,12 +237,8 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
logger.info(String(e));
|
||||
if (e instanceof Error) {
|
||||
logger.info(e.stack);
|
||||
}
|
||||
statusReport.analyze_failure_language = language;
|
||||
throw new CodeQLAnalysisError(statusReport, `Error running analysis for ${language}: ${e}`);
|
||||
throw new CodeQLAnalysisError(statusReport, `Error running analysis for ${language}: ${util.wrapError(e).message}`);
|
||||
}
|
||||
}
|
||||
return statusReport;
|
||||
|
||||
File diff suppressed because one or more lines are too long
5
lib/autobuild-action.js
generated
5
lib/autobuild-action.js
generated
@@ -28,8 +28,6 @@ const actions_util_1 = require("./actions-util");
|
||||
const api_client_1 = require("./api-client");
|
||||
const autobuild_1 = require("./autobuild");
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const environment_1 = require("./environment");
|
||||
const languages_1 = require("./languages");
|
||||
const logging_1 = require("./logging");
|
||||
const status_report_1 = require("./status-report");
|
||||
const util_1 = require("./util");
|
||||
@@ -69,9 +67,6 @@ async function run() {
|
||||
for (const language of languages) {
|
||||
currentLanguage = language;
|
||||
await (0, autobuild_1.runAutobuild)(language, config, logger);
|
||||
if (language === languages_1.Language.go) {
|
||||
core.exportVariable(environment_1.EnvVar.DID_AUTOBUILD_GOLANG, "true");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AACxB,6CAAgD;AAChD,2CAAwE;AACxE,4DAA8C;AAC9C,+CAAuC;AACvC,2CAAuC;AACvC,uCAAqD;AACrD,mDAKyB;AACzB,iCAKgB;AAShB,KAAK,UAAU,yBAAyB,CACtC,MAAc,EACd,SAAe,EACf,YAAsB,EACtB,eAAwB,EACxB,KAAa;IAEb,IAAA,4BAAqB,EAAC,IAAA,+BAAgB,GAAE,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,IAAA,gCAAgB,EAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,EAC5B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,KAAK,CACb,CAAC;IACF,MAAM,YAAY,GAA0B;QAC1C,GAAG,gBAAgB;QACnB,mBAAmB,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC;QAC3C,iBAAiB,EAAE,eAAe;KACnC,CAAC;IACF,MAAM,IAAA,gCAAgB,EAAC,YAAY,CAAC,CAAC;AACvC,CAAC;AAED,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;I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,CAAC;iBAC1D;aACF;SACF;KACF;IAAC,OAAO,cAAc,EAAE;QACvB,MAAM,KAAK,GAAG,IAAA,gBAAS,EAAC,cAAc,CAAC,CAAC;QACxC,IAAI,CAAC,SAAS,CACZ,kIAAkI,KAAK,CAAC,OAAO,EAAE,CAClJ,CAAC;QACF,MAAM,yBAAyB,CAC7B,MAAM,EACN,SAAS,EACT,SAAS,IAAI,EAAE,EACf,eAAe,EACf,KAAK,CACN,CAAC;QACF,OAAO;KACR;IAED,MAAM,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;AACtE,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,4BAA4B,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KACxE;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
{"version":3,"file":"autobuild-action.js","sourceRoot":"","sources":["../src/autobuild-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AACxB,6CAAgD;AAChD,2CAAwE;AACxE,4DAA8C;AAE9C,uCAAqD;AACrD,mDAKyB;AACzB,iCAKgB;AAShB,KAAK,UAAU,yBAAyB,CACtC,MAAc,EACd,SAAe,EACf,YAAsB,EACtB,eAAwB,EACxB,KAAa;IAEb,IAAA,4BAAqB,EAAC,IAAA,+BAAgB,GAAE,CAAC,CAAC;IAE1C,MAAM,MAAM,GAAG,IAAA,gCAAgB,EAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACxD,MAAM,gBAAgB,GAAG,MAAM,IAAA,sCAAsB,EACnD,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,IAAA,qBAAc,EAAC,MAAM,CAAC,EAC5B,KAAK,EAAE,OAAO,EACd,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,gBAAgB,CAAC,CAAC;aACjC;YACD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;gBAChC,eAAe,GAAG,QAAQ,CAAC;gBAC3B,MAAM,IAAA,wBAAY,EAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;aAC9C;SACF;KACF;IAAC,OAAO,cAAc,EAAE;QACvB,MAAM,KAAK,GAAG,IAAA,gBAAS,EAAC,cAAc,CAAC,CAAC;QACxC,IAAI,CAAC,SAAS,CACZ,kIAAkI,KAAK,CAAC,OAAO,EAAE,CAClJ,CAAC;QACF,MAAM,yBAAyB,CAC7B,MAAM,EACN,SAAS,EACT,SAAS,IAAI,EAAE,EACf,eAAe,EACf,KAAK,CACN,CAAC;QACF,OAAO;KACR;IAED,MAAM,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;AACtE,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,4BAA4B,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KACxE;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
4
lib/autobuild.js
generated
4
lib/autobuild.js
generated
@@ -28,6 +28,7 @@ const core = __importStar(require("@actions/core"));
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const api_client_1 = require("./api-client");
|
||||
const codeql_1 = require("./codeql");
|
||||
const environment_1 = require("./environment");
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const languages_1 = require("./languages");
|
||||
const repository_1 = require("./repository");
|
||||
@@ -132,6 +133,9 @@ async function runAutobuild(language, config, logger) {
|
||||
await setupCppAutobuild(codeQL, logger);
|
||||
}
|
||||
await codeQL.runAutobuild(language);
|
||||
if (language === languages_1.Language.go) {
|
||||
core.exportVariable(environment_1.EnvVar.DID_AUTOBUILD_GOLANG, "true");
|
||||
}
|
||||
logger.endGroup();
|
||||
}
|
||||
exports.runAutobuild = runAutobuild;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAA6E;AAC7E,6CAAgD;AAChD,qCAA6C;AAE7C,mDAAmE;AACnE,2CAAyD;AAEzD,6CAAkD;AAClD,iCAA6C;AAEtC,KAAK,UAAU,2BAA2B,CAC/C,MAA0B,EAC1B,MAAc;IAEd,0CAA0C;IAC1C,mFAAmF;IACnF,oFAAoF;IACpF,4EAA4E;IAC5E,MAAM,kBAAkB,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CACvD,IAAA,4BAAgB,EAAC,CAAC,CAAC,CACpB,CAAC;IAEF,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,CAAC,IAAI,CACT,iEAAiE,CAClE,CAAC;QACF,OAAO,SAAS,CAAC;KAClB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,2BAA2B,GAAG,kBAAkB,CAAC,MAAM,CAC3D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,oBAAQ,CAAC,EAAE,CACzB,CAAC;IAEF,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,yEAAyE;IACzE,UAAU;IACV,IAAI,2BAA2B,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;QAChD,SAAS,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC;KAChD;IACD,uEAAuE;IACvE,wCAAwC;IACxC,IAAI,kBAAkB,CAAC,MAAM,KAAK,2BAA2B,CAAC,MAAM,EAAE;QACpE,SAAS,CAAC,IAAI,CAAC,oBAAQ,CAAC,EAAE,CAAC,CAAC;KAC7B;IAED,MAAM,CAA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CAAC,aAAa,WAAW,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACtC;AACH,CAAC;AAEM,KAAK,UAAU,YAAY,CAChC,QAAkB,EAClB,MAA0B,EAC1B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,qCAAqC,QAAQ,OAAO,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,IAAI,QAAQ,KAAK,oBAAQ,CAAC,GAAG,EAAE;QAC7B,MAAM,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACzC;IACD,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,IAAI,QAAQ,KAAK,oBAAQ,CAAC,EAAE,EAAE;QAC5B,IAAI,CAAC,cAAc,CAAC,oBAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;KAC1D;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAfD,oCAeC"}
|
||||
42
lib/codeql.js
generated
42
lib/codeql.js
generated
@@ -37,15 +37,25 @@ const setupCodeql = __importStar(require("./setup-codeql"));
|
||||
const util = __importStar(require("./util"));
|
||||
const util_1 = require("./util");
|
||||
class CommandInvocationError extends Error {
|
||||
constructor(cmd, args, exitCode, error, output) {
|
||||
constructor(cmd, args, exitCode, stderr, stdout) {
|
||||
const prettyCommand = [cmd, ...args]
|
||||
.map((x) => (x.includes(" ") ? `'${x}'` : x))
|
||||
.join(" ");
|
||||
const fatalErrors = extractFatalErrors(stderr);
|
||||
const lastLine = stderr.trim().split("\n").pop()?.trim();
|
||||
let error = fatalErrors
|
||||
? ` and error was: ${fatalErrors.trim()}`
|
||||
: lastLine
|
||||
? ` and last log line was: ${lastLine}`
|
||||
: "";
|
||||
if (error[error.length - 1] !== ".") {
|
||||
error += ".";
|
||||
}
|
||||
super(`Encountered a fatal error while running "${prettyCommand}". ` +
|
||||
`Exit code was ${exitCode} and error was: ${error.trim()}`);
|
||||
`Exit code was ${exitCode}${error} See the logs for more details.`);
|
||||
this.exitCode = exitCode;
|
||||
this.error = error;
|
||||
this.output = output;
|
||||
this.stderr = stderr;
|
||||
this.stdout = stdout;
|
||||
}
|
||||
}
|
||||
exports.CommandInvocationError = CommandInvocationError;
|
||||
@@ -298,6 +308,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
"--db-cluster",
|
||||
config.dbLocation,
|
||||
`--source-root=${sourceRoot}`,
|
||||
...(await getLanguageAliasingArguments(this)),
|
||||
...extraArgs,
|
||||
...getExtraOptionsFromEnv(["database", "init"]),
|
||||
], { stdin: externalRepositoryToken });
|
||||
@@ -385,16 +396,12 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
}
|
||||
},
|
||||
async betterResolveLanguages() {
|
||||
const extraArgs = [];
|
||||
if (await util.codeQlVersionAbove(this, exports.CODEQL_VERSION_LANGUAGE_ALIASING)) {
|
||||
extraArgs.push("--extractor-include-aliases");
|
||||
}
|
||||
const codeqlArgs = [
|
||||
"resolve",
|
||||
"languages",
|
||||
"--format=betterjson",
|
||||
"--extractor-options-verbosity=4",
|
||||
...extraArgs,
|
||||
...(await getLanguageAliasingArguments(this)),
|
||||
...getExtraOptionsFromEnv(["resolve", "languages"]),
|
||||
];
|
||||
const output = await runTool(cmd, codeqlArgs);
|
||||
@@ -429,6 +436,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
"resolve",
|
||||
"build-environment",
|
||||
`--language=${language}`,
|
||||
...(await getLanguageAliasingArguments(this)),
|
||||
...getExtraOptionsFromEnv(["resolve", "build-environment"]),
|
||||
];
|
||||
if (workingDir !== undefined) {
|
||||
@@ -498,6 +506,12 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_FILE_BASELINE_INFORMATION)) {
|
||||
codeqlArgs.push("--sarif-add-baseline-file-info");
|
||||
}
|
||||
if (await features.getValue(feature_flags_1.Feature.SublanguageFileCoverageEnabled, this)) {
|
||||
codeqlArgs.push("--sublanguage-file-coverage");
|
||||
}
|
||||
else if (await util.codeQlVersionAbove(this, feature_flags_1.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE)) {
|
||||
codeqlArgs.push("--no-sublanguage-file-coverage");
|
||||
}
|
||||
if (shouldExportDiagnostics) {
|
||||
codeqlArgs.push("--sarif-include-diagnostics");
|
||||
}
|
||||
@@ -646,6 +660,7 @@ async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
"extractor",
|
||||
"--format=json",
|
||||
`--language=${language}`,
|
||||
...(await getLanguageAliasingArguments(this)),
|
||||
...getExtraOptionsFromEnv(["resolve", "extractor"]),
|
||||
], {
|
||||
silent: true,
|
||||
@@ -776,7 +791,6 @@ async function runTool(cmd, args = [], opts = {}) {
|
||||
...(opts.stdin ? { input: Buffer.from(opts.stdin || "") } : {}),
|
||||
}).exec();
|
||||
if (exitCode !== 0) {
|
||||
error = extractFatalErrors(error) || error;
|
||||
throw new CommandInvocationError(cmd, args, exitCode, error, output);
|
||||
}
|
||||
return output;
|
||||
@@ -957,9 +971,15 @@ function isNoCodeFoundError(e) {
|
||||
* This can be removed once support for CodeQL 2.11.6 is removed.
|
||||
*/
|
||||
const javascriptNoCodeFoundWarning = "No JavaScript or TypeScript code found.";
|
||||
return e.exitCode === 32 || e.error.includes(javascriptNoCodeFoundWarning);
|
||||
return e.exitCode === 32 || e.stderr.includes(javascriptNoCodeFoundWarning);
|
||||
}
|
||||
async function isDiagnosticsExportInvalidSarifFixed(codeql) {
|
||||
return await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_DIAGNOSTICS_EXPORT_FIXED);
|
||||
}
|
||||
async function getLanguageAliasingArguments(codeql) {
|
||||
if (await util.codeQlVersionAbove(codeql, exports.CODEQL_VERSION_LANGUAGE_ALIASING)) {
|
||||
return ["--extractor-include-aliases"];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
//# sourceMappingURL=codeql.js.map
|
||||
File diff suppressed because one or more lines are too long
22
lib/codeql.test.js
generated
22
lib/codeql.test.js
generated
@@ -625,19 +625,19 @@ const injectedConfigMacro = ava_1.default.macro({
|
||||
const NEW_ANALYSIS_SUMMARY_TEST_CASES = [
|
||||
{
|
||||
featureEnabled: true,
|
||||
codeqlVersion: "2.14.0",
|
||||
codeqlVersion: "2.15.0",
|
||||
flagPassed: true,
|
||||
negativeFlagPassed: false,
|
||||
},
|
||||
{
|
||||
featureEnabled: false,
|
||||
codeqlVersion: "2.14.0",
|
||||
codeqlVersion: "2.15.0",
|
||||
flagPassed: false,
|
||||
negativeFlagPassed: true,
|
||||
},
|
||||
{
|
||||
featureEnabled: false,
|
||||
codeqlVersion: "2.13.5",
|
||||
codeqlVersion: "2.14.6",
|
||||
flagPassed: false,
|
||||
negativeFlagPassed: false,
|
||||
},
|
||||
@@ -695,7 +695,7 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
|
||||
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
||||
`Exit code was 32 and error was: ${cliMessage}`,
|
||||
`Exit code was 32 and last log line was: ${cliMessage} See the logs for more details.`,
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("runTool summarizes several fatal errors", async (t) => {
|
||||
@@ -710,7 +710,19 @@ for (const { featureEnabled, codeqlVersion, flagPassed, negativeFlagPassed, } of
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
|
||||
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
||||
`Exit code was 32 and error was: ${datasetImportError}. Context: ${heapError}.`,
|
||||
`Exit code was 32 and error was: ${datasetImportError}. Context: ${heapError}. See the logs for more details.`,
|
||||
});
|
||||
});
|
||||
(0, ava_1.default)("runTool outputs last line of stderr if fatal error could not be found", async (t) => {
|
||||
const cliStderr = "line1\nline2\nline3\nline4\nline5";
|
||||
stubToolRunnerConstructor(32, cliStderr);
|
||||
const codeqlObject = await codeql.getCodeQLForTesting();
|
||||
sinon.stub(codeqlObject, "getVersion").resolves((0, testing_utils_1.makeVersionInfo)("2.12.4"));
|
||||
// safeWhich throws because of the test CodeQL object.
|
||||
sinon.stub(safeWhich, "safeWhich").resolves("");
|
||||
await t.throwsAsync(async () => await codeqlObject.finalizeDatabase("db", "--threads=2", "--ram=2048"), {
|
||||
message: 'Encountered a fatal error while running "codeql-for-testing database finalize --finalize-dataset --threads=2 --ram=2048 db". ' +
|
||||
"Exit code was 32 and last log line was: line5. See the logs for more details.",
|
||||
});
|
||||
});
|
||||
function stubToolRunnerConstructor(exitCode = 0, stderr) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
lib/database-upload.js
generated
4
lib/database-upload.js
generated
@@ -56,12 +56,14 @@ async function uploadDatabases(repositoryNwo, config, apiDetails, logger) {
|
||||
const bundledDb = await (0, util_1.bundleDb)(config, language, codeql, language);
|
||||
const bundledDbSize = fs.statSync(bundledDb).size;
|
||||
const bundledDbReadStream = fs.createReadStream(bundledDb);
|
||||
const commitOid = await actionsUtil.getCommitOid(actionsUtil.getRequiredInput("checkout_path"));
|
||||
try {
|
||||
await client.request(`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name`, {
|
||||
await client.request(`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name&commit_oid=:commit_oid`, {
|
||||
owner: repositoryNwo.owner,
|
||||
repo: repositoryNwo.repo,
|
||||
language,
|
||||
name: `${language}-database`,
|
||||
commit_oid: commitOid,
|
||||
data: bundledDbReadStream,
|
||||
headers: {
|
||||
authorization: `token ${apiDetails.auth}`,
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"database-upload.js","sourceRoot":"","sources":["../src/database-upload.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AAEzB,4DAA8C;AAC9C,6CAA8D;AAC9D,qCAAqC;AAIrC,6CAA+B;AAC/B,iCAAkC;AAE3B,KAAK,UAAU,eAAe,CACnC,aAA4B,EAC5B,MAAc,EACd,UAA4B,EAC5B,MAAc;IAEd,IAAI,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,MAAM,EAAE;QAC9D,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;QACvE,OAAO;KACR;IAED,iDAAiD;IACjD,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;QAC3D,MAAM,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACjE,OAAO;KACR;IAED,IAAI,CAAC,CAAC,MAAM,WAAW,CAAC,wBAAwB,EAAE,CAAC,EAAE;QACnD,4EAA4E;QAC5E,MAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAC/D,OAAO;KACR;IAED,MAAM,MAAM,GAAG,IAAA,yBAAY,GAAE,CAAC;IAC9B,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAEjD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE;QACvC,IAAI;YACF,8BAA8B;YAC9B,2EAA2E;YAC3E,8EAA8E;YAC9E,wEAAwE;YACxE,MAAM,SAAS,GAAG,MAAM,IAAA,eAAQ,EAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;YACrE,MAAM,aAAa,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,IA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ACjC,gBAAgB,EAAE,aAAa;qBAChC;iBACF,CACF,CAAC;gBACF,MAAM,CAAC,KAAK,CAAC,sCAAsC,QAAQ,EAAE,CAAC,CAAC;aAChE;oBAAS;gBACR,mBAAmB,CAAC,KAAK,EAAE,CAAC;aAC7B;SACF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACf,4CAA4C;YAC5C,MAAM,CAAC,OAAO,CAAC,iCAAiC,QAAQ,KAAK,CAAC,EAAE,CAAC,CAAC;SACnE;KACF;AACH,CAAC;AAjED,0CAiEC"}
|
||||
2
lib/database-upload.test.js
generated
2
lib/database-upload.test.js
generated
@@ -72,7 +72,7 @@ async function mockHttpRequests(databaseUploadStatusCode) {
|
||||
// Passing an auth token is required, so we just use a dummy value
|
||||
const client = github.getOctokit("123");
|
||||
const requestSpy = sinon.stub(client, "request");
|
||||
const url = "POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name";
|
||||
const url = "POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name&commit_oid=:commit_oid";
|
||||
const databaseUploadSpy = requestSpy.withArgs(url);
|
||||
if (databaseUploadStatusCode < 300) {
|
||||
databaseUploadSpy.resolves(undefined);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"bundleVersion": "codeql-bundle-v2.14.6",
|
||||
"cliVersion": "2.14.6",
|
||||
"priorBundleVersion": "codeql-bundle-v2.14.5",
|
||||
"priorCliVersion": "2.14.5"
|
||||
"bundleVersion": "codeql-bundle-v2.15.0",
|
||||
"cliVersion": "2.15.0",
|
||||
"priorBundleVersion": "codeql-bundle-v2.14.6",
|
||||
"priorCliVersion": "2.14.6"
|
||||
}
|
||||
|
||||
47
lib/diagnostics.js
generated
Normal file
47
lib/diagnostics.js
generated
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.addDiagnostic = exports.makeDiagnostic = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const logging_1 = require("./logging");
|
||||
const util_1 = require("./util");
|
||||
/**
|
||||
* Constructs a new diagnostic message with the specified id and name, as well as optional additional data.
|
||||
*
|
||||
* @param id An identifier under which it makes sense to group this diagnostic message.
|
||||
* @param name Display name for the ID.
|
||||
* @param data Optional additional data to initialize the diagnostic with.
|
||||
* @returns Returns the new diagnostic message.
|
||||
*/
|
||||
function makeDiagnostic(id, name, data = undefined) {
|
||||
return {
|
||||
...data,
|
||||
timestamp: data?.timestamp ?? new Date().toISOString(),
|
||||
source: { ...data?.source, id, name },
|
||||
};
|
||||
}
|
||||
exports.makeDiagnostic = makeDiagnostic;
|
||||
/**
|
||||
* Writes the given diagnostic to the database.
|
||||
*
|
||||
* @param config The configuration that tells us where to store the diagnostic.
|
||||
* @param diagnostic The diagnostic message to add to the database.
|
||||
*/
|
||||
function addDiagnostic(config, language, diagnostic) {
|
||||
const logger = (0, logging_1.getActionsLogger)();
|
||||
const diagnosticsPath = path_1.default.resolve((0, util_1.getCodeQLDatabasePath)(config, language), "diagnostic", "codeql-action");
|
||||
try {
|
||||
// Create the directory if it doesn't exist yet.
|
||||
(0, fs_1.mkdirSync)(diagnosticsPath, { recursive: true });
|
||||
const jsonPath = path_1.default.resolve(diagnosticsPath, `codeql-action-${diagnostic.timestamp}.json`);
|
||||
(0, fs_1.writeFileSync)(jsonPath, JSON.stringify(diagnostic));
|
||||
}
|
||||
catch (err) {
|
||||
logger.warning(`Unable to write diagnostic message to database: ${err}`);
|
||||
}
|
||||
}
|
||||
exports.addDiagnostic = addDiagnostic;
|
||||
//# sourceMappingURL=diagnostics.js.map
|
||||
1
lib/diagnostics.js.map
Normal file
1
lib/diagnostics.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA8C;AAC9C,gDAAwB;AAIxB,uCAA6C;AAC7C,iCAA+C;AAmD/C;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,EAAU,EACV,IAAY,EACZ,OAA+C,SAAS;IAExD,OAAO;QACL,GAAG,IAAI;QACP,SAAS,EAAE,IAAI,EAAE,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACtD,MAAM,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE;KACtC,CAAC;AACJ,CAAC;AAVD,wCAUC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAC3B,MAAc,EACd,QAAkB,EAClB,UAA6B;IAE7B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAClC,MAAM,eAAe,GAAG,cAAI,CAAC,OAAO,CAClC,IAAA,4BAAqB,EAAC,MAAM,EAAE,QAAQ,CAAC,EACvC,YAAY,EACZ,eAAe,CAChB,CAAC;IAEF,IAAI;QACF,gDAAgD;QAChD,IAAA,cAAS,EAAC,eAAe,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEhD,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAC3B,eAAe,EACf,iBAAiB,UAAU,CAAC,SAAS,OAAO,CAC7C,CAAC;QAEF,IAAA,kBAAa,EAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;KACrD;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,CAAC,OAAO,CAAC,mDAAmD,GAAG,EAAE,CAAC,CAAC;KAC1E;AACH,CAAC;AAzBD,sCAyBC"}
|
||||
6
lib/environment.js
generated
6
lib/environment.js
generated
@@ -51,5 +51,11 @@ var EnvVar;
|
||||
* rather that the init action.
|
||||
*/
|
||||
EnvVar["WORKFLOW_STARTED_AT"] = "CODEQL_WORKFLOW_STARTED_AT";
|
||||
/**
|
||||
* The path where we initially discovered the Go binary in the system path
|
||||
* before replacing it with a wrapper script. We check this later to ensure
|
||||
* that it hasn't been tampered with by a late e.g. `setup-go` step.
|
||||
*/
|
||||
EnvVar["GO_BINARY_LOCATION"] = "CODEQL_ACTION_GO_BINARY";
|
||||
})(EnvVar || (exports.EnvVar = EnvVar = {}));
|
||||
//# sourceMappingURL=environment.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAgEX;AAhED,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;AACpD,CAAC,EAhEW,MAAM,sBAAN,MAAM,QAgEjB"}
|
||||
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";;;AAAA,IAAY,MAuEX;AAvED,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;;;;OAIG;IACH,wDAA8C,CAAA;AAChD,CAAC,EAvEW,MAAM,sBAAN,MAAM,QAuEjB"}
|
||||
10
lib/feature-flags.js
generated
10
lib/feature-flags.js
generated
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = void 0;
|
||||
exports.logCodeScanningConfigInCli = exports.useCodeScanningConfigInCli = exports.Features = exports.FEATURE_FLAGS_FILE_NAME = exports.featureConfig = exports.Feature = exports.CODEQL_VERSION_SUBLANGUAGE_FILE_COVERAGE = exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const semver = __importStar(require("semver"));
|
||||
@@ -36,15 +36,15 @@ const DEFAULT_VERSION_FEATURE_FLAG_SUFFIX = "_enabled";
|
||||
* Versions 2.13.4+ of the CodeQL CLI have an associated CodeQL Bundle release that is semantically versioned.
|
||||
*/
|
||||
exports.CODEQL_VERSION_BUNDLE_SEMANTICALLY_VERSIONED = "2.13.4";
|
||||
/**
|
||||
* Versions 2.14.0+ of the CodeQL CLI support new analysis summaries.
|
||||
*/
|
||||
exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.14.0";
|
||||
/**
|
||||
* Versions 2.14.0+ of the CodeQL CLI support intra-layer parallelism (aka fine-grained parallelism) options, but we
|
||||
* limit to 2.14.6 onwards, since that's the version that has mitigations against OOM failures.
|
||||
*/
|
||||
exports.CODEQL_VERSION_INTRA_LAYER_PARALLELISM = "2.14.6";
|
||||
/**
|
||||
* Versions 2.15.0+ of the CodeQL CLI support new analysis summaries.
|
||||
*/
|
||||
exports.CODEQL_VERSION_ANALYSIS_SUMMARY_V2 = "2.15.0";
|
||||
/**
|
||||
* Versions 2.15.0+ of the CodeQL CLI support sub-language file coverage information.
|
||||
*/
|
||||
|
||||
File diff suppressed because one or more lines are too long
35
lib/init-action.js
generated
35
lib/init-action.js
generated
@@ -23,8 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const safe_which_1 = require("@chrisgavin/safe-which");
|
||||
const uuid_1 = require("uuid");
|
||||
const actions_util_1 = require("./actions-util");
|
||||
const api_client_1 = require("./api-client");
|
||||
@@ -36,6 +38,7 @@ const logging_1 = require("./logging");
|
||||
const repository_1 = require("./repository");
|
||||
const setup_codeql_1 = require("./setup-codeql");
|
||||
const status_report_1 = require("./status-report");
|
||||
const tools_features_1 = require("./tools-features");
|
||||
const trap_caching_1 = require("./trap-caching");
|
||||
const util_1 = require("./util");
|
||||
const workflow_1 = require("./workflow");
|
||||
@@ -136,6 +139,7 @@ async function run() {
|
||||
// - 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, features, 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") {
|
||||
if (await features.getValue(feature_flags_1.Feature.DisablePythonDependencyInstallationEnabled, codeql)) {
|
||||
@@ -159,12 +163,43 @@ 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) {
|
||||
core.exportVariable("GOFLAGS", goFlags);
|
||||
core.warning("Passing the GOFLAGS env parameter to the init action is deprecated. Please move this to the analyze action.");
|
||||
}
|
||||
// Go 1.21 and above ships with statically linked binaries on Linux. CodeQL cannot currently trace custom builds
|
||||
// where the entry point is a statically linked binary. Until that is fixed, we work around the problem by
|
||||
// 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 (config.languages.includes(languages_1.Language.go) &&
|
||||
process.platform === "linux" &&
|
||||
!(0, tools_features_1.isSupportedToolsFeature)(versionInfo, tools_features_1.ToolsFeature.IndirectTracingSupportsStaticBinaries)) {
|
||||
try {
|
||||
const goBinaryPath = await (0, safe_which_1.safeWhich)("go");
|
||||
const fileOutput = await (0, actions_util_1.getFileType)(goBinaryPath);
|
||||
if (fileOutput.includes("statically linked")) {
|
||||
logger.debug(`Applying static binary workaround for Go`);
|
||||
// Create a directory that we can add to the system PATH.
|
||||
const tempBinPath = path.resolve((0, actions_util_1.getTemporaryDirectory)(), "codeql-action-go-tracing", "bin");
|
||||
fs.mkdirSync(tempBinPath, { recursive: true });
|
||||
core.addPath(tempBinPath);
|
||||
// Write the wrapper script to the directory we just added to the PATH.
|
||||
const goWrapperPath = path.resolve(tempBinPath, "go");
|
||||
fs.writeFileSync(goWrapperPath, `#!/bin/bash\n\nexec ${goBinaryPath} "$@"`);
|
||||
fs.chmodSync(goWrapperPath, "755");
|
||||
// Store the original location of our wrapper script somewhere where we can
|
||||
// later retrieve it from and cross-check that it hasn't been changed.
|
||||
core.exportVariable(environment_1.EnvVar.GO_BINARY_LOCATION, goWrapperPath);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
logger.warning(`Analyzing Go on Linux, but failed to install wrapper script. Tracing custom builds may fail: ${e}`);
|
||||
}
|
||||
}
|
||||
// Limit RAM and threads for extractors. When running extractors, the CodeQL CLI obeys the
|
||||
// CODEQL_RAM and CODEQL_THREADS environment variables to decide how much RAM and how many
|
||||
// threads it would ask extractors to use. See help text for the "--ram" and "--threads"
|
||||
|
||||
File diff suppressed because one or more lines are too long
18
lib/init.js
generated
18
lib/init.js
generated
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.installPythonDeps = exports.runInit = exports.initConfig = exports.initCodeQL = void 0;
|
||||
exports.installPythonDeps = exports.checkInstallPython311 = exports.runInit = exports.initConfig = exports.initCodeQL = void 0;
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const toolrunner = __importStar(require("@actions/exec/lib/toolrunner"));
|
||||
@@ -32,6 +32,7 @@ const analysisPaths = __importStar(require("./analysis-paths"));
|
||||
const codeql_1 = require("./codeql");
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const feature_flags_1 = require("./feature-flags");
|
||||
const languages_1 = require("./languages");
|
||||
const tracer_config_1 = require("./tracer-config");
|
||||
const util = __importStar(require("./util"));
|
||||
async function initCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, logger) {
|
||||
@@ -104,6 +105,21 @@ function processError(e) {
|
||||
}
|
||||
return e;
|
||||
}
|
||||
/**
|
||||
* If we are running python 3.12+ on windows, we need to switch to python 3.11.
|
||||
* This check happens in a powershell script.
|
||||
*/
|
||||
async function checkInstallPython311(languages, codeql) {
|
||||
if (languages.includes(languages_1.Language.python) &&
|
||||
process.platform === "win32" &&
|
||||
!(await codeql.getVersion()).features?.supportsPython312) {
|
||||
const script = path.resolve(__dirname, "../python-setup", "check_python12.ps1");
|
||||
await new toolrunner.ToolRunner(await safeWhich.safeWhich("powershell"), [
|
||||
script,
|
||||
]).exec();
|
||||
}
|
||||
}
|
||||
exports.checkInstallPython311 = checkInstallPython311;
|
||||
async function installPythonDeps(codeql, logger) {
|
||||
logger.startGroup("Setup Python dependencies");
|
||||
const scriptsFolder = path.resolve(__dirname, "../python-setup");
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,yEAA2D;AAC3D,kEAAoD;AAEpD,gEAAkD;AAElD,qCAA+C;AAC/C,4DAA8C;AAC9C,mDAIyB;AAIzB,mDAAwE;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SACV;QACD,MAAM,MAAM,GAAG,0BAA0B,CAAC;QAC1C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;YAChC,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;gBAC/D,IAAI;gBACJ,IAAI;gBACJ,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;gBAChC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;aAC/B,CAAC,CAAC,IAAI,EAAE,CAAC;SACX;aAAM;YACL,MAAM,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE;gBACpE,IAAI;gBACJ,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;gBAChC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;aAC/B,CAAC,CAAC,IAAI,EAAE,CAAC;SACX;KACF;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,OAAO,CACZ,gFAAgF,CAAC,IAAI;YACnF,qGAAqG;YACrG,oGAAoG;YACpG,iDAAiD,CACpD,CAAC;QACF,OAAO;KACR;IACD,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAzCD,8CAyCC"}
|
||||
7
lib/resolve-environment-action.js
generated
7
lib/resolve-environment-action.js
generated
@@ -28,7 +28,6 @@ const actions_util_1 = require("./actions-util");
|
||||
const api_client_1 = require("./api-client");
|
||||
const codeql_1 = require("./codeql");
|
||||
const configUtils = __importStar(require("./config-utils"));
|
||||
const languages_1 = require("./languages");
|
||||
const logging_1 = require("./logging");
|
||||
const resolve_environment_1 = require("./resolve-environment");
|
||||
const status_report_1 = require("./status-report");
|
||||
@@ -42,10 +41,6 @@ async function run() {
|
||||
if (!(await (0, status_report_1.sendStatusReport)(await (0, status_report_1.createStatusReportBase)(ACTION_NAME, "starting", startedAt, await (0, util_1.checkDiskUsage)(logger))))) {
|
||||
return;
|
||||
}
|
||||
const language = (0, languages_1.parseLanguage)((0, actions_util_1.getRequiredInput)("language"));
|
||||
if (language === undefined) {
|
||||
throw new Error(`Did not recognize the language "${(0, actions_util_1.getRequiredInput)("language")}".`);
|
||||
}
|
||||
const gitHubVersion = await (0, api_client_1.getGitHubVersion)();
|
||||
(0, util_1.checkGitHubVersionInRange)(gitHubVersion, logger);
|
||||
const config = await configUtils.getConfig((0, actions_util_1.getTemporaryDirectory)(), logger);
|
||||
@@ -53,7 +48,7 @@ async function run() {
|
||||
throw new Error("Config file could not be found at expected location. Has the 'init' action been called?");
|
||||
}
|
||||
const workingDirectory = (0, actions_util_1.getOptionalInput)("working-directory");
|
||||
const result = await (0, resolve_environment_1.runResolveBuildEnvironment)(config.codeQLCmd, logger, workingDirectory, language);
|
||||
const result = await (0, resolve_environment_1.runResolveBuildEnvironment)(config.codeQLCmd, logger, workingDirectory, (0, actions_util_1.getRequiredInput)("language"));
|
||||
core.setOutput(ENVIRONMENT_OUTPUT_NAME, result);
|
||||
}
|
||||
catch (unwrappedError) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"resolve-environment-action.js","sourceRoot":"","sources":["../src/resolve-environment-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AACxB,6CAAgD;AAChD,qCAAkD;AAClD,4DAA8C;AAC9C,2CAAsD;AACtD,uCAA6C;AAC7C,+DAAmE;AACnE,mDAIyB;AACzB,iCAKgB;AAEhB,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAC1C,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IA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KAAK,CAAC,OAAO,EAAE,CACxG,CAAC;SACH;aAAM;YACL,kFAAkF;YAClF,IAAI,CAAC,SAAS,CACZ,wFAAwF,KAAK,CAAC,OAAO,EAAE,CACxG,CAAC;YAEF,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;SACH;QAED,OAAO;KACR;IAED,MAAM,IAAA,gCAAgB,EACpB,MAAM,IAAA,sCAAsB,EAC1B,WAAW,EACX,SAAS,EACT,SAAS,EACT,MAAM,IAAA,qBAAc,GAAE,CACvB,CACF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,GAAG,WAAW,mBAAmB,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KAC7E;IACD,MAAM,IAAA,sBAAe,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
{"version":3,"file":"resolve-environment-action.js","sourceRoot":"","sources":["../src/resolve-environment-action.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAEtC,iDAIwB;AACxB,6CAAgD;AAChD,qCAAkD;AAClD,4DAA8C;AAC9C,uCAA6C;AAC7C,+DAAmE;AACnE,mDAIyB;AACzB,iCAKgB;AAEhB,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAC1C,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAE9C,KAAK,UAAU,GAAG;IAChB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,IAAA,0BAA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AA,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;SACH;QAED,OAAO;KACR;IAED,MAAM,IAAA,gCAAgB,EACpB,MAAM,IAAA,sCAAsB,EAC1B,WAAW,EACX,SAAS,EACT,SAAS,EACT,MAAM,IAAA,qBAAc,GAAE,CACvB,CACF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,UAAU;IACvB,IAAI;QACF,MAAM,GAAG,EAAE,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,SAAS,CAAC,GAAG,WAAW,mBAAmB,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;KAC7E;IACD,MAAM,IAAA,sBAAe,GAAE,CAAC;AAC1B,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
|
||||
15
lib/resolve-environment.js
generated
15
lib/resolve-environment.js
generated
@@ -25,10 +25,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.runResolveBuildEnvironment = void 0;
|
||||
const codeql_1 = require("./codeql");
|
||||
const languages_1 = require("./languages");
|
||||
const util = __importStar(require("./util"));
|
||||
async function runResolveBuildEnvironment(cmd, logger, workingDir, language) {
|
||||
logger.startGroup(`Attempting to resolve build environment for ${language}`);
|
||||
async function runResolveBuildEnvironment(cmd, logger, workingDir, languageInput) {
|
||||
logger.startGroup(`Attempting to resolve build environment for ${languageInput}`);
|
||||
const codeql = await (0, codeql_1.getCodeQL)(cmd);
|
||||
let language = languageInput;
|
||||
// If the CodeQL CLI version in use supports language aliasing, give the CLI the raw language
|
||||
// input. Otherwise, parse the language input and give the CLI the parsed language.
|
||||
if (!(await util.codeQlVersionAbove(codeql, codeql_1.CODEQL_VERSION_LANGUAGE_ALIASING))) {
|
||||
const parsedLanguage = (0, languages_1.parseLanguage)(languageInput)?.toString();
|
||||
if (parsedLanguage === undefined) {
|
||||
throw new Error(`Did not recognize the language '${languageInput}'.`);
|
||||
}
|
||||
language = parsedLanguage;
|
||||
}
|
||||
let result = {};
|
||||
// If the CodeQL version in use does not support the `resolve build-environment`
|
||||
// command, just return an empty configuration. Otherwise invoke the CLI.
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"resolve-environment.js","sourceRoot":"","sources":["../src/resolve-environment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyE;AAGzE,6CAA+B;AAExB,KAAK,UAAU,0BAA0B,CAC9C,GAAW,EACX,MAAc,EACd,UAA8B,EAC9B,QAAkB;IAElB,MAAM,CAAC,UAAU,CAAC,+CAA+C,QAAQ,EAAE,CAAC,CAAC;IAE7E,MAAM,MAAM,GAAG,MAAM,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC;IACpC,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,gFAAgF;IAChF,yEAAyE;IACzE,IACE,CAAC,CAAC,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,2CAAkC,CAAC,CAAC,EAC5E;QACA,MAAM,CAAC,OAAO,CACZ,0EAA0E;YACxE,mCAAmC,CACtC,CAAC;KACH;SAAM;QACL,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B,MAAM,CAAC,IAAI,CAAC,SAAS,UAAU,4BAA4B,CAAC,CAAC;SAC9D;QAED,MAAM,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KACrE;IAED,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO,MAAM,CAAC;AAChB,CAAC;AA9BD,gEA8BC"}
|
||||
{"version":3,"file":"resolve-environment.js","sourceRoot":"","sources":["../src/resolve-environment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;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async function downloadCodeQL(codeqlURL, maybeBundleVersion, maybeCliVersion, ap
|
||||
if (searchParams.has("token")) {
|
||||
logger.debug("CodeQL tools URL contains an authorization token.");
|
||||
}
|
||||
else if (codeqlURL.startsWith(`${apiDetails.url}/`)) {
|
||||
else if (codeqlURL.startsWith(`${apiDetails.url}/`) ||
|
||||
(apiDetails.apiURL && codeqlURL.startsWith(`${apiDetails.apiURL}/`))) {
|
||||
logger.debug("Providing an authorization token to download CodeQL tools.");
|
||||
authorization = `token ${apiDetails.auth}`;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
19
lib/tools-features.js
generated
Normal file
19
lib/tools-features.js
generated
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isSupportedToolsFeature = exports.ToolsFeature = void 0;
|
||||
var ToolsFeature;
|
||||
(function (ToolsFeature) {
|
||||
ToolsFeature["IndirectTracingSupportsStaticBinaries"] = "indirectTracingSupportsStaticBinaries";
|
||||
})(ToolsFeature || (exports.ToolsFeature = ToolsFeature = {}));
|
||||
/**
|
||||
* Determines if the given feature is supported by the CLI.
|
||||
*
|
||||
* @param versionInfo Version information, including features, returned by the CLI.
|
||||
* @param feature The feature to check for.
|
||||
* @returns True if the feature is supported or false otherwise.
|
||||
*/
|
||||
function isSupportedToolsFeature(versionInfo, feature) {
|
||||
return !!versionInfo.features && versionInfo.features[feature];
|
||||
}
|
||||
exports.isSupportedToolsFeature = isSupportedToolsFeature;
|
||||
//# sourceMappingURL=tools-features.js.map
|
||||
1
lib/tools-features.js.map
Normal file
1
lib/tools-features.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"tools-features.js","sourceRoot":"","sources":["../src/tools-features.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAEX;AAFD,WAAY,YAAY;IACtB,+FAA+E,CAAA;AACjF,CAAC,EAFW,YAAY,4BAAZ,YAAY,QAEvB;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"}
|
||||
15
lib/tools-features.test.js
generated
Normal file
15
lib/tools-features.test.js
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ava_1 = __importDefault(require("ava"));
|
||||
const testing_utils_1 = require("./testing-utils");
|
||||
const tools_features_1 = require("./tools-features");
|
||||
(0, ava_1.default)("isSupportedToolsFeature", async (t) => {
|
||||
const versionInfo = (0, testing_utils_1.makeVersionInfo)("1.0.0");
|
||||
t.false((0, tools_features_1.isSupportedToolsFeature)(versionInfo, tools_features_1.ToolsFeature.IndirectTracingSupportsStaticBinaries));
|
||||
versionInfo.features = { indirectTracingSupportsStaticBinaries: true };
|
||||
t.true((0, tools_features_1.isSupportedToolsFeature)(versionInfo, tools_features_1.ToolsFeature.IndirectTracingSupportsStaticBinaries));
|
||||
});
|
||||
//# sourceMappingURL=tools-features.test.js.map
|
||||
1
lib/tools-features.test.js.map
Normal file
1
lib/tools-features.test.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"tools-features.test.js","sourceRoot":"","sources":["../src/tools-features.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAuB;AAEvB,mDAAkD;AAClD,qDAAyE;AAEzE,IAAA,aAAI,EAAC,yBAAyB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC1C,MAAM,WAAW,GAAG,IAAA,+BAAe,EAAC,OAAO,CAAC,CAAC;IAE7C,CAAC,CAAC,KAAK,CACL,IAAA,wCAAuB,EACrB,WAAW,EACX,6BAAY,CAAC,qCAAqC,CACnD,CACF,CAAC;IAEF,WAAW,CAAC,QAAQ,GAAG,EAAE,qCAAqC,EAAE,IAAI,EAAE,CAAC;IAEvE,CAAC,CAAC,IAAI,CACJ,IAAA,wCAAuB,EACrB,WAAW,EACX,6BAAY,CAAC,qCAAqC,CACnD,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
||||
112
node_modules/.package-lock.json
generated
vendored
112
node_modules/.package-lock.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "2.22.0",
|
||||
"version": "2.22.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
@@ -448,9 +448,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "8.50.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz",
|
||||
"integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==",
|
||||
"version": "8.51.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.51.0.tgz",
|
||||
"integrity": "sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
@@ -934,21 +934,21 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/uuid": {
|
||||
"version": "9.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.4.tgz",
|
||||
"integrity": "sha512-zAuJWQflfx6dYJM62vna+Sn5aeSWhh3OB+wfUEACNcqUSc0AGc5JKl+ycL1vrH7frGTXhJchYjE1Hak8L819dA=="
|
||||
"version": "9.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.5.tgz",
|
||||
"integrity": "sha512-xfHdwa1FMJ082prjSJpoEI57GZITiQz10r3vEJCHa2khEFQjKy91aWKz6+zybzssCvXUwE1LQWgWVwZ4nYUvHQ=="
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.3.tgz",
|
||||
"integrity": "sha512-vntq452UHNltxsaaN+L9WyuMch8bMd9CqJ3zhzTPXXidwbf5mqqKCVXEuvRZUqLJSTLeWE65lQwyXsRGnXkCTA==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.5.tgz",
|
||||
"integrity": "sha512-JhtAwTRhOUcP96D0Y6KYnwig/MRQbOoLGXTON2+LlyB/N35SP9j1boai2zzwXb7ypKELXMx3DVk9UTaEq1vHEw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.5.1",
|
||||
"@typescript-eslint/scope-manager": "6.7.3",
|
||||
"@typescript-eslint/type-utils": "6.7.3",
|
||||
"@typescript-eslint/utils": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
||||
"@typescript-eslint/scope-manager": "6.7.5",
|
||||
"@typescript-eslint/type-utils": "6.7.5",
|
||||
"@typescript-eslint/utils": "6.7.5",
|
||||
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||
"debug": "^4.3.4",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.2.4",
|
||||
@@ -974,15 +974,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.3.tgz",
|
||||
"integrity": "sha512-TlutE+iep2o7R8Lf+yoer3zU6/0EAUc8QIBB3GYBc1KGz4c4TRm83xwXUZVPlZ6YCLss4r77jbu6j3sendJoiQ==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.5.tgz",
|
||||
"integrity": "sha512-bIZVSGx2UME/lmhLcjdVc7ePBwn7CLqKarUBL4me1C5feOd663liTGjMBGVcGr+BhnSLeP4SgwdvNnnkbIdkCw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "6.7.3",
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
||||
"@typescript-eslint/scope-manager": "6.7.5",
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1002,13 +1002,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz",
|
||||
"integrity": "sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.5.tgz",
|
||||
"integrity": "sha512-GAlk3eQIwWOJeb9F7MKQ6Jbah/vx1zETSDw8likab/eFcqkjSD7BI75SDAeC5N2L0MmConMoPvTsmkrg71+B1A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3"
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"@typescript-eslint/visitor-keys": "6.7.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^16.0.0 || >=18.0.0"
|
||||
@@ -1019,13 +1019,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.3.tgz",
|
||||
"integrity": "sha512-Fc68K0aTDrKIBvLnKTZ5Pf3MXK495YErrbHb1R6aTpfK5OdSFj0rVN7ib6Tx6ePrZ2gsjLqr0s98NG7l96KSQw==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.5.tgz",
|
||||
"integrity": "sha512-Gs0qos5wqxnQrvpYv+pf3XfcRXW6jiAn9zE/K+DlmYf6FcpxeNYN0AIETaPR7rHO4K2UY+D0CIbDP9Ut0U4m1g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
||||
"@typescript-eslint/utils": "6.7.3",
|
||||
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||
"@typescript-eslint/utils": "6.7.5",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^1.0.1"
|
||||
},
|
||||
@@ -1046,9 +1046,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.3.tgz",
|
||||
"integrity": "sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.5.tgz",
|
||||
"integrity": "sha512-WboQBlOXtdj1tDFPyIthpKrUb+kZf2VroLZhxKa/VlwLlLyqv/PwUNgL30BlTVZV1Wu4Asu2mMYPqarSO4L5ZQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^16.0.0 || >=18.0.0"
|
||||
@@ -1059,13 +1059,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz",
|
||||
"integrity": "sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.5.tgz",
|
||||
"integrity": "sha512-NhJiJ4KdtwBIxrKl0BqG1Ur+uw7FiOnOThcYx9DpOGJ/Abc9z2xNzLeirCG02Ig3vkvrc2qFLmYSSsaITbKjlg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
@@ -1086,17 +1086,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.3.tgz",
|
||||
"integrity": "sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.5.tgz",
|
||||
"integrity": "sha512-pfRRrH20thJbzPPlPc4j0UNGvH1PjPlhlCMq4Yx7EGjV7lvEeGX0U6MJYe8+SyFutWgSHsdbJ3BXzZccYggezA==",
|
||||
"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.7.3",
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
||||
"@typescript-eslint/scope-manager": "6.7.5",
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||
"semver": "^7.5.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1111,12 +1111,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz",
|
||||
"integrity": "sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.5.tgz",
|
||||
"integrity": "sha512-3MaWdDZtLlsexZzDSdQWsFQ9l9nL8B80Z4fImSpyllFC/KLqWQRdEcB+gGGO+N3Q2uL40EsG66wZLsohPxNXvg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"eslint-visitor-keys": "^3.4.1"
|
||||
},
|
||||
"engines": {
|
||||
@@ -2470,15 +2470,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "8.50.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz",
|
||||
"integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==",
|
||||
"version": "8.51.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.51.0.tgz",
|
||||
"integrity": "sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
"@eslint/eslintrc": "^2.1.2",
|
||||
"@eslint/js": "8.50.0",
|
||||
"@eslint/js": "8.51.0",
|
||||
"@humanwhocodes/config-array": "^0.11.11",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
@@ -5445,9 +5445,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/sinon": {
|
||||
"version": "16.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-16.0.0.tgz",
|
||||
"integrity": "sha512-B8AaZZm9CT5pqe4l4uWJztfD/mOTa7dL8Qo0W4+s+t74xECOgSZDDQCBjNgIK3+n4kyxQrSTv2V5ul8K25qkiQ==",
|
||||
"version": "16.1.0",
|
||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-16.1.0.tgz",
|
||||
"integrity": "sha512-ZSgzF0vwmoa8pq0GEynqfdnpEDyP1PkYmEChnkjW0Vyh8IDlyFEJ+fkMhCP0il6d5cJjPl2PUsnUSAuP5sttOQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^3.0.0",
|
||||
|
||||
2
node_modules/@eslint/js/package.json
generated
vendored
2
node_modules/@eslint/js/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@eslint/js",
|
||||
"version": "8.50.0",
|
||||
"version": "8.51.0",
|
||||
"description": "ESLint JavaScript language implementation",
|
||||
"main": "./src/index.js",
|
||||
"scripts": {},
|
||||
|
||||
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, 14 Sep 2023 14:21:18 GMT
|
||||
* Last updated: Fri, 06 Oct 2023 23:05:45 GMT
|
||||
* Dependencies: none
|
||||
* Global values: none
|
||||
|
||||
|
||||
2
node_modules/@types/uuid/index.d.mts
generated
vendored
2
node_modules/@types/uuid/index.d.mts
generated
vendored
@@ -1,4 +1,4 @@
|
||||
import uuid from './index.js';
|
||||
import uuid from "./index.js";
|
||||
export import v1 = uuid.v1;
|
||||
export import v3 = uuid.v3;
|
||||
export import v4 = uuid.v4;
|
||||
|
||||
4
node_modules/@types/uuid/package.json
generated
vendored
4
node_modules/@types/uuid/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@types/uuid",
|
||||
"version": "9.0.4",
|
||||
"version": "9.0.5",
|
||||
"description": "TypeScript definitions for uuid",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/uuid",
|
||||
"license": "MIT",
|
||||
@@ -40,7 +40,7 @@
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {},
|
||||
"typesPublisherContentHash": "bce6069b94fc3e504545efe5646f5e5d0ccbb6a2cfaf3d36698b945952fa4fec",
|
||||
"typesPublisherContentHash": "321106d7a0649dc4bbe8cbc573e0812a78e7208fb095cae5b3497341fad32196",
|
||||
"typeScriptVersion": "4.5",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
|
||||
@@ -117,19 +117,17 @@ exports.default = (0, util_1.createRule)({
|
||||
evaluatedLength.value === evaluatedString.value.length);
|
||||
}
|
||||
/**
|
||||
* Check if a given node is a negative index expression
|
||||
*
|
||||
* E.g. `s.slice(- <expr>)`, `s.substring(s.length - <expr>)`
|
||||
*
|
||||
* @param node The node to check.
|
||||
* @param expectedIndexedNode The node which is expected as the receiver of index expression.
|
||||
* Returns true if `node` is `-substring.length` or
|
||||
* `parentString.length - substring.length`
|
||||
*/
|
||||
function isNegativeIndexExpression(node, expectedIndexedNode) {
|
||||
function isLengthAheadOfEnd(node, substring, parentString) {
|
||||
return ((node.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
|
||||
node.operator === '-') ||
|
||||
node.operator === '-' &&
|
||||
isLengthExpression(node.argument, substring)) ||
|
||||
(node.type === utils_1.AST_NODE_TYPES.BinaryExpression &&
|
||||
node.operator === '-' &&
|
||||
isLengthExpression(node.left, expectedIndexedNode)));
|
||||
isLengthExpression(node.left, parentString) &&
|
||||
isLengthExpression(node.right, substring)));
|
||||
}
|
||||
/**
|
||||
* Check if a given node is the expression of the last index.
|
||||
@@ -405,14 +403,34 @@ exports.default = (0, util_1.createRule)({
|
||||
if (!isEqualityComparison(parentNode) || !isStringType(node.object)) {
|
||||
return;
|
||||
}
|
||||
const isEndsWith = (callNode.arguments.length === 1 ||
|
||||
(callNode.arguments.length === 2 &&
|
||||
isLengthExpression(callNode.arguments[1], node.object))) &&
|
||||
isNegativeIndexExpression(callNode.arguments[0], node.object);
|
||||
const isStartsWith = !isEndsWith &&
|
||||
callNode.arguments.length === 2 &&
|
||||
let isEndsWith = false;
|
||||
let isStartsWith = false;
|
||||
if (callNode.arguments.length === 1) {
|
||||
if (
|
||||
// foo.slice(-bar.length) === bar
|
||||
// foo.slice(foo.length - bar.length) === bar
|
||||
isLengthAheadOfEnd(callNode.arguments[0], parentNode.right, node.object)) {
|
||||
isEndsWith = true;
|
||||
}
|
||||
}
|
||||
else if (callNode.arguments.length === 2) {
|
||||
if (
|
||||
// foo.slice(0, bar.length) === bar
|
||||
isNumber(callNode.arguments[0], 0) &&
|
||||
!isNegativeIndexExpression(callNode.arguments[1], node.object);
|
||||
isLengthExpression(callNode.arguments[1], parentNode.right)) {
|
||||
isStartsWith = true;
|
||||
}
|
||||
else if (
|
||||
// foo.slice(foo.length - bar.length, foo.length) === bar
|
||||
// foo.slice(foo.length - bar.length, 0) === bar
|
||||
// foo.slice(-bar.length, foo.length) === bar
|
||||
// foo.slice(-bar.length, 0) === bar
|
||||
(isLengthExpression(callNode.arguments[1], node.object) ||
|
||||
isNumber(callNode.arguments[1], 0)) &&
|
||||
isLengthAheadOfEnd(callNode.arguments[0], parentNode.right, node.object)) {
|
||||
isEndsWith = true;
|
||||
}
|
||||
}
|
||||
if (!isStartsWith && !isEndsWith) {
|
||||
return;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md
generated
vendored
2
node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md
generated
vendored
@@ -76,7 +76,7 @@ declare function acceptsBoolean(arg: boolean): void;
|
||||
acceptsBoolean(foo != null && foo.bar);
|
||||
|
||||
// ❌ typechecks UNSUCCESSFULLY as the expression returns `boolean | undefined`
|
||||
acceptsBoolean(foo != null && foo.bar);
|
||||
acceptsBoolean(foo?.bar);
|
||||
```
|
||||
|
||||
This style of code isn't super common - which means having this option set to `true` _should_ be safe in most codebases. However we default it to `false` due to its unsafe nature. We have provided this option for convenience because it increases the autofix cases covered by the rule. If you set option to `true` the onus is entirely on you and your team to ensure that each fix is correct and safe and that it does not break the build.
|
||||
|
||||
16
node_modules/@typescript-eslint/eslint-plugin/package.json
generated
vendored
16
node_modules/@typescript-eslint/eslint-plugin/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typescript-eslint/eslint-plugin",
|
||||
"version": "6.7.3",
|
||||
"version": "6.7.5",
|
||||
"description": "TypeScript plugin for ESLint",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -57,10 +57,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.5.1",
|
||||
"@typescript-eslint/scope-manager": "6.7.3",
|
||||
"@typescript-eslint/type-utils": "6.7.3",
|
||||
"@typescript-eslint/utils": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
||||
"@typescript-eslint/scope-manager": "6.7.5",
|
||||
"@typescript-eslint/type-utils": "6.7.5",
|
||||
"@typescript-eslint/utils": "6.7.5",
|
||||
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||
"debug": "^4.3.4",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.2.4",
|
||||
@@ -73,8 +73,8 @@
|
||||
"@types/marked": "*",
|
||||
"@types/natural-compare": "*",
|
||||
"@types/prettier": "*",
|
||||
"@typescript-eslint/rule-schema-to-typescript-types": "6.7.3",
|
||||
"@typescript-eslint/rule-tester": "6.7.3",
|
||||
"@typescript-eslint/rule-schema-to-typescript-types": "6.7.5",
|
||||
"@typescript-eslint/rule-tester": "6.7.5",
|
||||
"ajv": "^6.12.6",
|
||||
"chalk": "^5.3.0",
|
||||
"cross-fetch": "*",
|
||||
@@ -103,5 +103,5 @@
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
||||
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||
}
|
||||
|
||||
12
node_modules/@typescript-eslint/parser/package.json
generated
vendored
12
node_modules/@typescript-eslint/parser/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typescript-eslint/parser",
|
||||
"version": "6.7.3",
|
||||
"version": "6.7.5",
|
||||
"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.7.3",
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
||||
"@typescript-eslint/scope-manager": "6.7.5",
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -82,5 +82,5 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
||||
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||
}
|
||||
|
||||
10
node_modules/@typescript-eslint/scope-manager/package.json
generated
vendored
10
node_modules/@typescript-eslint/scope-manager/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typescript-eslint/scope-manager",
|
||||
"version": "6.7.3",
|
||||
"version": "6.7.5",
|
||||
"description": "TypeScript scope analyser for ESLint",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -44,12 +44,12 @@
|
||||
"typecheck": "nx typecheck"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3"
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"@typescript-eslint/visitor-keys": "6.7.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/glob": "*",
|
||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
||||
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||
"glob": "*",
|
||||
"jest-specific-snapshot": "*",
|
||||
"make-dir": "*",
|
||||
@@ -67,5 +67,5 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
||||
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||
}
|
||||
|
||||
10
node_modules/@typescript-eslint/type-utils/package.json
generated
vendored
10
node_modules/@typescript-eslint/type-utils/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typescript-eslint/type-utils",
|
||||
"version": "6.7.3",
|
||||
"version": "6.7.5",
|
||||
"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.7.3",
|
||||
"@typescript-eslint/utils": "6.7.3",
|
||||
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||
"@typescript-eslint/utils": "6.7.5",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/parser": "6.7.3",
|
||||
"@typescript-eslint/parser": "6.7.5",
|
||||
"ajv": "^6.10.0",
|
||||
"downlevel-dts": "*",
|
||||
"jest": "29.7.0",
|
||||
@@ -78,5 +78,5 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
||||
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||
}
|
||||
|
||||
4
node_modules/@typescript-eslint/types/package.json
generated
vendored
4
node_modules/@typescript-eslint/types/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typescript-eslint/types",
|
||||
"version": "6.7.3",
|
||||
"version": "6.7.5",
|
||||
"description": "Types for the TypeScript-ESTree AST spec",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -90,5 +90,5 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
||||
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||
}
|
||||
|
||||
8
node_modules/@typescript-eslint/typescript-estree/package.json
generated
vendored
8
node_modules/@typescript-eslint/typescript-estree/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typescript-eslint/typescript-estree",
|
||||
"version": "6.7.3",
|
||||
"version": "6.7.5",
|
||||
"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.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
@@ -88,5 +88,5 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
||||
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||
}
|
||||
|
||||
12
node_modules/@typescript-eslint/utils/package.json
generated
vendored
12
node_modules/@typescript-eslint/utils/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typescript-eslint/utils",
|
||||
"version": "6.7.3",
|
||||
"version": "6.7.5",
|
||||
"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.7.3",
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
||||
"@typescript-eslint/scope-manager": "6.7.5",
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||
"semver": "^7.5.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^7.0.0 || ^8.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/parser": "6.7.3",
|
||||
"@typescript-eslint/parser": "6.7.5",
|
||||
"downlevel-dts": "*",
|
||||
"jest": "29.7.0",
|
||||
"prettier": "^2.8.4",
|
||||
@@ -95,5 +95,5 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
||||
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||
}
|
||||
|
||||
6
node_modules/@typescript-eslint/visitor-keys/package.json
generated
vendored
6
node_modules/@typescript-eslint/visitor-keys/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typescript-eslint/visitor-keys",
|
||||
"version": "6.7.3",
|
||||
"version": "6.7.5",
|
||||
"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.7.3",
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"eslint-visitor-keys": "^3.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -67,5 +67,5 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"gitHead": "91a3e0c85a8fb2001ad808362b437df0b90cce04"
|
||||
"gitHead": "36aecb6a836eb01307c35b42ca60f5a78496c339"
|
||||
}
|
||||
|
||||
4
node_modules/eslint/README.md
generated
vendored
4
node_modules/eslint/README.md
generated
vendored
@@ -288,8 +288,8 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
||||
<h3>Platinum Sponsors</h3>
|
||||
<p><a href="#"><img src="https://images.opencollective.com/2021-frameworks-fund/logo.png" alt="Chrome Frameworks Fund" height="undefined"></a> <a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
|
||||
<p><a href="https://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a></p><h3>Silver Sponsors</h3>
|
||||
<p><a href="https://sentry.io"><img src="https://avatars.githubusercontent.com/u/1396951?v=4" alt="Sentry" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://opensource.siemens.com"><img src="https://avatars.githubusercontent.com/u/624020?v=4" alt="Siemens" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||
<p><a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://quickbookstoolhub.com"><img src="https://avatars.githubusercontent.com/u/95090305?u=e5bc398ef775c9ed19f955c675cdc1fb6abf01df&v=4" alt="QuickBooks Tool hub" height="32"></a></p>
|
||||
<p><a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://opensource.siemens.com"><img src="https://avatars.githubusercontent.com/u/624020?v=4" alt="Siemens" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||
<p><a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://quickbookstoolhub.com"><img src="https://avatars.githubusercontent.com/u/95090305?u=e5bc398ef775c9ed19f955c675cdc1fb6abf01df&v=4" alt="QuickBooks Tool hub" height="32"></a></p>
|
||||
<!--sponsorsend-->
|
||||
|
||||
## Technology Sponsors
|
||||
|
||||
19
node_modules/eslint/bin/eslint.js
generated
vendored
19
node_modules/eslint/bin/eslint.js
generated
vendored
@@ -92,6 +92,14 @@ function getErrorMessage(error) {
|
||||
return util.format("%o", error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tracks error messages that are shown to the user so we only ever show the
|
||||
* same message once.
|
||||
* @type {Set<string>}
|
||||
*/
|
||||
|
||||
const displayedErrors = new Set();
|
||||
|
||||
/**
|
||||
* Catch and report unexpected error.
|
||||
* @param {any} error The thrown error object.
|
||||
@@ -101,14 +109,17 @@ function onFatalError(error) {
|
||||
process.exitCode = 2;
|
||||
|
||||
const { version } = require("../package.json");
|
||||
const message = getErrorMessage(error);
|
||||
|
||||
console.error(`
|
||||
const message = `
|
||||
Oops! Something went wrong! :(
|
||||
|
||||
ESLint: ${version}
|
||||
|
||||
${message}`);
|
||||
${getErrorMessage(error)}`;
|
||||
|
||||
if (!displayedErrors.has(message)) {
|
||||
console.error(message);
|
||||
displayedErrors.add(message);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
8
node_modules/eslint/lib/cli.js
generated
vendored
8
node_modules/eslint/lib/cli.js
generated
vendored
@@ -91,7 +91,8 @@ async function translateOptions({
|
||||
reportUnusedDisableDirectives,
|
||||
resolvePluginsRelativeTo,
|
||||
rule,
|
||||
rulesdir
|
||||
rulesdir,
|
||||
warnIgnored
|
||||
}, configType) {
|
||||
|
||||
let overrideConfig, overrideConfigFile;
|
||||
@@ -182,6 +183,7 @@ async function translateOptions({
|
||||
|
||||
if (configType === "flat") {
|
||||
options.ignorePatterns = ignorePattern;
|
||||
options.warnIgnored = warnIgnored;
|
||||
} else {
|
||||
options.resolvePluginsRelativeTo = resolvePluginsRelativeTo;
|
||||
options.rulePaths = rulesdir;
|
||||
@@ -385,7 +387,9 @@ const cli = {
|
||||
if (useStdin) {
|
||||
results = await engine.lintText(text, {
|
||||
filePath: options.stdinFilename,
|
||||
warnIgnored: true
|
||||
|
||||
// flatConfig respects CLI flag and constructor warnIgnored, eslintrc forces true for backwards compatibility
|
||||
warnIgnored: usingFlatConfig ? void 0 : true
|
||||
});
|
||||
} else {
|
||||
results = await engine.lintFiles(files);
|
||||
|
||||
4
node_modules/eslint/lib/config/flat-config-schema.js
generated
vendored
4
node_modules/eslint/lib/config/flat-config-schema.js
generated
vendored
@@ -179,9 +179,7 @@ class InvalidRuleSeverityError extends Error {
|
||||
* @throws {InvalidRuleSeverityError} If the value isn't a valid rule severity.
|
||||
*/
|
||||
function assertIsRuleSeverity(ruleId, value) {
|
||||
const severity = typeof value === "string"
|
||||
? ruleSeverities.get(value.toLowerCase())
|
||||
: ruleSeverities.get(value);
|
||||
const severity = ruleSeverities.get(value);
|
||||
|
||||
if (typeof severity === "undefined") {
|
||||
throw new InvalidRuleSeverityError(ruleId, value);
|
||||
|
||||
11
node_modules/eslint/lib/eslint/eslint-helpers.js
generated
vendored
11
node_modules/eslint/lib/eslint/eslint-helpers.js
generated
vendored
@@ -594,9 +594,9 @@ function createIgnoreResult(filePath, baseDir) {
|
||||
const isInNodeModules = baseDir && path.dirname(path.relative(baseDir, filePath)).split(path.sep).includes("node_modules");
|
||||
|
||||
if (isInNodeModules) {
|
||||
message = "File ignored by default because it is located under the node_modules directory. Use ignore pattern \"!**/node_modules/\" to override.";
|
||||
message = "File ignored by default because it is located under the node_modules directory. Use ignore pattern \"!**/node_modules/\" to disable file ignore settings or use \"--no-warn-ignored\" to suppress this warning.";
|
||||
} else {
|
||||
message = "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override.";
|
||||
message = "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to disable file ignore settings or use \"--no-warn-ignored\" to suppress this warning.";
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -676,6 +676,7 @@ function processOptions({
|
||||
overrideConfigFile = null,
|
||||
plugins = {},
|
||||
reportUnusedDisableDirectives = null, // ← should be null by default because if it's a string then it overrides the 'reportUnusedDisableDirectives' setting in config files. And we cannot use `overrideConfig.reportUnusedDisableDirectives` instead because we cannot configure the `error` severity with that.
|
||||
warnIgnored = true,
|
||||
...unknownOptions
|
||||
}) {
|
||||
const errors = [];
|
||||
@@ -781,6 +782,9 @@ function processOptions({
|
||||
) {
|
||||
errors.push("'reportUnusedDisableDirectives' must be any of \"error\", \"warn\", \"off\", and null.");
|
||||
}
|
||||
if (typeof warnIgnored !== "boolean") {
|
||||
errors.push("'warnIgnored' must be a boolean.");
|
||||
}
|
||||
if (errors.length > 0) {
|
||||
throw new ESLintInvalidOptionsError(errors);
|
||||
}
|
||||
@@ -802,7 +806,8 @@ function processOptions({
|
||||
globInputPaths,
|
||||
ignore,
|
||||
ignorePatterns,
|
||||
reportUnusedDisableDirectives
|
||||
reportUnusedDisableDirectives,
|
||||
warnIgnored
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
19
node_modules/eslint/lib/eslint/flat-eslint.js
generated
vendored
19
node_modules/eslint/lib/eslint/flat-eslint.js
generated
vendored
@@ -84,6 +84,7 @@ const LintResultCache = require("../cli-engine/lint-result-cache");
|
||||
* when a string.
|
||||
* @property {Record<string,Plugin>} [plugins] An array of plugin implementations.
|
||||
* @property {"error" | "warn" | "off"} [reportUnusedDisableDirectives] the severity to report unused eslint-disable directives.
|
||||
* @property {boolean} warnIgnored Show warnings when the file list includes ignored files
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -749,7 +750,8 @@ class FlatESLint {
|
||||
fixTypes,
|
||||
reportUnusedDisableDirectives,
|
||||
globInputPaths,
|
||||
errorOnUnmatchedPattern
|
||||
errorOnUnmatchedPattern,
|
||||
warnIgnored
|
||||
} = eslintOptions;
|
||||
const startTime = Date.now();
|
||||
const fixTypesSet = fixTypes ? new Set(fixTypes) : null;
|
||||
@@ -795,9 +797,13 @@ class FlatESLint {
|
||||
* pattern, then notify the user.
|
||||
*/
|
||||
if (ignored) {
|
||||
if (warnIgnored) {
|
||||
return createIgnoreResult(filePath, cwd);
|
||||
}
|
||||
|
||||
return void 0;
|
||||
}
|
||||
|
||||
const config = configs.getConfig(filePath);
|
||||
|
||||
/*
|
||||
@@ -908,7 +914,7 @@ class FlatESLint {
|
||||
|
||||
const {
|
||||
filePath,
|
||||
warnIgnored = false,
|
||||
warnIgnored,
|
||||
...unknownOptions
|
||||
} = options || {};
|
||||
|
||||
@@ -922,7 +928,7 @@ class FlatESLint {
|
||||
throw new Error("'options.filePath' must be a non-empty string or undefined");
|
||||
}
|
||||
|
||||
if (typeof warnIgnored !== "boolean") {
|
||||
if (typeof warnIgnored !== "boolean" && typeof warnIgnored !== "undefined") {
|
||||
throw new Error("'options.warnIgnored' must be a boolean or undefined");
|
||||
}
|
||||
|
||||
@@ -937,7 +943,8 @@ class FlatESLint {
|
||||
allowInlineConfig,
|
||||
cwd,
|
||||
fix,
|
||||
reportUnusedDisableDirectives
|
||||
reportUnusedDisableDirectives,
|
||||
warnIgnored: constructorWarnIgnored
|
||||
} = eslintOptions;
|
||||
const results = [];
|
||||
const startTime = Date.now();
|
||||
@@ -945,7 +952,9 @@ class FlatESLint {
|
||||
|
||||
// Clear the last used config arrays.
|
||||
if (resolvedFilename && await this.isPathIgnored(resolvedFilename)) {
|
||||
if (warnIgnored) {
|
||||
const shouldWarnIgnored = typeof warnIgnored === "boolean" ? warnIgnored : constructorWarnIgnored;
|
||||
|
||||
if (shouldWarnIgnored) {
|
||||
results.push(createIgnoreResult(resolvedFilename, cwd));
|
||||
}
|
||||
} else {
|
||||
|
||||
2
node_modules/eslint/lib/linter/apply-disable-directives.js
generated
vendored
2
node_modules/eslint/lib/linter/apply-disable-directives.js
generated
vendored
@@ -87,7 +87,7 @@ function createIndividualDirectivesRemoval(directives, commentToken) {
|
||||
return directives.map(directive => {
|
||||
const { ruleId } = directive;
|
||||
|
||||
const regex = new RegExp(String.raw`(?:^|\s*,\s*)${escapeRegExp(ruleId)}(?:\s*,\s*|$)`, "u");
|
||||
const regex = new RegExp(String.raw`(?:^|\s*,\s*)(?<quote>['"]?)${escapeRegExp(ruleId)}\k<quote>(?:\s*,\s*|$)`, "u");
|
||||
const match = regex.exec(listText);
|
||||
const matchedText = match[0];
|
||||
const matchStartOffset = listStartOffset + match.index;
|
||||
|
||||
1351
node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js
generated
vendored
1351
node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js
generated
vendored
File diff suppressed because it is too large
Load Diff
160
node_modules/eslint/lib/linter/code-path-analysis/code-path.js
generated
vendored
160
node_modules/eslint/lib/linter/code-path-analysis/code-path.js
generated
vendored
@@ -80,7 +80,9 @@ class CodePath {
|
||||
}
|
||||
|
||||
/**
|
||||
* The initial code path segment.
|
||||
* The initial code path segment. This is the segment that is at the head
|
||||
* of the code path.
|
||||
* This is a passthrough to the underlying `CodePathState`.
|
||||
* @type {CodePathSegment}
|
||||
*/
|
||||
get initialSegment() {
|
||||
@@ -88,8 +90,10 @@ class CodePath {
|
||||
}
|
||||
|
||||
/**
|
||||
* Final code path segments.
|
||||
* This array is a mix of `returnedSegments` and `thrownSegments`.
|
||||
* Final code path segments. These are the terminal (tail) segments in the
|
||||
* code path, which is the combination of `returnedSegments` and `thrownSegments`.
|
||||
* All segments in this array are reachable.
|
||||
* This is a passthrough to the underlying `CodePathState`.
|
||||
* @type {CodePathSegment[]}
|
||||
*/
|
||||
get finalSegments() {
|
||||
@@ -97,9 +101,14 @@ class CodePath {
|
||||
}
|
||||
|
||||
/**
|
||||
* Final code path segments which is with `return` statements.
|
||||
* This array contains the last path segment if it's reachable.
|
||||
* Since the reachable last path returns `undefined`.
|
||||
* Final code path segments that represent normal completion of the code path.
|
||||
* For functions, this means both explicit `return` statements and implicit returns,
|
||||
* such as the last reachable segment in a function that does not have an
|
||||
* explicit `return` as this implicitly returns `undefined`. For scripts,
|
||||
* modules, class field initializers, and class static blocks, this means
|
||||
* all lines of code have been executed.
|
||||
* These segments are also present in `finalSegments`.
|
||||
* This is a passthrough to the underlying `CodePathState`.
|
||||
* @type {CodePathSegment[]}
|
||||
*/
|
||||
get returnedSegments() {
|
||||
@@ -107,7 +116,9 @@ class CodePath {
|
||||
}
|
||||
|
||||
/**
|
||||
* Final code path segments which is with `throw` statements.
|
||||
* Final code path segments that represent `throw` statements.
|
||||
* This is a passthrough to the underlying `CodePathState`.
|
||||
* These segments are also present in `finalSegments`.
|
||||
* @type {CodePathSegment[]}
|
||||
*/
|
||||
get thrownSegments() {
|
||||
@@ -115,7 +126,12 @@ class CodePath {
|
||||
}
|
||||
|
||||
/**
|
||||
* Current code path segments.
|
||||
* Tracks the traversal of the code path through each segment. This array
|
||||
* starts empty and segments are added or removed as the code path is
|
||||
* traversed. This array always ends up empty at the end of a code path
|
||||
* traversal. The `CodePathState` uses this to track its progress through
|
||||
* the code path.
|
||||
* This is a passthrough to the underlying `CodePathState`.
|
||||
* @type {CodePathSegment[]}
|
||||
* @deprecated
|
||||
*/
|
||||
@@ -126,46 +142,70 @@ class CodePath {
|
||||
/**
|
||||
* Traverses all segments in this code path.
|
||||
*
|
||||
* codePath.traverseSegments(function(segment, controller) {
|
||||
* codePath.traverseSegments((segment, controller) => {
|
||||
* // do something.
|
||||
* });
|
||||
*
|
||||
* This method enumerates segments in order from the head.
|
||||
*
|
||||
* The `controller` object has two methods.
|
||||
* The `controller` argument has two methods:
|
||||
*
|
||||
* - `controller.skip()` - Skip the following segments in this branch.
|
||||
* - `controller.break()` - Skip all following segments.
|
||||
* @param {Object} [options] Omittable.
|
||||
* @param {CodePathSegment} [options.first] The first segment to traverse.
|
||||
* @param {CodePathSegment} [options.last] The last segment to traverse.
|
||||
* - `skip()` - skips the following segments in this branch
|
||||
* - `break()` - skips all following segments in the traversal
|
||||
*
|
||||
* A note on the parameters: the `options` argument is optional. This means
|
||||
* the first argument might be an options object or the callback function.
|
||||
* @param {Object} [optionsOrCallback] Optional first and last segments to traverse.
|
||||
* @param {CodePathSegment} [optionsOrCallback.first] The first segment to traverse.
|
||||
* @param {CodePathSegment} [optionsOrCallback.last] The last segment to traverse.
|
||||
* @param {Function} callback A callback function.
|
||||
* @returns {void}
|
||||
*/
|
||||
traverseSegments(options, callback) {
|
||||
traverseSegments(optionsOrCallback, callback) {
|
||||
|
||||
// normalize the arguments into a callback and options
|
||||
let resolvedOptions;
|
||||
let resolvedCallback;
|
||||
|
||||
if (typeof options === "function") {
|
||||
resolvedCallback = options;
|
||||
if (typeof optionsOrCallback === "function") {
|
||||
resolvedCallback = optionsOrCallback;
|
||||
resolvedOptions = {};
|
||||
} else {
|
||||
resolvedOptions = options || {};
|
||||
resolvedOptions = optionsOrCallback || {};
|
||||
resolvedCallback = callback;
|
||||
}
|
||||
|
||||
// determine where to start traversing from based on the options
|
||||
const startSegment = resolvedOptions.first || this.internal.initialSegment;
|
||||
const lastSegment = resolvedOptions.last;
|
||||
|
||||
let item = null;
|
||||
// set up initial location information
|
||||
let record = null;
|
||||
let index = 0;
|
||||
let end = 0;
|
||||
let segment = null;
|
||||
const visited = Object.create(null);
|
||||
|
||||
// segments that have already been visited during traversal
|
||||
const visited = new Set();
|
||||
|
||||
// tracks the traversal steps
|
||||
const stack = [[startSegment, 0]];
|
||||
|
||||
// tracks the last skipped segment during traversal
|
||||
let skippedSegment = null;
|
||||
|
||||
// indicates if we exited early from the traversal
|
||||
let broken = false;
|
||||
|
||||
/**
|
||||
* Maintains traversal state.
|
||||
*/
|
||||
const controller = {
|
||||
|
||||
/**
|
||||
* Skip the following segments in this branch.
|
||||
* @returns {void}
|
||||
*/
|
||||
skip() {
|
||||
if (stack.length <= 1) {
|
||||
broken = true;
|
||||
@@ -173,32 +213,52 @@ class CodePath {
|
||||
skippedSegment = stack[stack.length - 2][0];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Stop traversal completely - do not traverse to any
|
||||
* other segments.
|
||||
* @returns {void}
|
||||
*/
|
||||
break() {
|
||||
broken = true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks a given previous segment has been visited.
|
||||
* Checks if a given previous segment has been visited.
|
||||
* @param {CodePathSegment} prevSegment A previous segment to check.
|
||||
* @returns {boolean} `true` if the segment has been visited.
|
||||
*/
|
||||
function isVisited(prevSegment) {
|
||||
return (
|
||||
visited[prevSegment.id] ||
|
||||
visited.has(prevSegment) ||
|
||||
segment.isLoopedPrevSegment(prevSegment)
|
||||
);
|
||||
}
|
||||
|
||||
// the traversal
|
||||
while (stack.length > 0) {
|
||||
item = stack[stack.length - 1];
|
||||
segment = item[0];
|
||||
index = item[1];
|
||||
|
||||
/*
|
||||
* This isn't a pure stack. We use the top record all the time
|
||||
* but don't always pop it off. The record is popped only if
|
||||
* one of the following is true:
|
||||
*
|
||||
* 1) We have already visited the segment.
|
||||
* 2) We have not visited *all* of the previous segments.
|
||||
* 3) We have traversed past the available next segments.
|
||||
*
|
||||
* Otherwise, we just read the value and sometimes modify the
|
||||
* record as we traverse.
|
||||
*/
|
||||
record = stack[stack.length - 1];
|
||||
segment = record[0];
|
||||
index = record[1];
|
||||
|
||||
if (index === 0) {
|
||||
|
||||
// Skip if this segment has been visited already.
|
||||
if (visited[segment.id]) {
|
||||
if (visited.has(segment)) {
|
||||
stack.pop();
|
||||
continue;
|
||||
}
|
||||
@@ -212,18 +272,29 @@ class CodePath {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Reset the flag of skipping if all branches have been skipped.
|
||||
// Reset the skipping flag if all branches have been skipped.
|
||||
if (skippedSegment && segment.prevSegments.includes(skippedSegment)) {
|
||||
skippedSegment = null;
|
||||
}
|
||||
visited[segment.id] = true;
|
||||
visited.add(segment);
|
||||
|
||||
// Call the callback when the first time.
|
||||
/*
|
||||
* If the most recent segment hasn't been skipped, then we call
|
||||
* the callback, passing in the segment and the controller.
|
||||
*/
|
||||
if (!skippedSegment) {
|
||||
resolvedCallback.call(this, segment, controller);
|
||||
|
||||
// exit if we're at the last segment
|
||||
if (segment === lastSegment) {
|
||||
controller.skip();
|
||||
}
|
||||
|
||||
/*
|
||||
* If the previous statement was executed, or if the callback
|
||||
* called a method on the controller, we might need to exit the
|
||||
* loop, so check for that and break accordingly.
|
||||
*/
|
||||
if (broken) {
|
||||
break;
|
||||
}
|
||||
@@ -233,12 +304,35 @@ class CodePath {
|
||||
// Update the stack.
|
||||
end = segment.nextSegments.length - 1;
|
||||
if (index < end) {
|
||||
item[1] += 1;
|
||||
|
||||
/*
|
||||
* If we haven't yet visited all of the next segments, update
|
||||
* the current top record on the stack to the next index to visit
|
||||
* and then push a record for the current segment on top.
|
||||
*
|
||||
* Setting the current top record's index lets us know how many
|
||||
* times we've been here and ensures that the segment won't be
|
||||
* reprocessed (because we only process segments with an index
|
||||
* of 0).
|
||||
*/
|
||||
record[1] += 1;
|
||||
stack.push([segment.nextSegments[index], 0]);
|
||||
} else if (index === end) {
|
||||
item[0] = segment.nextSegments[index];
|
||||
item[1] = 0;
|
||||
|
||||
/*
|
||||
* If we are at the last next segment, then reset the top record
|
||||
* in the stack to next segment and set its index to 0 so it will
|
||||
* be processed next.
|
||||
*/
|
||||
record[0] = segment.nextSegments[index];
|
||||
record[1] = 0;
|
||||
} else {
|
||||
|
||||
/*
|
||||
* If index > end, that means we have no more segments that need
|
||||
* processing. So, we pop that record off of the stack in order to
|
||||
* continue traversing at the next level up.
|
||||
*/
|
||||
stack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
245
node_modules/eslint/lib/linter/code-path-analysis/fork-context.js
generated
vendored
245
node_modules/eslint/lib/linter/code-path-analysis/fork-context.js
generated
vendored
@@ -21,8 +21,8 @@ const assert = require("assert"),
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Gets whether or not a given segment is reachable.
|
||||
* @param {CodePathSegment} segment A segment to get.
|
||||
* Determines whether or not a given segment is reachable.
|
||||
* @param {CodePathSegment} segment The segment to check.
|
||||
* @returns {boolean} `true` if the segment is reachable.
|
||||
*/
|
||||
function isReachable(segment) {
|
||||
@@ -30,32 +30,64 @@ function isReachable(segment) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new segments from the specific range of `context.segmentsList`.
|
||||
* Creates a new segment for each fork in the given context and appends it
|
||||
* to the end of the specified range of segments. Ultimately, this ends up calling
|
||||
* `new CodePathSegment()` for each of the forks using the `create` argument
|
||||
* as a wrapper around special behavior.
|
||||
*
|
||||
* The `startIndex` and `endIndex` arguments specify a range of segments in
|
||||
* `context` that should become `allPrevSegments` for the newly created
|
||||
* `CodePathSegment` objects.
|
||||
*
|
||||
* When `context.segmentsList` is `[[a, b], [c, d], [e, f]]`, `begin` is `0`, and
|
||||
* `end` is `-1`, this creates `[g, h]`. This `g` is from `a`, `c`, and `e`.
|
||||
* This `h` is from `b`, `d`, and `f`.
|
||||
* @param {ForkContext} context An instance.
|
||||
* @param {number} begin The first index of the previous segments.
|
||||
* @param {number} end The last index of the previous segments.
|
||||
* @param {Function} create A factory function of new segments.
|
||||
* @returns {CodePathSegment[]} New segments.
|
||||
* `end` is `-1`, this creates two new segments, `[g, h]`. This `g` is appended to
|
||||
* the end of the path from `a`, `c`, and `e`. This `h` is appended to the end of
|
||||
* `b`, `d`, and `f`.
|
||||
* @param {ForkContext} context An instance from which the previous segments
|
||||
* will be obtained.
|
||||
* @param {number} startIndex The index of the first segment in the context
|
||||
* that should be specified as previous segments for the newly created segments.
|
||||
* @param {number} endIndex The index of the last segment in the context
|
||||
* that should be specified as previous segments for the newly created segments.
|
||||
* @param {Function} create A function that creates new `CodePathSegment`
|
||||
* instances in a particular way. See the `CodePathSegment.new*` methods.
|
||||
* @returns {Array<CodePathSegment>} An array of the newly-created segments.
|
||||
*/
|
||||
function makeSegments(context, begin, end, create) {
|
||||
function createSegments(context, startIndex, endIndex, create) {
|
||||
|
||||
/** @type {Array<Array<CodePathSegment>>} */
|
||||
const list = context.segmentsList;
|
||||
|
||||
const normalizedBegin = begin >= 0 ? begin : list.length + begin;
|
||||
const normalizedEnd = end >= 0 ? end : list.length + end;
|
||||
/*
|
||||
* Both `startIndex` and `endIndex` work the same way: if the number is zero
|
||||
* or more, then the number is used as-is. If the number is negative,
|
||||
* then that number is added to the length of the segments list to
|
||||
* determine the index to use. That means -1 for either argument
|
||||
* is the last element, -2 is the second to last, and so on.
|
||||
*
|
||||
* So if `startIndex` is 0, `endIndex` is -1, and `list.length` is 3, the
|
||||
* effective `startIndex` is 0 and the effective `endIndex` is 2, so this function
|
||||
* will include items at indices 0, 1, and 2.
|
||||
*
|
||||
* Therefore, if `startIndex` is -1 and `endIndex` is -1, that means we'll only
|
||||
* be using the last segment in `list`.
|
||||
*/
|
||||
const normalizedBegin = startIndex >= 0 ? startIndex : list.length + startIndex;
|
||||
const normalizedEnd = endIndex >= 0 ? endIndex : list.length + endIndex;
|
||||
|
||||
/** @type {Array<CodePathSegment>} */
|
||||
const segments = [];
|
||||
|
||||
for (let i = 0; i < context.count; ++i) {
|
||||
|
||||
// this is passed into `new CodePathSegment` to add to code path.
|
||||
const allPrevSegments = [];
|
||||
|
||||
for (let j = normalizedBegin; j <= normalizedEnd; ++j) {
|
||||
allPrevSegments.push(list[j][i]);
|
||||
}
|
||||
|
||||
// note: `create` is just a wrapper that augments `new CodePathSegment`.
|
||||
segments.push(create(context.idGenerator.next(), allPrevSegments));
|
||||
}
|
||||
|
||||
@@ -63,28 +95,57 @@ function makeSegments(context, begin, end, create) {
|
||||
}
|
||||
|
||||
/**
|
||||
* `segments` becomes doubly in a `finally` block. Then if a code path exits by a
|
||||
* control statement (such as `break`, `continue`) from the `finally` block, the
|
||||
* destination's segments may be half of the source segments. In that case, this
|
||||
* merges segments.
|
||||
* @param {ForkContext} context An instance.
|
||||
* @param {CodePathSegment[]} segments Segments to merge.
|
||||
* @returns {CodePathSegment[]} The merged segments.
|
||||
* Inside of a `finally` block we end up with two parallel paths. If the code path
|
||||
* exits by a control statement (such as `break` or `continue`) from the `finally`
|
||||
* block, then we need to merge the remaining parallel paths back into one.
|
||||
* @param {ForkContext} context The fork context to work on.
|
||||
* @param {Array<CodePathSegment>} segments Segments to merge.
|
||||
* @returns {Array<CodePathSegment>} The merged segments.
|
||||
*/
|
||||
function mergeExtraSegments(context, segments) {
|
||||
let currentSegments = segments;
|
||||
|
||||
/*
|
||||
* We need to ensure that the array returned from this function contains no more
|
||||
* than the number of segments that the context allows. `context.count` indicates
|
||||
* how many items should be in the returned array to ensure that the new segment
|
||||
* entries will line up with the already existing segment entries.
|
||||
*/
|
||||
while (currentSegments.length > context.count) {
|
||||
const merged = [];
|
||||
|
||||
for (let i = 0, length = currentSegments.length / 2 | 0; i < length; ++i) {
|
||||
/*
|
||||
* Because `context.count` is a factor of 2 inside of a `finally` block,
|
||||
* we can divide the segment count by 2 to merge the paths together.
|
||||
* This loops through each segment in the list and creates a new `CodePathSegment`
|
||||
* that has the segment and the segment two slots away as previous segments.
|
||||
*
|
||||
* If `currentSegments` is [a,b,c,d], this will create new segments e and f, such
|
||||
* that:
|
||||
*
|
||||
* When `i` is 0:
|
||||
* a->e
|
||||
* c->e
|
||||
*
|
||||
* When `i` is 1:
|
||||
* b->f
|
||||
* d->f
|
||||
*/
|
||||
for (let i = 0, length = Math.floor(currentSegments.length / 2); i < length; ++i) {
|
||||
merged.push(CodePathSegment.newNext(
|
||||
context.idGenerator.next(),
|
||||
[currentSegments[i], currentSegments[i + length]]
|
||||
));
|
||||
}
|
||||
|
||||
/*
|
||||
* Go through the loop condition one more time to see if we have the
|
||||
* number of segments for the context. If not, we'll keep merging paths
|
||||
* of the merged segments until we get there.
|
||||
*/
|
||||
currentSegments = merged;
|
||||
}
|
||||
|
||||
return currentSegments;
|
||||
}
|
||||
|
||||
@@ -93,25 +154,55 @@ function mergeExtraSegments(context, segments) {
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A class to manage forking.
|
||||
* Manages the forking of code paths.
|
||||
*/
|
||||
class ForkContext {
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
* @param {IdGenerator} idGenerator An identifier generator for segments.
|
||||
* @param {ForkContext|null} upper An upper fork context.
|
||||
* @param {number} count A number of parallel segments.
|
||||
* @param {ForkContext|null} upper The preceding fork context.
|
||||
* @param {number} count The number of parallel segments in each element
|
||||
* of `segmentsList`.
|
||||
*/
|
||||
constructor(idGenerator, upper, count) {
|
||||
|
||||
/**
|
||||
* The ID generator that will generate segment IDs for any new
|
||||
* segments that are created.
|
||||
* @type {IdGenerator}
|
||||
*/
|
||||
this.idGenerator = idGenerator;
|
||||
|
||||
/**
|
||||
* The preceding fork context.
|
||||
* @type {ForkContext|null}
|
||||
*/
|
||||
this.upper = upper;
|
||||
|
||||
/**
|
||||
* The number of elements in each element of `segmentsList`. In most
|
||||
* cases, this is 1 but can be 2 when there is a `finally` present,
|
||||
* which forks the code path outside of normal flow. In the case of nested
|
||||
* `finally` blocks, this can be a multiple of 2.
|
||||
* @type {number}
|
||||
*/
|
||||
this.count = count;
|
||||
|
||||
/**
|
||||
* The segments within this context. Each element in this array has
|
||||
* `count` elements that represent one step in each fork. For example,
|
||||
* when `segmentsList` is `[[a, b], [c, d], [e, f]]`, there is one path
|
||||
* a->c->e and one path b->d->f, and `count` is 2 because each element
|
||||
* is an array with two elements.
|
||||
* @type {Array<Array<CodePathSegment>>}
|
||||
*/
|
||||
this.segmentsList = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* The head segments.
|
||||
* @type {CodePathSegment[]}
|
||||
* The segments that begin this fork context.
|
||||
* @type {Array<CodePathSegment>}
|
||||
*/
|
||||
get head() {
|
||||
const list = this.segmentsList;
|
||||
@@ -120,7 +211,7 @@ class ForkContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag which shows empty.
|
||||
* Indicates if the context contains no segments.
|
||||
* @type {boolean}
|
||||
*/
|
||||
get empty() {
|
||||
@@ -128,7 +219,7 @@ class ForkContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag which shows reachable.
|
||||
* Indicates if there are any segments that are reachable.
|
||||
* @type {boolean}
|
||||
*/
|
||||
get reachable() {
|
||||
@@ -138,75 +229,82 @@ class ForkContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new segments from this context.
|
||||
* @param {number} begin The first index of previous segments.
|
||||
* @param {number} end The last index of previous segments.
|
||||
* @returns {CodePathSegment[]} New segments.
|
||||
* Creates new segments in this context and appends them to the end of the
|
||||
* already existing `CodePathSegment`s specified by `startIndex` and
|
||||
* `endIndex`.
|
||||
* @param {number} startIndex The index of the first segment in the context
|
||||
* that should be specified as previous segments for the newly created segments.
|
||||
* @param {number} endIndex The index of the last segment in the context
|
||||
* that should be specified as previous segments for the newly created segments.
|
||||
* @returns {Array<CodePathSegment>} An array of the newly created segments.
|
||||
*/
|
||||
makeNext(begin, end) {
|
||||
return makeSegments(this, begin, end, CodePathSegment.newNext);
|
||||
makeNext(startIndex, endIndex) {
|
||||
return createSegments(this, startIndex, endIndex, CodePathSegment.newNext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new segments from this context.
|
||||
* The new segments is always unreachable.
|
||||
* @param {number} begin The first index of previous segments.
|
||||
* @param {number} end The last index of previous segments.
|
||||
* @returns {CodePathSegment[]} New segments.
|
||||
* Creates new unreachable segments in this context and appends them to the end of the
|
||||
* already existing `CodePathSegment`s specified by `startIndex` and
|
||||
* `endIndex`.
|
||||
* @param {number} startIndex The index of the first segment in the context
|
||||
* that should be specified as previous segments for the newly created segments.
|
||||
* @param {number} endIndex The index of the last segment in the context
|
||||
* that should be specified as previous segments for the newly created segments.
|
||||
* @returns {Array<CodePathSegment>} An array of the newly created segments.
|
||||
*/
|
||||
makeUnreachable(begin, end) {
|
||||
return makeSegments(this, begin, end, CodePathSegment.newUnreachable);
|
||||
makeUnreachable(startIndex, endIndex) {
|
||||
return createSegments(this, startIndex, endIndex, CodePathSegment.newUnreachable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new segments from this context.
|
||||
* The new segments don't have connections for previous segments.
|
||||
* But these inherit the reachable flag from this context.
|
||||
* @param {number} begin The first index of previous segments.
|
||||
* @param {number} end The last index of previous segments.
|
||||
* @returns {CodePathSegment[]} New segments.
|
||||
* Creates new segments in this context and does not append them to the end
|
||||
* of the already existing `CodePathSegment`s specified by `startIndex` and
|
||||
* `endIndex`. The `startIndex` and `endIndex` are only used to determine if
|
||||
* the new segments should be reachable. If any of the segments in this range
|
||||
* are reachable then the new segments are also reachable; otherwise, the new
|
||||
* segments are unreachable.
|
||||
* @param {number} startIndex The index of the first segment in the context
|
||||
* that should be considered for reachability.
|
||||
* @param {number} endIndex The index of the last segment in the context
|
||||
* that should be considered for reachability.
|
||||
* @returns {Array<CodePathSegment>} An array of the newly created segments.
|
||||
*/
|
||||
makeDisconnected(begin, end) {
|
||||
return makeSegments(this, begin, end, CodePathSegment.newDisconnected);
|
||||
makeDisconnected(startIndex, endIndex) {
|
||||
return createSegments(this, startIndex, endIndex, CodePathSegment.newDisconnected);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds segments into this context.
|
||||
* The added segments become the head.
|
||||
* @param {CodePathSegment[]} segments Segments to add.
|
||||
* Adds segments to the head of this context.
|
||||
* @param {Array<CodePathSegment>} segments The segments to add.
|
||||
* @returns {void}
|
||||
*/
|
||||
add(segments) {
|
||||
assert(segments.length >= this.count, `${segments.length} >= ${this.count}`);
|
||||
|
||||
this.segmentsList.push(mergeExtraSegments(this, segments));
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the head segments with given segments.
|
||||
* Replaces the head segments with the given segments.
|
||||
* The current head segments are removed.
|
||||
* @param {CodePathSegment[]} segments Segments to add.
|
||||
* @param {Array<CodePathSegment>} replacementHeadSegments The new head segments.
|
||||
* @returns {void}
|
||||
*/
|
||||
replaceHead(segments) {
|
||||
assert(segments.length >= this.count, `${segments.length} >= ${this.count}`);
|
||||
|
||||
this.segmentsList.splice(-1, 1, mergeExtraSegments(this, segments));
|
||||
replaceHead(replacementHeadSegments) {
|
||||
assert(
|
||||
replacementHeadSegments.length >= this.count,
|
||||
`${replacementHeadSegments.length} >= ${this.count}`
|
||||
);
|
||||
this.segmentsList.splice(-1, 1, mergeExtraSegments(this, replacementHeadSegments));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds all segments of a given fork context into this context.
|
||||
* @param {ForkContext} context A fork context to add.
|
||||
* @param {ForkContext} otherForkContext The fork context to add from.
|
||||
* @returns {void}
|
||||
*/
|
||||
addAll(context) {
|
||||
assert(context.count === this.count);
|
||||
|
||||
const source = context.segmentsList;
|
||||
|
||||
for (let i = 0; i < source.length; ++i) {
|
||||
this.segmentsList.push(source[i]);
|
||||
}
|
||||
addAll(otherForkContext) {
|
||||
assert(otherForkContext.count === this.count);
|
||||
this.segmentsList.push(...otherForkContext.segmentsList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -218,7 +316,8 @@ class ForkContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the root fork context.
|
||||
* Creates a new root context, meaning that there are no parent
|
||||
* fork contexts.
|
||||
* @param {IdGenerator} idGenerator An identifier generator for segments.
|
||||
* @returns {ForkContext} New fork context.
|
||||
*/
|
||||
@@ -233,14 +332,16 @@ class ForkContext {
|
||||
/**
|
||||
* Creates an empty fork context preceded by a given context.
|
||||
* @param {ForkContext} parentContext The parent fork context.
|
||||
* @param {boolean} forkLeavingPath A flag which shows inside of `finally` block.
|
||||
* @param {boolean} shouldForkLeavingPath Indicates that we are inside of
|
||||
* a `finally` block and should therefore fork the path that leaves
|
||||
* `finally`.
|
||||
* @returns {ForkContext} New fork context.
|
||||
*/
|
||||
static newEmpty(parentContext, forkLeavingPath) {
|
||||
static newEmpty(parentContext, shouldForkLeavingPath) {
|
||||
return new ForkContext(
|
||||
parentContext.idGenerator,
|
||||
parentContext,
|
||||
(forkLeavingPath ? 2 : 1) * parentContext.count
|
||||
(shouldForkLeavingPath ? 2 : 1) * parentContext.count
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
2
node_modules/eslint/lib/linter/config-comment-parser.js
generated
vendored
2
node_modules/eslint/lib/linter/config-comment-parser.js
generated
vendored
@@ -139,7 +139,7 @@ module.exports = class ConfigCommentParser {
|
||||
const items = {};
|
||||
|
||||
string.split(",").forEach(name => {
|
||||
const trimmedName = name.trim();
|
||||
const trimmedName = name.trim().replace(/^(?<quote>['"]?)(?<ruleId>.*)\k<quote>$/us, "$<ruleId>");
|
||||
|
||||
if (trimmedName) {
|
||||
items[trimmedName] = true;
|
||||
|
||||
13
node_modules/eslint/lib/options.js
generated
vendored
13
node_modules/eslint/lib/options.js
generated
vendored
@@ -55,6 +55,7 @@ const optionator = require("optionator");
|
||||
* @property {string} [stdinFilename] Specify filename to process STDIN as
|
||||
* @property {boolean} quiet Report errors only
|
||||
* @property {boolean} [version] Output the version number
|
||||
* @property {boolean} warnIgnored Show warnings when the file list includes ignored files
|
||||
* @property {string[]} _ Positional filenames or patterns
|
||||
*/
|
||||
|
||||
@@ -139,6 +140,17 @@ module.exports = function(usingFlatConfig) {
|
||||
};
|
||||
}
|
||||
|
||||
let warnIgnoredFlag;
|
||||
|
||||
if (usingFlatConfig) {
|
||||
warnIgnoredFlag = {
|
||||
option: "warn-ignored",
|
||||
type: "Boolean",
|
||||
default: "true",
|
||||
description: "Suppress warnings when the file list includes ignored files"
|
||||
};
|
||||
}
|
||||
|
||||
return optionator({
|
||||
prepend: "eslint [options] file.js [file.js] [dir]",
|
||||
defaults: {
|
||||
@@ -349,6 +361,7 @@ module.exports = function(usingFlatConfig) {
|
||||
default: "false",
|
||||
description: "Exit with exit code 2 in case of fatal error"
|
||||
},
|
||||
warnIgnoredFlag,
|
||||
{
|
||||
option: "debug",
|
||||
type: "Boolean",
|
||||
|
||||
34
node_modules/eslint/lib/rules/logical-assignment-operators.js
generated
vendored
34
node_modules/eslint/lib/rules/logical-assignment-operators.js
generated
vendored
@@ -150,6 +150,31 @@ function isInsideWithBlock(node) {
|
||||
return node.parent.type === "WithStatement" && node.parent.body === node ? true : isInsideWithBlock(node.parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the leftmost operand of a consecutive logical expression.
|
||||
* @param {SourceCode} sourceCode The ESLint source code object
|
||||
* @param {LogicalExpression} node LogicalExpression
|
||||
* @returns {Expression} Leftmost operand
|
||||
*/
|
||||
function getLeftmostOperand(sourceCode, node) {
|
||||
let left = node.left;
|
||||
|
||||
while (left.type === "LogicalExpression" && left.operator === node.operator) {
|
||||
|
||||
if (astUtils.isParenthesised(sourceCode, left)) {
|
||||
|
||||
/*
|
||||
* It should have associativity,
|
||||
* but ignore it if use parentheses to make the evaluation order clear.
|
||||
*/
|
||||
return left;
|
||||
}
|
||||
left = left.left;
|
||||
}
|
||||
return left;
|
||||
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -318,7 +343,10 @@ module.exports = {
|
||||
|
||||
// foo = foo || bar
|
||||
"AssignmentExpression[operator='='][right.type='LogicalExpression']"(assignment) {
|
||||
if (!astUtils.isSameReference(assignment.left, assignment.right.left)) {
|
||||
const leftOperand = getLeftmostOperand(sourceCode, assignment.right);
|
||||
|
||||
if (!astUtils.isSameReference(assignment.left, leftOperand)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -342,10 +370,10 @@ module.exports = {
|
||||
yield ruleFixer.insertTextBefore(assignmentOperatorToken, assignment.right.operator);
|
||||
|
||||
// -> foo ||= bar
|
||||
const logicalOperatorToken = getOperatorToken(assignment.right);
|
||||
const logicalOperatorToken = getOperatorToken(leftOperand.parent);
|
||||
const firstRightOperandToken = sourceCode.getTokenAfter(logicalOperatorToken);
|
||||
|
||||
yield ruleFixer.removeRange([assignment.right.range[0], firstRightOperandToken.range[0]]);
|
||||
yield ruleFixer.removeRange([leftOperand.parent.range[0], firstRightOperandToken.range[0]]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
4
node_modules/eslint/package.json
generated
vendored
4
node_modules/eslint/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "eslint",
|
||||
"version": "8.50.0",
|
||||
"version": "8.51.0",
|
||||
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
||||
"description": "An AST-based pattern checker for JavaScript.",
|
||||
"bin": {
|
||||
@@ -63,7 +63,7 @@
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
"@eslint/eslintrc": "^2.1.2",
|
||||
"@eslint/js": "8.50.0",
|
||||
"@eslint/js": "8.51.0",
|
||||
"@humanwhocodes/config-array": "^0.11.11",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
|
||||
18
node_modules/sinon/CONTRIBUTING.md
generated
vendored
18
node_modules/sinon/CONTRIBUTING.md
generated
vendored
@@ -104,6 +104,22 @@ $ npm run prettier:write
|
||||
|
||||
To ensure consistent reporting of lint warnings, you should use the same versions of ESLint and Prettier as defined in `package.json` (which is what the CI servers use).
|
||||
|
||||
### Tooling
|
||||
|
||||
To transparently handle all issues with different tool versions we recommend using [_ASDF: The Multiple Runtime Manager_][asdf]. You would then need the Ruby and Node plugins.
|
||||
|
||||
<details>
|
||||
|
||||
```
|
||||
asdf plugin add ruby
|
||||
asdf plugin add nodejs
|
||||
asdf install
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
[asdf]: https://asdf-vm.com
|
||||
|
||||
### Run the tests
|
||||
|
||||
Following command runs unit tests in PhantomJS, Node and WebWorker
|
||||
@@ -133,4 +149,4 @@ Build requires Node. Under the hood [Browserify](http://browserify.org/) is used
|
||||
|
||||
To build run
|
||||
|
||||
$ node build.js
|
||||
$ node build.cjs
|
||||
|
||||
112
node_modules/sinon/lib/sinon/sandbox.js
generated
vendored
112
node_modules/sinon/lib/sinon/sandbox.js
generated
vendored
@@ -35,6 +35,40 @@ function applyOnEach(fakes, method) {
|
||||
});
|
||||
}
|
||||
|
||||
function throwOnAccessors(descriptor) {
|
||||
if (typeof descriptor.get === "function") {
|
||||
throw new Error("Use sandbox.replaceGetter for replacing getters");
|
||||
}
|
||||
|
||||
if (typeof descriptor.set === "function") {
|
||||
throw new Error("Use sandbox.replaceSetter for replacing setters");
|
||||
}
|
||||
}
|
||||
|
||||
function verifySameType(object, property, replacement) {
|
||||
if (typeof object[property] !== typeof replacement) {
|
||||
throw new TypeError(
|
||||
`Cannot replace ${typeof object[
|
||||
property
|
||||
]} with ${typeof replacement}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function checkForValidArguments(descriptor, property, replacement) {
|
||||
if (typeof descriptor === "undefined") {
|
||||
throw new TypeError(
|
||||
`Cannot replace non-existent property ${valueToString(
|
||||
property
|
||||
)}. Perhaps you meant sandbox.define()?`
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof replacement === "undefined") {
|
||||
throw new TypeError("Expected replacement argument to be defined");
|
||||
}
|
||||
}
|
||||
|
||||
function Sandbox() {
|
||||
const sandbox = this;
|
||||
let fakeRestorers = [];
|
||||
@@ -66,11 +100,6 @@ function Sandbox() {
|
||||
return collection;
|
||||
};
|
||||
|
||||
// this is for testing only
|
||||
sandbox.getRestorers = function () {
|
||||
return fakeRestorers;
|
||||
};
|
||||
|
||||
sandbox.createStubInstance = function createStubInstance() {
|
||||
const stubbed = sinonCreateStubInstance.apply(null, arguments);
|
||||
|
||||
@@ -196,11 +225,22 @@ function Sandbox() {
|
||||
sandbox.injectedKeys.length = 0;
|
||||
};
|
||||
|
||||
function getFakeRestorer(object, property) {
|
||||
/**
|
||||
* Creates a restorer function for the property
|
||||
*
|
||||
* @param {object|Function} object
|
||||
* @param {string} property
|
||||
* @param {boolean} forceAssignment
|
||||
* @returns {Function} restorer function
|
||||
*/
|
||||
function getFakeRestorer(object, property, forceAssignment = false) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
const value = object[property];
|
||||
|
||||
function restorer() {
|
||||
if (descriptor?.isOwn) {
|
||||
if (forceAssignment) {
|
||||
object[property] = value;
|
||||
} else if (descriptor?.isOwn) {
|
||||
Object.defineProperty(object, property, descriptor);
|
||||
} else {
|
||||
delete object[property];
|
||||
@@ -225,36 +265,19 @@ function Sandbox() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace an existing property
|
||||
*
|
||||
* @param {object|Function} object
|
||||
* @param {string} property
|
||||
* @param {*} replacement a fake, stub, spy or any other value
|
||||
* @returns {*}
|
||||
*/
|
||||
sandbox.replace = function replace(object, property, replacement) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
|
||||
if (typeof descriptor === "undefined") {
|
||||
throw new TypeError(
|
||||
`Cannot replace non-existent property ${valueToString(
|
||||
property
|
||||
)}. Perhaps you meant sandbox.define()?`
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof replacement === "undefined") {
|
||||
throw new TypeError("Expected replacement argument to be defined");
|
||||
}
|
||||
|
||||
if (typeof descriptor.get === "function") {
|
||||
throw new Error("Use sandbox.replaceGetter for replacing getters");
|
||||
}
|
||||
|
||||
if (typeof descriptor.set === "function") {
|
||||
throw new Error("Use sandbox.replaceSetter for replacing setters");
|
||||
}
|
||||
|
||||
if (typeof object[property] !== typeof replacement) {
|
||||
throw new TypeError(
|
||||
`Cannot replace ${typeof object[
|
||||
property
|
||||
]} with ${typeof replacement}`
|
||||
);
|
||||
}
|
||||
checkForValidArguments(descriptor, property, replacement);
|
||||
throwOnAccessors(descriptor);
|
||||
verifySameType(object, property, replacement);
|
||||
|
||||
verifyNotReplaced(object, property);
|
||||
|
||||
@@ -266,6 +289,25 @@ function Sandbox() {
|
||||
return replacement;
|
||||
};
|
||||
|
||||
sandbox.replace.usingAccessor = function replaceUsingAccessor(
|
||||
object,
|
||||
property,
|
||||
replacement
|
||||
) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
checkForValidArguments(descriptor, property, replacement);
|
||||
verifySameType(object, property, replacement);
|
||||
|
||||
verifyNotReplaced(object, property);
|
||||
|
||||
// store a function for restoring the replaced property
|
||||
push(fakeRestorers, getFakeRestorer(object, property, true));
|
||||
|
||||
object[property] = replacement;
|
||||
|
||||
return replacement;
|
||||
};
|
||||
|
||||
sandbox.define = function define(object, property, value) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
|
||||
|
||||
7
node_modules/sinon/package.json
generated
vendored
7
node_modules/sinon/package.json
generated
vendored
@@ -15,7 +15,7 @@
|
||||
"xhr",
|
||||
"assert"
|
||||
],
|
||||
"version": "16.0.0",
|
||||
"version": "16.1.0",
|
||||
"homepage": "https://sinonjs.org/",
|
||||
"author": "Christian Johansen",
|
||||
"repository": {
|
||||
@@ -44,9 +44,10 @@
|
||||
"test": "npm run test-node && npm run test-headless && npm run test-webworker",
|
||||
"check-dependencies": "dependency-check package.json --no-dev --ignore-module esm",
|
||||
"build": "node ./build.cjs",
|
||||
"dev-docs": "cd docs; cp -rl release-source releases/dev; npm run serve-docs",
|
||||
"build-docs": "cd docs; bundle exec jekyll build",
|
||||
"serve-docs": "cd docs; bundle exec jekyll serve --incremental --verbose",
|
||||
"lint": "eslint --max-warnings 99 '**/*.{js,cjs,mjs}'",
|
||||
"serve-docs": "cd docs; bundle exec jekyll serve --incremental --verbose --livereload",
|
||||
"lint": "eslint --max-warnings 101 '**/*.{js,cjs,mjs}'",
|
||||
"unimported": "unimported .",
|
||||
"pretest-webworker": "npm run build",
|
||||
"prebuild": "rimraf pkg && npm run check-dependencies",
|
||||
|
||||
116
node_modules/sinon/pkg/sinon-esm.js
generated
vendored
116
node_modules/sinon/pkg/sinon-esm.js
generated
vendored
@@ -1,4 +1,4 @@
|
||||
/* Sinon.JS 16.0.0, 2023-09-13, @license BSD-3 */let sinon;(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||
/* Sinon.JS 16.1.0, 2023-10-05, @license BSD-3 */let sinon;(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||
"use strict";
|
||||
// eslint-disable-next-line no-undef
|
||||
sinon = require("./sinon");
|
||||
@@ -2898,6 +2898,40 @@ function applyOnEach(fakes, method) {
|
||||
});
|
||||
}
|
||||
|
||||
function throwOnAccessors(descriptor) {
|
||||
if (typeof descriptor.get === "function") {
|
||||
throw new Error("Use sandbox.replaceGetter for replacing getters");
|
||||
}
|
||||
|
||||
if (typeof descriptor.set === "function") {
|
||||
throw new Error("Use sandbox.replaceSetter for replacing setters");
|
||||
}
|
||||
}
|
||||
|
||||
function verifySameType(object, property, replacement) {
|
||||
if (typeof object[property] !== typeof replacement) {
|
||||
throw new TypeError(
|
||||
`Cannot replace ${typeof object[
|
||||
property
|
||||
]} with ${typeof replacement}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function checkForValidArguments(descriptor, property, replacement) {
|
||||
if (typeof descriptor === "undefined") {
|
||||
throw new TypeError(
|
||||
`Cannot replace non-existent property ${valueToString(
|
||||
property
|
||||
)}. Perhaps you meant sandbox.define()?`
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof replacement === "undefined") {
|
||||
throw new TypeError("Expected replacement argument to be defined");
|
||||
}
|
||||
}
|
||||
|
||||
function Sandbox() {
|
||||
const sandbox = this;
|
||||
let fakeRestorers = [];
|
||||
@@ -2929,11 +2963,6 @@ function Sandbox() {
|
||||
return collection;
|
||||
};
|
||||
|
||||
// this is for testing only
|
||||
sandbox.getRestorers = function () {
|
||||
return fakeRestorers;
|
||||
};
|
||||
|
||||
sandbox.createStubInstance = function createStubInstance() {
|
||||
const stubbed = sinonCreateStubInstance.apply(null, arguments);
|
||||
|
||||
@@ -3059,11 +3088,22 @@ function Sandbox() {
|
||||
sandbox.injectedKeys.length = 0;
|
||||
};
|
||||
|
||||
function getFakeRestorer(object, property) {
|
||||
/**
|
||||
* Creates a restorer function for the property
|
||||
*
|
||||
* @param {object|Function} object
|
||||
* @param {string} property
|
||||
* @param {boolean} forceAssignment
|
||||
* @returns {Function} restorer function
|
||||
*/
|
||||
function getFakeRestorer(object, property, forceAssignment = false) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
const value = object[property];
|
||||
|
||||
function restorer() {
|
||||
if (descriptor?.isOwn) {
|
||||
if (forceAssignment) {
|
||||
object[property] = value;
|
||||
} else if (descriptor?.isOwn) {
|
||||
Object.defineProperty(object, property, descriptor);
|
||||
} else {
|
||||
delete object[property];
|
||||
@@ -3088,36 +3128,19 @@ function Sandbox() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace an existing property
|
||||
*
|
||||
* @param {object|Function} object
|
||||
* @param {string} property
|
||||
* @param {*} replacement a fake, stub, spy or any other value
|
||||
* @returns {*}
|
||||
*/
|
||||
sandbox.replace = function replace(object, property, replacement) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
|
||||
if (typeof descriptor === "undefined") {
|
||||
throw new TypeError(
|
||||
`Cannot replace non-existent property ${valueToString(
|
||||
property
|
||||
)}. Perhaps you meant sandbox.define()?`
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof replacement === "undefined") {
|
||||
throw new TypeError("Expected replacement argument to be defined");
|
||||
}
|
||||
|
||||
if (typeof descriptor.get === "function") {
|
||||
throw new Error("Use sandbox.replaceGetter for replacing getters");
|
||||
}
|
||||
|
||||
if (typeof descriptor.set === "function") {
|
||||
throw new Error("Use sandbox.replaceSetter for replacing setters");
|
||||
}
|
||||
|
||||
if (typeof object[property] !== typeof replacement) {
|
||||
throw new TypeError(
|
||||
`Cannot replace ${typeof object[
|
||||
property
|
||||
]} with ${typeof replacement}`
|
||||
);
|
||||
}
|
||||
checkForValidArguments(descriptor, property, replacement);
|
||||
throwOnAccessors(descriptor);
|
||||
verifySameType(object, property, replacement);
|
||||
|
||||
verifyNotReplaced(object, property);
|
||||
|
||||
@@ -3129,6 +3152,25 @@ function Sandbox() {
|
||||
return replacement;
|
||||
};
|
||||
|
||||
sandbox.replace.usingAccessor = function replaceUsingAccessor(
|
||||
object,
|
||||
property,
|
||||
replacement
|
||||
) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
checkForValidArguments(descriptor, property, replacement);
|
||||
verifySameType(object, property, replacement);
|
||||
|
||||
verifyNotReplaced(object, property);
|
||||
|
||||
// store a function for restoring the replaced property
|
||||
push(fakeRestorers, getFakeRestorer(object, property, true));
|
||||
|
||||
object[property] = replacement;
|
||||
|
||||
return replacement;
|
||||
};
|
||||
|
||||
sandbox.define = function define(object, property, value) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
|
||||
@@ -17797,8 +17839,6 @@ const _serverPrototype = sinon.serverPrototype;
|
||||
export { _serverPrototype as serverPrototype };
|
||||
const _getFakes = sinon.getFakes;
|
||||
export { _getFakes as getFakes };
|
||||
const _getRestorers = sinon.getRestorers;
|
||||
export { _getRestorers as getRestorers };
|
||||
const _createStubInstance = sinon.createStubInstance;
|
||||
export { _createStubInstance as createStubInstance };
|
||||
const _inject = sinon.inject;
|
||||
|
||||
114
node_modules/sinon/pkg/sinon-no-sourcemaps.cjs
generated
vendored
114
node_modules/sinon/pkg/sinon-no-sourcemaps.cjs
generated
vendored
@@ -1,4 +1,4 @@
|
||||
/* Sinon.JS 16.0.0, 2023-09-13, @license BSD-3 */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.sinon = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||
/* Sinon.JS 16.1.0, 2023-10-05, @license BSD-3 */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.sinon = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
const behavior = require("./sinon/behavior");
|
||||
@@ -2893,6 +2893,40 @@ function applyOnEach(fakes, method) {
|
||||
});
|
||||
}
|
||||
|
||||
function throwOnAccessors(descriptor) {
|
||||
if (typeof descriptor.get === "function") {
|
||||
throw new Error("Use sandbox.replaceGetter for replacing getters");
|
||||
}
|
||||
|
||||
if (typeof descriptor.set === "function") {
|
||||
throw new Error("Use sandbox.replaceSetter for replacing setters");
|
||||
}
|
||||
}
|
||||
|
||||
function verifySameType(object, property, replacement) {
|
||||
if (typeof object[property] !== typeof replacement) {
|
||||
throw new TypeError(
|
||||
`Cannot replace ${typeof object[
|
||||
property
|
||||
]} with ${typeof replacement}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function checkForValidArguments(descriptor, property, replacement) {
|
||||
if (typeof descriptor === "undefined") {
|
||||
throw new TypeError(
|
||||
`Cannot replace non-existent property ${valueToString(
|
||||
property
|
||||
)}. Perhaps you meant sandbox.define()?`
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof replacement === "undefined") {
|
||||
throw new TypeError("Expected replacement argument to be defined");
|
||||
}
|
||||
}
|
||||
|
||||
function Sandbox() {
|
||||
const sandbox = this;
|
||||
let fakeRestorers = [];
|
||||
@@ -2924,11 +2958,6 @@ function Sandbox() {
|
||||
return collection;
|
||||
};
|
||||
|
||||
// this is for testing only
|
||||
sandbox.getRestorers = function () {
|
||||
return fakeRestorers;
|
||||
};
|
||||
|
||||
sandbox.createStubInstance = function createStubInstance() {
|
||||
const stubbed = sinonCreateStubInstance.apply(null, arguments);
|
||||
|
||||
@@ -3054,11 +3083,22 @@ function Sandbox() {
|
||||
sandbox.injectedKeys.length = 0;
|
||||
};
|
||||
|
||||
function getFakeRestorer(object, property) {
|
||||
/**
|
||||
* Creates a restorer function for the property
|
||||
*
|
||||
* @param {object|Function} object
|
||||
* @param {string} property
|
||||
* @param {boolean} forceAssignment
|
||||
* @returns {Function} restorer function
|
||||
*/
|
||||
function getFakeRestorer(object, property, forceAssignment = false) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
const value = object[property];
|
||||
|
||||
function restorer() {
|
||||
if (descriptor?.isOwn) {
|
||||
if (forceAssignment) {
|
||||
object[property] = value;
|
||||
} else if (descriptor?.isOwn) {
|
||||
Object.defineProperty(object, property, descriptor);
|
||||
} else {
|
||||
delete object[property];
|
||||
@@ -3083,36 +3123,19 @@ function Sandbox() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace an existing property
|
||||
*
|
||||
* @param {object|Function} object
|
||||
* @param {string} property
|
||||
* @param {*} replacement a fake, stub, spy or any other value
|
||||
* @returns {*}
|
||||
*/
|
||||
sandbox.replace = function replace(object, property, replacement) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
|
||||
if (typeof descriptor === "undefined") {
|
||||
throw new TypeError(
|
||||
`Cannot replace non-existent property ${valueToString(
|
||||
property
|
||||
)}. Perhaps you meant sandbox.define()?`
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof replacement === "undefined") {
|
||||
throw new TypeError("Expected replacement argument to be defined");
|
||||
}
|
||||
|
||||
if (typeof descriptor.get === "function") {
|
||||
throw new Error("Use sandbox.replaceGetter for replacing getters");
|
||||
}
|
||||
|
||||
if (typeof descriptor.set === "function") {
|
||||
throw new Error("Use sandbox.replaceSetter for replacing setters");
|
||||
}
|
||||
|
||||
if (typeof object[property] !== typeof replacement) {
|
||||
throw new TypeError(
|
||||
`Cannot replace ${typeof object[
|
||||
property
|
||||
]} with ${typeof replacement}`
|
||||
);
|
||||
}
|
||||
checkForValidArguments(descriptor, property, replacement);
|
||||
throwOnAccessors(descriptor);
|
||||
verifySameType(object, property, replacement);
|
||||
|
||||
verifyNotReplaced(object, property);
|
||||
|
||||
@@ -3124,6 +3147,25 @@ function Sandbox() {
|
||||
return replacement;
|
||||
};
|
||||
|
||||
sandbox.replace.usingAccessor = function replaceUsingAccessor(
|
||||
object,
|
||||
property,
|
||||
replacement
|
||||
) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
checkForValidArguments(descriptor, property, replacement);
|
||||
verifySameType(object, property, replacement);
|
||||
|
||||
verifyNotReplaced(object, property);
|
||||
|
||||
// store a function for restoring the replaced property
|
||||
push(fakeRestorers, getFakeRestorer(object, property, true));
|
||||
|
||||
object[property] = replacement;
|
||||
|
||||
return replacement;
|
||||
};
|
||||
|
||||
sandbox.define = function define(object, property, value) {
|
||||
const descriptor = getPropertyDescriptor(object, property);
|
||||
|
||||
|
||||
116
node_modules/sinon/pkg/sinon.js
generated
vendored
116
node_modules/sinon/pkg/sinon.js
generated
vendored
File diff suppressed because one or more lines are too long
124
package-lock.json
generated
124
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "2.22.0",
|
||||
"version": "2.22.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "codeql",
|
||||
"version": "2.22.0",
|
||||
"version": "2.22.3",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/artifact": "^1.1.2",
|
||||
@@ -20,7 +20,7 @@
|
||||
"@octokit/plugin-retry": "^5.0.2",
|
||||
"@octokit/types": "^12.0.0",
|
||||
"@schemastore/package": "0.0.10",
|
||||
"@types/uuid": "^9.0.4",
|
||||
"@types/uuid": "^9.0.5",
|
||||
"adm-zip": "^0.5.10",
|
||||
"check-disk-space": "^3.4.0",
|
||||
"console-log-level": "^1.4.1",
|
||||
@@ -45,10 +45,10 @@
|
||||
"@types/node": "16.11.22",
|
||||
"@types/semver": "^7.5.3",
|
||||
"@types/sinon": "^10.0.17",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.3",
|
||||
"@typescript-eslint/parser": "^6.7.3",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
||||
"@typescript-eslint/parser": "^6.7.5",
|
||||
"ava": "^5.3.1",
|
||||
"eslint": "^8.50.0",
|
||||
"eslint": "^8.51.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
"eslint-plugin-filenames": "^1.3.2",
|
||||
"eslint-plugin-github": "^4.10.1",
|
||||
@@ -57,7 +57,7 @@
|
||||
"micromatch": "4.0.5",
|
||||
"nock": "^13.3.3",
|
||||
"removeNPMAbsolutePaths": "3.0.1",
|
||||
"sinon": "^16.0.0",
|
||||
"sinon": "^16.1.0",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
},
|
||||
@@ -505,9 +505,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "8.50.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz",
|
||||
"integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==",
|
||||
"version": "8.51.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.51.0.tgz",
|
||||
"integrity": "sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
@@ -991,21 +991,21 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/uuid": {
|
||||
"version": "9.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.4.tgz",
|
||||
"integrity": "sha512-zAuJWQflfx6dYJM62vna+Sn5aeSWhh3OB+wfUEACNcqUSc0AGc5JKl+ycL1vrH7frGTXhJchYjE1Hak8L819dA=="
|
||||
"version": "9.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.5.tgz",
|
||||
"integrity": "sha512-xfHdwa1FMJ082prjSJpoEI57GZITiQz10r3vEJCHa2khEFQjKy91aWKz6+zybzssCvXUwE1LQWgWVwZ4nYUvHQ=="
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.3.tgz",
|
||||
"integrity": "sha512-vntq452UHNltxsaaN+L9WyuMch8bMd9CqJ3zhzTPXXidwbf5mqqKCVXEuvRZUqLJSTLeWE65lQwyXsRGnXkCTA==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.5.tgz",
|
||||
"integrity": "sha512-JhtAwTRhOUcP96D0Y6KYnwig/MRQbOoLGXTON2+LlyB/N35SP9j1boai2zzwXb7ypKELXMx3DVk9UTaEq1vHEw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.5.1",
|
||||
"@typescript-eslint/scope-manager": "6.7.3",
|
||||
"@typescript-eslint/type-utils": "6.7.3",
|
||||
"@typescript-eslint/utils": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
||||
"@typescript-eslint/scope-manager": "6.7.5",
|
||||
"@typescript-eslint/type-utils": "6.7.5",
|
||||
"@typescript-eslint/utils": "6.7.5",
|
||||
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||
"debug": "^4.3.4",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.2.4",
|
||||
@@ -1031,15 +1031,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.3.tgz",
|
||||
"integrity": "sha512-TlutE+iep2o7R8Lf+yoer3zU6/0EAUc8QIBB3GYBc1KGz4c4TRm83xwXUZVPlZ6YCLss4r77jbu6j3sendJoiQ==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.7.5.tgz",
|
||||
"integrity": "sha512-bIZVSGx2UME/lmhLcjdVc7ePBwn7CLqKarUBL4me1C5feOd663liTGjMBGVcGr+BhnSLeP4SgwdvNnnkbIdkCw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "6.7.3",
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
||||
"@typescript-eslint/scope-manager": "6.7.5",
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1059,13 +1059,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz",
|
||||
"integrity": "sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.7.5.tgz",
|
||||
"integrity": "sha512-GAlk3eQIwWOJeb9F7MKQ6Jbah/vx1zETSDw8likab/eFcqkjSD7BI75SDAeC5N2L0MmConMoPvTsmkrg71+B1A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3"
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"@typescript-eslint/visitor-keys": "6.7.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^16.0.0 || >=18.0.0"
|
||||
@@ -1076,13 +1076,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.3.tgz",
|
||||
"integrity": "sha512-Fc68K0aTDrKIBvLnKTZ5Pf3MXK495YErrbHb1R6aTpfK5OdSFj0rVN7ib6Tx6ePrZ2gsjLqr0s98NG7l96KSQw==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.7.5.tgz",
|
||||
"integrity": "sha512-Gs0qos5wqxnQrvpYv+pf3XfcRXW6jiAn9zE/K+DlmYf6FcpxeNYN0AIETaPR7rHO4K2UY+D0CIbDP9Ut0U4m1g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
||||
"@typescript-eslint/utils": "6.7.3",
|
||||
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||
"@typescript-eslint/utils": "6.7.5",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^1.0.1"
|
||||
},
|
||||
@@ -1103,9 +1103,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.3.tgz",
|
||||
"integrity": "sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.7.5.tgz",
|
||||
"integrity": "sha512-WboQBlOXtdj1tDFPyIthpKrUb+kZf2VroLZhxKa/VlwLlLyqv/PwUNgL30BlTVZV1Wu4Asu2mMYPqarSO4L5ZQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^16.0.0 || >=18.0.0"
|
||||
@@ -1116,13 +1116,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz",
|
||||
"integrity": "sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.5.tgz",
|
||||
"integrity": "sha512-NhJiJ4KdtwBIxrKl0BqG1Ur+uw7FiOnOThcYx9DpOGJ/Abc9z2xNzLeirCG02Ig3vkvrc2qFLmYSSsaITbKjlg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/visitor-keys": "6.7.3",
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"@typescript-eslint/visitor-keys": "6.7.5",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
@@ -1143,17 +1143,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.3.tgz",
|
||||
"integrity": "sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.7.5.tgz",
|
||||
"integrity": "sha512-pfRRrH20thJbzPPlPc4j0UNGvH1PjPlhlCMq4Yx7EGjV7lvEeGX0U6MJYe8+SyFutWgSHsdbJ3BXzZccYggezA==",
|
||||
"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.7.3",
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/typescript-estree": "6.7.3",
|
||||
"@typescript-eslint/scope-manager": "6.7.5",
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"@typescript-eslint/typescript-estree": "6.7.5",
|
||||
"semver": "^7.5.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1168,12 +1168,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "6.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz",
|
||||
"integrity": "sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg==",
|
||||
"version": "6.7.5",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.5.tgz",
|
||||
"integrity": "sha512-3MaWdDZtLlsexZzDSdQWsFQ9l9nL8B80Z4fImSpyllFC/KLqWQRdEcB+gGGO+N3Q2uL40EsG66wZLsohPxNXvg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "6.7.3",
|
||||
"@typescript-eslint/types": "6.7.5",
|
||||
"eslint-visitor-keys": "^3.4.1"
|
||||
},
|
||||
"engines": {
|
||||
@@ -2527,15 +2527,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "8.50.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz",
|
||||
"integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==",
|
||||
"version": "8.51.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.51.0.tgz",
|
||||
"integrity": "sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
"@eslint/eslintrc": "^2.1.2",
|
||||
"@eslint/js": "8.50.0",
|
||||
"@eslint/js": "8.51.0",
|
||||
"@humanwhocodes/config-array": "^0.11.11",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
@@ -5502,9 +5502,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/sinon": {
|
||||
"version": "16.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-16.0.0.tgz",
|
||||
"integrity": "sha512-B8AaZZm9CT5pqe4l4uWJztfD/mOTa7dL8Qo0W4+s+t74xECOgSZDDQCBjNgIK3+n4kyxQrSTv2V5ul8K25qkiQ==",
|
||||
"version": "16.1.0",
|
||||
"resolved": "https://registry.npmjs.org/sinon/-/sinon-16.1.0.tgz",
|
||||
"integrity": "sha512-ZSgzF0vwmoa8pq0GEynqfdnpEDyP1PkYmEChnkjW0Vyh8IDlyFEJ+fkMhCP0il6d5cJjPl2PUsnUSAuP5sttOQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^3.0.0",
|
||||
|
||||
12
package.json
12
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "2.22.0",
|
||||
"version": "2.22.3",
|
||||
"private": true,
|
||||
"description": "CodeQL action",
|
||||
"scripts": {
|
||||
@@ -32,7 +32,7 @@
|
||||
"@octokit/plugin-retry": "^5.0.2",
|
||||
"@octokit/types": "^12.0.0",
|
||||
"@schemastore/package": "0.0.10",
|
||||
"@types/uuid": "^9.0.4",
|
||||
"@types/uuid": "^9.0.5",
|
||||
"adm-zip": "^0.5.10",
|
||||
"check-disk-space": "^3.4.0",
|
||||
"console-log-level": "^1.4.1",
|
||||
@@ -60,10 +60,10 @@
|
||||
"@types/node": "16.11.22",
|
||||
"@types/semver": "^7.5.3",
|
||||
"@types/sinon": "^10.0.17",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.3",
|
||||
"@typescript-eslint/parser": "^6.7.3",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.5",
|
||||
"@typescript-eslint/parser": "^6.7.5",
|
||||
"ava": "^5.3.1",
|
||||
"eslint": "^8.50.0",
|
||||
"eslint": "^8.51.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
"eslint-plugin-filenames": "^1.3.2",
|
||||
"eslint-plugin-github": "^4.10.1",
|
||||
@@ -72,7 +72,7 @@
|
||||
"micromatch": "4.0.5",
|
||||
"nock": "^13.3.3",
|
||||
"removeNPMAbsolutePaths": "3.0.1",
|
||||
"sinon": "^16.0.0",
|
||||
"sinon": "^16.1.0",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"overrides": {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
name: "Analyze: 'ref' and 'sha' from inputs"
|
||||
description: "Checks that specifying 'ref' and 'sha' as inputs works"
|
||||
versions: ["default"]
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
name: "Export file baseline information"
|
||||
description: "Tests that file baseline information is exported when the feature is enabled"
|
||||
versions: ["nightly-latest"]
|
||||
env:
|
||||
CODEQL_ACTION_SUBLANGUAGE_FILE_COVERAGE: true
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
id: init
|
||||
with:
|
||||
languages: javascript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
env:
|
||||
CODEQL_FILE_BASELINE_INFORMATION: true
|
||||
- uses: ./../action/.github/actions/setup-swift
|
||||
with:
|
||||
codeql-path: ${{ steps.init.outputs.codeql-path }}
|
||||
@@ -18,8 +18,6 @@ steps:
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: "${{ runner.temp }}/results"
|
||||
env:
|
||||
CODEQL_FILE_BASELINE_INFORMATION: true
|
||||
- name: Upload SARIF
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
@@ -30,13 +28,13 @@ steps:
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
expected_baseline_languages="cpp cs go java js py rb"
|
||||
expected_baseline_languages="c csharp go java kotlin javascript python ruby"
|
||||
if [[ $RUNNER_OS != "Windows" ]]; then
|
||||
expected_baseline_languages+=" swift"
|
||||
fi
|
||||
|
||||
for lang in ${expected_baseline_languages}; do
|
||||
rule_name="${lang}/baseline/expected-extracted-files"
|
||||
rule_name="cli/expected-extracted-files/${lang}"
|
||||
found_notification=$(jq --arg rule_name "${rule_name}" '[.runs[0].tool.driver.notifications |
|
||||
select(. != null) | flatten | .[].id] | any(. == $rule_name)' javascript.sarif)
|
||||
if [[ "${found_notification}" != "true" ]]; then
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
name: "Go: diagnostic when Go is changed after init step"
|
||||
description: "Checks that we emit a diagnostic if Go is changed after the init step"
|
||||
# only Linux is affected
|
||||
operatingSystems: ["ubuntu"]
|
||||
# pinned to a version which does not support statically linked binaries for indirect tracing
|
||||
versions: ["stable-v2.14.6"]
|
||||
steps:
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
# We need a Go version that ships with statically linked binaries on Linux
|
||||
go-version: ">=1.21.0"
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
# Deliberately change Go after the `init` step
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: "1.20"
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: go build main.go
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: "${{ runner.temp }}/results"
|
||||
upload-database: false
|
||||
- name: Check diagnostic appears in SARIF
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
SARIF_PATH: "${{ runner.temp }}/results/go.sarif"
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
|
||||
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
|
||||
const run = sarif.runs[0];
|
||||
|
||||
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
|
||||
const statusPageNotifications = toolExecutionNotifications.filter(n =>
|
||||
n.descriptor.id === 'go/workflow/go-installed-after-codeql-init' && n.properties?.visibility?.statusPage
|
||||
);
|
||||
if (statusPageNotifications.length !== 1) {
|
||||
core.setFailed(
|
||||
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
|
||||
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
|
||||
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
|
||||
`${JSON.stringify(toolExecutionNotifications)}.`
|
||||
);
|
||||
}
|
||||
47
pr-checks/checks/go-indirect-tracing-workaround.yml
Normal file
47
pr-checks/checks/go-indirect-tracing-workaround.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
name: "Go: workaround for indirect tracing"
|
||||
description: "Checks that our workaround for indirect tracing for Go 1.21+ on Linux works"
|
||||
# only Linux is affected
|
||||
operatingSystems: ["ubuntu"]
|
||||
# pinned to a version which does not support statically linked binaries for indirect tracing
|
||||
versions: ["stable-v2.14.6"]
|
||||
steps:
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
# We need a Go version that ships with statically linked binaries on Linux
|
||||
go-version: ">=1.21.0"
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: go build main.go
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
upload-database: false
|
||||
- shell: bash
|
||||
run: |
|
||||
if [[ -z "${CODEQL_ACTION_GO_BINARY}" ]]; then
|
||||
echo "Expected the workaround for indirect tracing of static binaries to trigger, but the" \
|
||||
"CODEQL_ACTION_GO_BINARY environment variable is not set."
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${CODEQL_ACTION_GO_BINARY}" ]]; then
|
||||
echo "CODEQL_ACTION_GO_BINARY is set, but the corresponding script does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Once we start running Bash 4.2 in all environments, we can replace the
|
||||
# `! -z` flag with the more elegant `-v` which confirms that the variable
|
||||
# is actually unset and not potentially set to a blank value.
|
||||
if [[ ! -z "${CODEQL_ACTION_DID_AUTOBUILD_GOLANG}" ]]; then
|
||||
echo "Expected the Go autobuilder not to be run, but the" \
|
||||
"CODEQL_ACTION_DID_AUTOBUILD_GOLANG environment variable was set."
|
||||
exit 1
|
||||
fi
|
||||
cd "$RUNNER_TEMP/codeql_databases"
|
||||
if [[ ! -d go ]]; then
|
||||
echo "Did not find a Go database"
|
||||
exit 1
|
||||
fi
|
||||
@@ -4,6 +4,9 @@ operatingSystems: ["ubuntu", "macos"]
|
||||
env:
|
||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
|
||||
steps:
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: "~1.21.1"
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
|
||||
@@ -2,6 +2,9 @@ name: "Go: tracing with custom build steps"
|
||||
description: "Checks that Go tracing traces the build when using custom build steps"
|
||||
operatingSystems: ["ubuntu", "macos"]
|
||||
steps:
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: "~1.21.1"
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
|
||||
@@ -4,6 +4,9 @@ operatingSystems: ["ubuntu", "macos"]
|
||||
env:
|
||||
DOTNET_GENERATE_ASPNET_CERTIFICATE: "false"
|
||||
steps:
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: "~1.21.1"
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
name: "Resolve environment"
|
||||
description: "Tests that the resolve-environment action works for Go"
|
||||
versions: ["stable-v2.13.4"]
|
||||
description: "Tests that the resolve-environment action works for Go and JavaScript/TypeScript"
|
||||
versions: ["stable-v2.13.4", "default", "latest", "nightly-latest"]
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
languages: ${{ matrix.version == 'stable-v2.13.4' && 'go' || 'go,javascript-typescript' }}
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
|
||||
- uses: ./../action/resolve-environment
|
||||
id: resolve-environment
|
||||
- name: Resolve environment for Go
|
||||
uses: ./../action/resolve-environment
|
||||
id: resolve-environment-go
|
||||
with:
|
||||
language: go
|
||||
|
||||
- name: "Fail if no Go configuration was returned"
|
||||
if: (!fromJSON(steps.resolve-environment.outputs.environment).configuration.go)
|
||||
- name: Fail if Go configuration missing
|
||||
if: (!fromJSON(steps.resolve-environment-go.outputs.environment).configuration.go)
|
||||
run: exit 1
|
||||
|
||||
- name: Resolve environment for JavaScript/TypeScript
|
||||
if: matrix.version != 'stable-v2.13.4'
|
||||
uses: ./../action/resolve-environment
|
||||
id: resolve-environment-js
|
||||
with:
|
||||
language: javascript-typescript
|
||||
|
||||
- name: Fail if JavaScript/TypeScript configuration present
|
||||
if: matrix.version != 'stable-v2.13.4' && fromJSON(steps.resolve-environment-js.outputs.environment).configuration.javascript
|
||||
run: exit 1
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
name: "Upload-sarif: 'ref' and 'sha' from inputs"
|
||||
description: "Checks that specifying 'ref' and 'sha' as inputs works"
|
||||
versions: ["default"]
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
|
||||
19
python-setup/check_python12.ps1
Normal file
19
python-setup/check_python12.ps1
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
#! /usr/bin/pwsh
|
||||
|
||||
# If we are running greater than or equal to python 3.12, change py to run version 3.11
|
||||
Write-Host "Checking python version"
|
||||
if ((py -3 -c "import sys; print(0 if sys.version_info >= (3, 12) else 1)") -eq "0") {
|
||||
Write-Host "python 3.12+ detected, setting PY_PYTHON3=3.11"
|
||||
# First make sure we have python 3.11 installed
|
||||
py -3.11 -c "import imp"
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "python 3.11 detected, using this version instead of 3.12+."
|
||||
Write-Output "PY_PYTHON3=3.11" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
|
||||
} else {
|
||||
Write-Host "FAILURE: Python 3.12+ is not supported, and Python 3.11 could not be detected on the system. Please install Python 3.11."
|
||||
exit 1
|
||||
}
|
||||
} else {
|
||||
Write-Host "python 3.12+ not detected, not making any changes."
|
||||
}
|
||||
@@ -425,3 +425,39 @@ export function getWorkflowRunAttempt(): number {
|
||||
}
|
||||
return workflowRunAttempt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to obtain the output of the `file` command for the file at the specified path.
|
||||
* The output will vary depending on the type of `file`, which operating system we are running on, etc.
|
||||
*/
|
||||
export const getFileType = async (filePath: string): Promise<string> => {
|
||||
let stderr = "";
|
||||
let stdout = "";
|
||||
try {
|
||||
// The `file` command will output information about the type of file pointed at by `filePath`.
|
||||
// For binary files, this may include e.g. whether they are static of dynamic binaries.
|
||||
// The `-L` switch instructs the command to follow symbolic links.
|
||||
await new toolrunner.ToolRunner(
|
||||
await safeWhich.safeWhich("file"),
|
||||
["-L", filePath],
|
||||
{
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
stdout += data.toString();
|
||||
},
|
||||
stderr: (data) => {
|
||||
stderr += data.toString();
|
||||
},
|
||||
},
|
||||
},
|
||||
).exec();
|
||||
return stdout.trim();
|
||||
} catch (e) {
|
||||
core.info(
|
||||
`Could not determine type of ${filePath} from ${stdout}. ${stderr}`,
|
||||
);
|
||||
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@ import path from "path";
|
||||
import { performance } from "perf_hooks";
|
||||
|
||||
import * as core from "@actions/core";
|
||||
import { safeWhich } from "@chrisgavin/safe-which";
|
||||
|
||||
import * as actionsUtil from "./actions-util";
|
||||
import {
|
||||
@@ -18,6 +19,7 @@ import { runAutobuild } from "./autobuild";
|
||||
import { getCodeQL } from "./codeql";
|
||||
import { Config, getConfig } from "./config-utils";
|
||||
import { uploadDatabases } from "./database-upload";
|
||||
import { addDiagnostic, makeDiagnostic } from "./diagnostics";
|
||||
import { EnvVar } from "./environment";
|
||||
import { Features } from "./feature-flags";
|
||||
import { Language } from "./languages";
|
||||
@@ -231,6 +233,44 @@ async function run() {
|
||||
logger,
|
||||
);
|
||||
|
||||
// Check that `which go` still points at the wrapper script we installed in the `init` Action,
|
||||
// if the corresponding environment variable is set. This is to ensure that there isn't a step
|
||||
// in the workflow after the `init` step which installs a different version of Go and takes
|
||||
// precedence in the PATH, thus potentially circumventing our workaround that allows tracing to work.
|
||||
const goWrapperPath = process.env[EnvVar.GO_BINARY_LOCATION];
|
||||
|
||||
if (
|
||||
process.env[EnvVar.DID_AUTOBUILD_GOLANG] !== "true" &&
|
||||
goWrapperPath !== undefined
|
||||
) {
|
||||
const goBinaryPath = await safeWhich("go");
|
||||
|
||||
if (goWrapperPath !== goBinaryPath) {
|
||||
core.warning(
|
||||
`Expected \`which go\` to return ${goWrapperPath}, but got ${goBinaryPath}: please ensure that the correct version of Go is installed before the \`codeql-action/init\` Action is used.`,
|
||||
);
|
||||
|
||||
addDiagnostic(
|
||||
config,
|
||||
Language.go,
|
||||
makeDiagnostic(
|
||||
"go/workflow/go-installed-after-codeql-init",
|
||||
"Go was installed after the `codeql-action/init` Action was run",
|
||||
{
|
||||
markdownMessage:
|
||||
"To avoid interfering with the CodeQL analysis, perform all installation steps before calling the `github/codeql-action/init` Action.",
|
||||
visibility: {
|
||||
statusPage: true,
|
||||
telemetry: true,
|
||||
cliSummaryTable: true,
|
||||
},
|
||||
severity: "warning",
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
await runAutobuildIfLegacyGoWorkflow(config, logger);
|
||||
|
||||
dbCreationTimings = await runFinalize(
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user