mirror of
https://github.com/github/codeql-action.git
synced 2025-12-26 01:00:20 +08:00
Compare commits
57 Commits
v1.0.12
...
codeql-bun
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa1baf5b84 | ||
|
|
bc190d2af9 | ||
|
|
c0971eed35 | ||
|
|
ac8bd3f417 | ||
|
|
4854dd23d5 | ||
|
|
c5468fcaea | ||
|
|
83d5f38dee | ||
|
|
444316b6c6 | ||
|
|
7128833392 | ||
|
|
455ee1f217 | ||
|
|
54fc9c575e | ||
|
|
3525a164c3 | ||
|
|
aeeb3c3e88 | ||
|
|
88d30845f1 | ||
|
|
89d78ba457 | ||
|
|
e72d9f4a72 | ||
|
|
4455bf8cd9 | ||
|
|
12300ac88e | ||
|
|
11db623ba8 | ||
|
|
3f515d3140 | ||
|
|
a57642e1a0 | ||
|
|
62ef9f5eb2 | ||
|
|
e22a6cd3c9 | ||
|
|
f9b0b9cb7b | ||
|
|
5fc16ebcf6 | ||
|
|
7e2215bc92 | ||
|
|
3a016ebea8 | ||
|
|
2ba7208ff2 | ||
|
|
72399ae69a | ||
|
|
c0a58782b6 | ||
|
|
d1ff4d6297 | ||
|
|
80a6b3a41e | ||
|
|
1c27c52804 | ||
|
|
e833d6e84c | ||
|
|
8a0c541e24 | ||
|
|
e2d592dc8f | ||
|
|
2e71e02553 | ||
|
|
b29bf7b05a | ||
|
|
1785bbb7d8 | ||
|
|
a44b61d961 | ||
|
|
a062fc9bf5 | ||
|
|
50de2e4d1e | ||
|
|
132e08a05f | ||
|
|
720884501a | ||
|
|
fd45eac830 | ||
|
|
e70ec1d70e | ||
|
|
70d2efc353 | ||
|
|
fb77829455 | ||
|
|
4ba53e33d7 | ||
|
|
f0a2954c12 | ||
|
|
bf91ac91d4 | ||
|
|
e3151ae8df | ||
|
|
a2f0227de2 | ||
|
|
2639547a69 | ||
|
|
e86cff2acb | ||
|
|
2eb8300e80 | ||
|
|
78cda05e38 |
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1,4 +1,5 @@
|
||||
lib/*.js linguist-generated=true
|
||||
.github/workflows/__* linguist-generated=true
|
||||
|
||||
# Reduce incidence of needless merge conflicts on CHANGELOG.md
|
||||
# The man page at
|
||||
|
||||
39
.github/prepare-test/action.yml
vendored
Normal file
39
.github/prepare-test/action.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: "Prepare test"
|
||||
description: Performs some preparation to run tests
|
||||
inputs:
|
||||
version:
|
||||
required: true
|
||||
outputs:
|
||||
tools-url:
|
||||
value: ${{ steps.get-url.outputs.tools-url }}
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Move codeql-action
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir ../action
|
||||
mv * .github ../action/
|
||||
mv ../action/tests/multi-language-repo/{*,.github} .
|
||||
mv ../action/.github/workflows .github
|
||||
- id: get-url
|
||||
name: Determine URL
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ ${{ inputs.version }} == "nightly-latest" ]]; then
|
||||
export LATEST=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
|
||||
echo "::set-output name=tools-url::https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST/codeql-bundle.tar.gz"
|
||||
elif [[ ${{ inputs.version }} == *"nightly"* ]]; then
|
||||
export VERSION=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
|
||||
echo "::set-output name=tools-url::https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/codeql-bundle-$VERSION-manual/codeql-bundle.tar.gz"
|
||||
elif [[ ${{ inputs.version }} == *"stable"* ]]; then
|
||||
export VERSION=`echo ${{ inputs.version }} | sed -e 's/^.*\-//'`
|
||||
echo "Hello $VERSION"
|
||||
echo "::set-output name=tools-url::https://github.com/github/codeql-action/releases/download/codeql-bundle-$VERSION/codeql-bundle.tar.gz"
|
||||
elif [[ ${{ inputs.version }} == "latest" ]]; then
|
||||
echo "::set-output name=tools-url::latest"
|
||||
elif [[ ${{ inputs.version }} == "cached" ]]; then
|
||||
echo "::set-output name=tools-url::"
|
||||
else
|
||||
echo "::error Unrecognized version specified!"
|
||||
fi
|
||||
60
.github/workflows/__go-custom-queries.yml
generated
vendored
Normal file
60
.github/workflows/__go-custom-queries.yml
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: 'PR Check - Go: Custom queries'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
go-custom-queries:
|
||||
strategy:
|
||||
matrix:
|
||||
version:
|
||||
- stable-20201028
|
||||
- stable-20210319
|
||||
- stable-20210809
|
||||
- cached
|
||||
- latest
|
||||
- nightly-latest
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
name: 'Go: Custom queries'
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ^1.13.1
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
config-file: ./.github/codeql/custom-queries.yml
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
TEST_MODE: true
|
||||
63
.github/workflows/__go-custom-tracing-autobuild.yml
generated
vendored
Normal file
63
.github/workflows/__go-custom-tracing-autobuild.yml
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: 'PR Check - Go: Autobuild custom tracing'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
go-custom-tracing-autobuild:
|
||||
strategy:
|
||||
matrix:
|
||||
version:
|
||||
- stable-20201028
|
||||
- stable-20210319
|
||||
- stable-20210809
|
||||
- cached
|
||||
- latest
|
||||
- nightly-latest
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
name: 'Go: Autobuild custom tracing'
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ^1.13.1
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/autobuild
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/codeql_databases"
|
||||
if [[ ! -d go ]]; then
|
||||
echo "Did not find a Go database"
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
CODEQL_EXTRACTOR_GO_BUILD_TRACING: 'true'
|
||||
61
.github/workflows/__go-custom-tracing.yml
generated
vendored
Normal file
61
.github/workflows/__go-custom-tracing.yml
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: 'PR Check - Go: Custom tracing'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
go-custom-tracing:
|
||||
strategy:
|
||||
matrix:
|
||||
version:
|
||||
- stable-20201028
|
||||
- stable-20210319
|
||||
- stable-20210809
|
||||
- cached
|
||||
- latest
|
||||
- nightly-latest
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
name: 'Go: Custom tracing'
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ^1.13.1
|
||||
- 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
|
||||
env:
|
||||
TEST_MODE: true
|
||||
env:
|
||||
CODEQL_EXTRACTOR_GO_BUILD_TRACING: 'true'
|
||||
59
.github/workflows/__javascript-source-root.yml
generated
vendored
Normal file
59
.github/workflows/__javascript-source-root.yml
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: PR Check - Custom source root
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
javascript-source-root:
|
||||
strategy:
|
||||
matrix:
|
||||
version: [latest, cached, nightly-latest] # This feature is not compatible with old CLIs
|
||||
os: [ubuntu-latest]
|
||||
name: Custom source root
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- name: Move codeql-action
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir ../new-source-root
|
||||
mv * ../new-source-root
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: javascript
|
||||
source-root: ../new-source-root
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
skip-queries: true
|
||||
upload: false
|
||||
- name: Assert database exists
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/codeql_databases"
|
||||
if [[ ! -d javascript ]]; then
|
||||
echo "Did not find a JavaScript database"
|
||||
exit 1
|
||||
fi
|
||||
86
.github/workflows/__multi-language-autodetect.yml
generated
vendored
Normal file
86
.github/workflows/__multi-language-autodetect.yml
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: PR Check - Multi-language repository
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
multi-language-autodetect:
|
||||
strategy:
|
||||
matrix:
|
||||
version:
|
||||
- stable-20201028
|
||||
- stable-20210319
|
||||
- stable-20210809
|
||||
- cached
|
||||
- latest
|
||||
- nightly-latest
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
name: Multi-language repository
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
db-location: ${{ runner.temp }}/customDbLocation
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
id: analysis
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- shell: bash
|
||||
run: |
|
||||
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
|
||||
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||
echo "Did not create a database for CPP, or created it in the wrong location."
|
||||
exit 1
|
||||
fi
|
||||
CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }}
|
||||
if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||
echo "Did not create a database for C Sharp, or created it in the wrong location."
|
||||
exit 1
|
||||
fi
|
||||
GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }}
|
||||
if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||
echo "Did not create a database for Go, or created it in the wrong location."
|
||||
exit 1
|
||||
fi
|
||||
JAVA_DB=${{ fromJson(steps.analysis.outputs.db-locations).java }}
|
||||
if [[ ! -d $JAVA_DB ]] || [[ ! $JAVA_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||
echo "Did not create a database for Java, or created it in the wrong location."
|
||||
exit 1
|
||||
fi
|
||||
JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }}
|
||||
if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||
echo "Did not create a database for Javascript, or created it in the wrong location."
|
||||
exit 1
|
||||
fi
|
||||
PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }}
|
||||
if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||
echo "Did not create a database for Python, or created it in the wrong location."
|
||||
exit 1
|
||||
fi
|
||||
65
.github/workflows/__packaging-config-inputs-js.yml
generated
vendored
Normal file
65
.github/workflows/__packaging-config-inputs-js.yml
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: 'PR Check - Packaging: Config and input'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
packaging-config-inputs-js:
|
||||
strategy:
|
||||
matrix:
|
||||
version: [nightly-20210831] # This CLI version is known to work with package used in this test
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
name: 'Packaging: Config and input'
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
config-file: .github/codeql/codeql-config-packaging3.yml
|
||||
packs: +dsp-testing/codeql-pack1@0.1.0
|
||||
languages: javascript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert Results
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
# We should have 3 hits from these rules
|
||||
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
|
||||
|
||||
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
|
||||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
|
||||
echo "Found matching rules '$RULES'"
|
||||
if [ "$RULES" != "$EXPECTED_RULES" ]; then
|
||||
echo "Did not match expected rules '$EXPECTED_RULES'."
|
||||
exit 1
|
||||
fi
|
||||
64
.github/workflows/__packaging-config-js.yml
generated
vendored
Normal file
64
.github/workflows/__packaging-config-js.yml
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: 'PR Check - Packaging: Config file'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
packaging-config-js:
|
||||
strategy:
|
||||
matrix:
|
||||
version: [nightly-20210831] # This CLI version is known to work with package used in this test
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
name: 'Packaging: Config file'
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
config-file: .github/codeql/codeql-config-packaging.yml
|
||||
languages: javascript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert Results
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
# We should have 3 hits from these rules
|
||||
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
|
||||
|
||||
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
|
||||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
|
||||
echo "Found matching rules '$RULES'"
|
||||
if [ "$RULES" != "$EXPECTED_RULES" ]; then
|
||||
echo "Did not match expected rules '$EXPECTED_RULES'."
|
||||
exit 1
|
||||
fi
|
||||
65
.github/workflows/__packaging-inputs-js.yml
generated
vendored
Normal file
65
.github/workflows/__packaging-inputs-js.yml
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: 'PR Check - Packaging: Action input'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
packaging-inputs-js:
|
||||
strategy:
|
||||
matrix:
|
||||
version: [nightly-20210831] # This CLI version is known to work with package used in this test
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
name: 'Packaging: Action input'
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
config-file: .github/codeql/codeql-config-packaging2.yml
|
||||
languages: javascript
|
||||
packs: dsp-testing/codeql-pack1@0.1.0, dsp-testing/codeql-pack2
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert Results
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
# We should have 3 hits from these rules
|
||||
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
|
||||
|
||||
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
|
||||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
|
||||
echo "Found matching rules '$RULES'"
|
||||
if [ "$RULES" != "$EXPECTED_RULES" ]; then
|
||||
echo "Did not match expected rules '$EXPECTED_RULES'."
|
||||
exit 1
|
||||
fi
|
||||
58
.github/workflows/__remote-config.yml
generated
vendored
Normal file
58
.github/workflows/__remote-config.yml
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: PR Check - Remote config file
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
remote-config:
|
||||
strategy:
|
||||
matrix:
|
||||
version:
|
||||
- stable-20201028
|
||||
- stable-20210319
|
||||
- stable-20210809
|
||||
- cached
|
||||
- latest
|
||||
- nightly-latest
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
name: Remote config file
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
languages: cpp,csharp,java,javascript,python
|
||||
config-file: github/codeql-action/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{
|
||||
github.sha }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
TEST_MODE: true
|
||||
65
.github/workflows/__rubocop-multi-language.yml
generated
vendored
Normal file
65
.github/workflows/__rubocop-multi-language.yml
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: PR Check - RuboCop multi-language
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
rubocop-multi-language:
|
||||
strategy:
|
||||
matrix:
|
||||
version:
|
||||
- stable-20201028
|
||||
- stable-20210319
|
||||
- stable-20210809
|
||||
- cached
|
||||
- latest
|
||||
- nightly-latest
|
||||
os: [ubuntu-latest]
|
||||
name: RuboCop multi-language
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
- name: Install Code Scanning integration
|
||||
shell: bash
|
||||
run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: bundle install
|
||||
- name: RuboCop run
|
||||
shell: bash
|
||||
run: |
|
||||
bash -c "
|
||||
bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
|
||||
[[ $? -ne 2 ]]
|
||||
"
|
||||
- uses: ./../action/upload-sarif
|
||||
with:
|
||||
sarif_file: rubocop.sarif
|
||||
env:
|
||||
TEST_MODE: true
|
||||
78
.github/workflows/__split-workflow.yml
generated
vendored
Normal file
78
.github/workflows/__split-workflow.yml
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: PR Check - Split workflow
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
split-workflow:
|
||||
strategy:
|
||||
matrix:
|
||||
version: [nightly-20210831] # This CLI version is known to work with package used in this test
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
name: Split workflow
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
config-file: .github/codeql/codeql-config-packaging3.yml
|
||||
packs: +dsp-testing/codeql-pack1@0.1.0
|
||||
languages: javascript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
skip-queries: true
|
||||
output: ${{ runner.temp }}/results
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert No Results
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "$(ls -A $RUNNER_TEMP/results)" ]; then
|
||||
echo "Expected results directory to be empty after skipping query execution!"
|
||||
exit 1
|
||||
fi
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: ${{ runner.temp }}/results
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert Results
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
# We should have 3 hits from these rules
|
||||
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
|
||||
|
||||
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
|
||||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
|
||||
echo "Found matching rules '$RULES'"
|
||||
if [ "$RULES" != "$EXPECTED_RULES" ]; then
|
||||
echo "Did not match expected rules '$EXPECTED_RULES'."
|
||||
exit 1
|
||||
fi
|
||||
52
.github/workflows/__test-local-codeql.yml
generated
vendored
Normal file
52
.github/workflows/__test-local-codeql.yml
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: PR Check - Local CodeQL bundle
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
test-local-codeql:
|
||||
strategy:
|
||||
matrix:
|
||||
version: [nightly-latest]
|
||||
os: [ubuntu-latest]
|
||||
name: Local CodeQL bundle
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- name: Fetch a CodeQL bundle
|
||||
shell: bash
|
||||
env:
|
||||
CODEQL_URL: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
run: |
|
||||
wget "$CODEQL_URL"
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
tools: ./codeql-bundle.tar.gz
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
TEST_MODE: true
|
||||
54
.github/workflows/__test-proxy.yml
generated
vendored
Normal file
54
.github/workflows/__test-proxy.yml
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: PR Check - Proxy test
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
test-proxy:
|
||||
strategy:
|
||||
matrix:
|
||||
version: [latest]
|
||||
os: [ubuntu-latest]
|
||||
name: Proxy test
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: javascript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
TEST_MODE: true
|
||||
env:
|
||||
https_proxy: http://squid-proxy:3128
|
||||
container:
|
||||
image: ubuntu:18.04
|
||||
options: --dns 127.0.0.1
|
||||
services:
|
||||
squid-proxy:
|
||||
image: datadog/squid:latest
|
||||
ports:
|
||||
- 3128:3128
|
||||
55
.github/workflows/__test-ruby.yml
generated
vendored
Normal file
55
.github/workflows/__test-ruby.yml
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
name: PR Check - Ruby analysis
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GO111MODULE: auto
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v1
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch: {}
|
||||
jobs:
|
||||
test-ruby:
|
||||
strategy:
|
||||
matrix:
|
||||
version: [latest, cached, nightly-latest]
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
name: Ruby analysis
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare test
|
||||
id: prepare-test
|
||||
uses: ./.github/prepare-test
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: ruby
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/analyze
|
||||
id: analysis
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Check database
|
||||
shell: bash
|
||||
run: |
|
||||
RUBY_DB="${{ fromJson(steps.analysis.outputs.db-locations).ruby }}"
|
||||
if [[ ! -d "$RUBY_DB" ]]; then
|
||||
echo "Did not create a database for Ruby."
|
||||
exit 1
|
||||
fi
|
||||
env:
|
||||
CODEQL_ENABLE_EXPERIMENTAL_FEATURES: 'true'
|
||||
1086
.github/workflows/pr-checks.yml
vendored
1086
.github/workflows/pr-checks.yml
vendored
File diff suppressed because it is too large
Load Diff
25
.github/workflows/script/verify-pr-checks.sh
vendored
Executable file
25
.github/workflows/script/verify-pr-checks.sh
vendored
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
# Sanity check that repo is clean to start with
|
||||
if [ ! -z "$(git status --porcelain)" ]; then
|
||||
# If we get a fail here then this workflow needs attention...
|
||||
>&2 echo "Failed: Repo should be clean before testing!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Wipe the generated PR checks in case there are extra unnecessary files in there
|
||||
rm -rf .github/workflows/__*
|
||||
|
||||
# Generate the PR checks
|
||||
cd pr-checks && python3 sync.py
|
||||
|
||||
# Check that repo is still clean
|
||||
if [ ! -z "$(git status --porcelain)" ]; then
|
||||
# If we get a fail here then the PR needs attention
|
||||
git diff
|
||||
git status
|
||||
>&2 echo "Failed: PR checks are not up to date. Run 'cd pr-checks && python3 sync.py' to update"
|
||||
exit 1
|
||||
fi
|
||||
echo "Success: PR checks are up to date"
|
||||
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,5 +1,19 @@
|
||||
# CodeQL Action and CodeQL Runner Changelog
|
||||
|
||||
## [UNRELEASED]
|
||||
|
||||
No user facing changes.
|
||||
|
||||
## 1.0.14 - 09 Sep 2021
|
||||
|
||||
- Update default CodeQL bundle version to 2.6.1. [#733](https://github.com/github/codeql-action/pull/733)
|
||||
|
||||
## 1.0.13 - 06 Sep 2021
|
||||
|
||||
- Update default CodeQL bundle version to 2.6.0. [#712](https://github.com/github/codeql-action/pull/712)
|
||||
- Update baseline lines of code counter for python. All multi-line strings are counted as code. [#714](https://github.com/github/codeql-action/pull/714)
|
||||
- Remove old baseline LoC injection [#715](https://github.com/github/codeql-action/pull/715)
|
||||
|
||||
## 1.0.12 - 16 Aug 2021
|
||||
|
||||
- Update README to include a sample permissions block. [#689](https://github.com/github/codeql-action/pull/689)
|
||||
|
||||
@@ -74,8 +74,8 @@ jobs:
|
||||
# project uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
@@ -91,8 +91,8 @@ If you prefer to integrate this within an existing CI workflow, it should end up
|
||||
|
||||
# Here is where you build your code
|
||||
- run: |
|
||||
make bootstrap
|
||||
make release
|
||||
make bootstrap
|
||||
make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
|
||||
24
lib/analyze.js
generated
24
lib/analyze.js
generated
@@ -67,7 +67,7 @@ async function createdDBForScannedLanguages(config, logger) {
|
||||
// Insert the LGTM_INDEX_X env vars at this point so they are set when
|
||||
// we extract any scanned languages.
|
||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||
const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
|
||||
for (const language of config.languages) {
|
||||
if (languages_1.isScannedLanguage(language) &&
|
||||
!dbIsFinalized(config, language, logger)) {
|
||||
@@ -93,7 +93,7 @@ function dbIsFinalized(config, language, logger) {
|
||||
}
|
||||
async function finalizeDatabaseCreation(config, threadsFlag, memoryFlag, logger) {
|
||||
await createdDBForScannedLanguages(config, logger);
|
||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||
const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
|
||||
for (const language of config.languages) {
|
||||
if (dbIsFinalized(config, language, logger)) {
|
||||
logger.info(`There is already a finalized database for ${language} at the location where the CodeQL Action places databases, so we did not create one.`);
|
||||
@@ -130,7 +130,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
||||
logger.info("And should not be used in production yet.");
|
||||
logger.info("*************");
|
||||
logger.startGroup(`Downloading custom packs for ${language}`);
|
||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||
const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
|
||||
const results = await codeql.packDownload(packsWithVersion);
|
||||
logger.info(`Downloaded packs: ${results.packs
|
||||
.map((r) => `${r.name}@${r.version || "latest"}`)
|
||||
@@ -183,7 +183,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
||||
return statusReport;
|
||||
async function runInterpretResults(language, queries, sarifFile) {
|
||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||
const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
|
||||
return await codeql.databaseInterpretResults(databasePath, queries, sarifFile, addSnippetsFlag, threadsFlag, automationDetailsId);
|
||||
}
|
||||
async function runQueryGroup(language, type, querySuiteContents, searchPath) {
|
||||
@@ -193,7 +193,7 @@ async function runQueries(sarifFolder, memoryFlag, addSnippetsFlag, threadsFlag,
|
||||
const querySuitePath = `${databasePath}-queries-${type}.qls`;
|
||||
fs.writeFileSync(querySuitePath, querySuiteContents);
|
||||
logger.debug(`Query suite file for ${language}-${type}...\n${querySuiteContents}`);
|
||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||
const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
|
||||
await codeql.databaseRunQueries(databasePath, searchPath, querySuitePath, memoryFlag, threadsFlag);
|
||||
logger.debug(`BQRS results produced for ${language} (queries: ${type})"`);
|
||||
return querySuitePath;
|
||||
@@ -223,7 +223,7 @@ exports.runFinalize = runFinalize;
|
||||
async function runCleanup(config, cleanupLevel, logger) {
|
||||
logger.startGroup("Cleaning up databases");
|
||||
for (const language of config.languages) {
|
||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||
const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
|
||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||
await codeql.databaseCleanup(databasePath, cleanupLevel);
|
||||
}
|
||||
@@ -233,24 +233,14 @@ exports.runCleanup = runCleanup;
|
||||
async function injectLinesOfCode(sarifFile, language, locPromise) {
|
||||
var _a;
|
||||
const lineCounts = await locPromise;
|
||||
const idPrefix = count_loc_1.getIdPrefix(language);
|
||||
if (language in lineCounts) {
|
||||
const sarif = JSON.parse(fs.readFileSync(sarifFile, "utf8"));
|
||||
if (Array.isArray(sarif.runs)) {
|
||||
for (const run of sarif.runs) {
|
||||
// Old style: Baseline is inserted when rule ID has suffix /summary/lines-of-code
|
||||
const ruleId = `${idPrefix}/summary/lines-of-code`;
|
||||
run.properties = run.properties || {};
|
||||
run.properties.metricResults = run.properties.metricResults || [];
|
||||
const rule = run.properties.metricResults.find(
|
||||
// the rule id can be in either of two places
|
||||
(r) => { var _a; return r.ruleId === ruleId || ((_a = r.rule) === null || _a === void 0 ? void 0 : _a.id) === ruleId; });
|
||||
// only add the baseline value if the rule already exists
|
||||
if (rule) {
|
||||
rule.baseline = lineCounts[language];
|
||||
}
|
||||
// New style: Baseline is inserted when matching rule has tag lines-of-code
|
||||
for (const metric of run.properties.metricResults) {
|
||||
// Baseline is inserted when matching rule has tag lines-of-code
|
||||
if (metric.rule && metric.rule.toolComponent) {
|
||||
const matchingRule = run.tool.extensions[metric.rule.toolComponent.index].rules[metric.rule.index];
|
||||
if ((_a = matchingRule.properties.tags) === null || _a === void 0 ? void 0 : _a.includes("lines-of-code")) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
50
lib/analyze.test.js
generated
50
lib/analyze.test.js
generated
@@ -30,7 +30,6 @@ const semver_1 = require("semver");
|
||||
const sinon = __importStar(require("sinon"));
|
||||
const analyze_1 = require("./analyze");
|
||||
const codeql_1 = require("./codeql");
|
||||
const count_loc_1 = require("./count-loc");
|
||||
const count = __importStar(require("./count-loc"));
|
||||
const languages_1 = require("./languages");
|
||||
const logging_1 = require("./logging");
|
||||
@@ -76,31 +75,7 @@ ava_1.default("status report fields and search path setting", async (t) => {
|
||||
databaseInterpretResults: async (_db, _queriesRun, sarifFile) => {
|
||||
fs.writeFileSync(sarifFile, JSON.stringify({
|
||||
runs: [
|
||||
// variant 1 uses ruleId
|
||||
{
|
||||
properties: {
|
||||
metricResults: [
|
||||
{
|
||||
ruleId: `${count_loc_1.getIdPrefix(language)}/summary/lines-of-code`,
|
||||
value: 123,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
// variant 2 uses rule.id
|
||||
{
|
||||
properties: {
|
||||
metricResults: [
|
||||
{
|
||||
rule: {
|
||||
id: `${count_loc_1.getIdPrefix(language)}/summary/lines-of-code`,
|
||||
},
|
||||
value: 123,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
// variant 3 references a rule with the lines-of-code tag
|
||||
// references a rule with the lines-of-code tag, so baseline should be injected
|
||||
{
|
||||
tool: {
|
||||
extensions: [
|
||||
@@ -199,29 +174,12 @@ ava_1.default("status report fields and search path setting", async (t) => {
|
||||
function verifyLineCounts(tmpDir) {
|
||||
// eslint-disable-next-line github/array-foreach
|
||||
Object.keys(languages_1.Language).forEach((lang, i) => {
|
||||
verifyLineCountForFile(lang, path.join(tmpDir, `${lang}.sarif`), i + 1);
|
||||
verifyLineCountForFile(path.join(tmpDir, `${lang}.sarif`), i + 1);
|
||||
});
|
||||
}
|
||||
function verifyLineCountForFile(lang, filePath, lineCount) {
|
||||
const idPrefix = count_loc_1.getIdPrefix(lang);
|
||||
function verifyLineCountForFile(filePath, lineCount) {
|
||||
const sarif = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
||||
t.deepEqual(sarif.runs[0].properties.metricResults, [
|
||||
{
|
||||
ruleId: `${idPrefix}/summary/lines-of-code`,
|
||||
value: 123,
|
||||
baseline: lineCount,
|
||||
},
|
||||
]);
|
||||
t.deepEqual(sarif.runs[1].properties.metricResults, [
|
||||
{
|
||||
rule: {
|
||||
id: `${idPrefix}/summary/lines-of-code`,
|
||||
},
|
||||
value: 123,
|
||||
baseline: lineCount,
|
||||
},
|
||||
]);
|
||||
t.deepEqual(sarif.runs[2].properties.metricResults, [
|
||||
{
|
||||
rule: {
|
||||
index: 0,
|
||||
@@ -234,7 +192,7 @@ ava_1.default("status report fields and search path setting", async (t) => {
|
||||
},
|
||||
]);
|
||||
// when the rule doesn't exist, it should not be added
|
||||
t.deepEqual(sarif.runs[3].properties.metricResults, []);
|
||||
t.deepEqual(sarif.runs[1].properties.metricResults, []);
|
||||
}
|
||||
function verifyQuerySuites(tmpDir) {
|
||||
const qlsContent = [
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
lib/autobuild.js
generated
2
lib/autobuild.js
generated
@@ -25,7 +25,7 @@ function determineAutobuildLanguage(config, logger) {
|
||||
exports.determineAutobuildLanguage = determineAutobuildLanguage;
|
||||
async function runAutobuild(language, config, logger) {
|
||||
logger.startGroup(`Attempting to automatically build ${language} code`);
|
||||
const codeQL = codeql_1.getCodeQL(config.codeQLCmd);
|
||||
const codeQL = await codeql_1.getCodeQL(config.codeQLCmd);
|
||||
await codeQL.runAutobuild(language);
|
||||
logger.endGroup();
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AAErC,2CAAyD;AAGzD,SAAgB,0BAA0B,CACxC,MAA2B,EAC3B,MAAc;IAEd,0CAA0C;IAC1C,mFAAmF;IACnF,oFAAoF;IACpF,4EAA4E;IAC5E,MAAM,kBAAkB,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,4BAAgB,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAEvC,IAAI,CAAC,QAAQ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C;IAE/D,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;QACjC,MAAM,CAAC,OAAO,CACZ,oCAAoC,QAAQ,8BAA8B,kBAAkB;aACzF,KAAK,CAAC,CAAC,CAAC;aACR,IAAI,CAAC,OAAO,CAAC,uDAAuD,CACxE,CAAC;KACH;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AA7BD,gEA6BC;AAEM,KAAK,UAAU,YAAY,CAChC,QAAkB,EAClB,MAA2B,EAC3B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,qCAAqC,QAAQ,OAAO,CAAC,CAAC;IACxE,MAAM,MAAM,GAAG,MAAM,kBAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,MAAM,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AATD,oCASC"}
|
||||
52
lib/codeql.js
generated
52
lib/codeql.js
generated
@@ -51,7 +51,25 @@ exports.CommandInvocationError = CommandInvocationError;
|
||||
let cachedCodeQL = undefined;
|
||||
const CODEQL_BUNDLE_VERSION = defaults.bundleVersion;
|
||||
const CODEQL_DEFAULT_ACTION_REPOSITORY = "github/codeql-action";
|
||||
/**
|
||||
* The oldest version of CodeQL that the Action will run with. This should be
|
||||
* at least three minor versions behind the current version. The version flags
|
||||
* below can be used to conditionally enable certain features on versions newer
|
||||
* than this. Please record the reason we cannot support an older version.
|
||||
*
|
||||
* Reason: Changes to how the tracing environment is set up.
|
||||
*/
|
||||
const CODEQL_MINIMUM_VERSION = "2.3.1";
|
||||
/**
|
||||
* Versions of CodeQL that version-flag certain functionality in the Action.
|
||||
* For convenience, please keep these in descending order. Once a version
|
||||
* flag is older than the oldest supported version above, it may be removed.
|
||||
*/
|
||||
const CODEQL_VERSION_RAM_FINALIZE = "2.5.8";
|
||||
const CODEQL_VERSION_DIAGNOSTICS = "2.5.6";
|
||||
const CODEQL_VERSION_METRICS = "2.5.5";
|
||||
const CODEQL_VERSION_GROUP_RULES = "2.5.5";
|
||||
const CODEQL_VERSION_SARIF_GROUP = "2.5.3";
|
||||
function getCodeQLBundleName() {
|
||||
let platform;
|
||||
if (process.platform === "win32") {
|
||||
@@ -160,7 +178,7 @@ async function getCodeQLBundleDownloadURL(apiDetails, variant, logger) {
|
||||
}
|
||||
return `https://github.com/${CODEQL_DEFAULT_ACTION_REPOSITORY}/releases/download/${CODEQL_BUNDLE_VERSION}/${codeQLBundleName}`;
|
||||
}
|
||||
async function setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger) {
|
||||
async function setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger, checkVersion) {
|
||||
try {
|
||||
// We use the special value of 'latest' to prioritize the version in the
|
||||
// defaults over any pinned cached version.
|
||||
@@ -228,7 +246,7 @@ async function setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant
|
||||
else if (process.platform !== "linux" && process.platform !== "darwin") {
|
||||
throw new Error(`Unsupported platform: ${process.platform}`);
|
||||
}
|
||||
cachedCodeQL = getCodeQLForCmd(codeqlCmd);
|
||||
cachedCodeQL = await getCodeQLForCmd(codeqlCmd, checkVersion);
|
||||
return { codeql: cachedCodeQL, toolsVersion: codeqlURLVersion };
|
||||
}
|
||||
catch (e) {
|
||||
@@ -260,9 +278,9 @@ exports.convertToSemVer = convertToSemVer;
|
||||
/**
|
||||
* Use the CodeQL executable located at the given path.
|
||||
*/
|
||||
function getCodeQL(cmd) {
|
||||
async function getCodeQL(cmd) {
|
||||
if (cachedCodeQL === undefined) {
|
||||
cachedCodeQL = getCodeQLForCmd(cmd);
|
||||
cachedCodeQL = await getCodeQLForCmd(cmd, true);
|
||||
}
|
||||
return cachedCodeQL;
|
||||
}
|
||||
@@ -320,13 +338,16 @@ function getCachedCodeQL() {
|
||||
return cachedCodeQL;
|
||||
}
|
||||
exports.getCachedCodeQL = getCachedCodeQL;
|
||||
function getCodeQLForCmd(cmd) {
|
||||
return {
|
||||
async function getCodeQLForCmd(cmd, checkVersion) {
|
||||
let cachedVersion = undefined;
|
||||
const codeql = {
|
||||
getPath() {
|
||||
return cmd;
|
||||
},
|
||||
async getVersion() {
|
||||
return await runTool(cmd, ["version", "--format=terse"]);
|
||||
if (cachedVersion === undefined)
|
||||
cachedVersion = runTool(cmd, ["version", "--format=terse"]);
|
||||
return await cachedVersion;
|
||||
},
|
||||
async printVersion() {
|
||||
await runTool(cmd, ["version", "--format=json"]);
|
||||
@@ -495,15 +516,19 @@ function getCodeQLForCmd(cmd) {
|
||||
"interpret-results",
|
||||
threadsFlag,
|
||||
"--format=sarif-latest",
|
||||
"--print-diagnostics-summary",
|
||||
"--print-metrics-summary",
|
||||
"--sarif-group-rules-by-pack",
|
||||
"-v",
|
||||
`--output=${sarifFile}`,
|
||||
addSnippetsFlag,
|
||||
...getExtraOptionsFromEnv(["database", "interpret-results"]),
|
||||
];
|
||||
if (automationDetailsId !== undefined) {
|
||||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_DIAGNOSTICS))
|
||||
codeqlArgs.push("--print-diagnostics-summary");
|
||||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_METRICS))
|
||||
codeqlArgs.push("--print-metrics-summary");
|
||||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_GROUP_RULES))
|
||||
codeqlArgs.push("--sarif-group-rules-by-pack");
|
||||
if (automationDetailsId !== undefined &&
|
||||
(await util.codeQlVersionAbove(this, CODEQL_VERSION_SARIF_GROUP))) {
|
||||
codeqlArgs.push("--sarif-category", automationDetailsId);
|
||||
}
|
||||
codeqlArgs.push(databasePath, ...querySuitePaths);
|
||||
@@ -565,6 +590,11 @@ function getCodeQLForCmd(cmd) {
|
||||
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
};
|
||||
if (checkVersion &&
|
||||
!(await util.codeQlVersionAbove(codeql, CODEQL_MINIMUM_VERSION))) {
|
||||
throw new Error(`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${await codeql.getVersion()}`);
|
||||
}
|
||||
return codeql;
|
||||
}
|
||||
function packWithVersionToString(pack) {
|
||||
return pack.version ? `${pack.packName}@${pack.version}` : pack.packName;
|
||||
|
||||
File diff suppressed because one or more lines are too long
20
lib/codeql.test.js
generated
20
lib/codeql.test.js
generated
@@ -53,7 +53,7 @@ ava_1.default("download codeql bundle cache", async (t) => {
|
||||
nock_1.default("https://example.com")
|
||||
.get(`/download/codeql-bundle-${version}/codeql-bundle.tar.gz`)
|
||||
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
|
||||
await codeql.setupCodeQL(`https://example.com/download/codeql-bundle-${version}/codeql-bundle.tar.gz`, sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true));
|
||||
await codeql.setupCodeQL(`https://example.com/download/codeql-bundle-${version}/codeql-bundle.tar.gz`, sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
|
||||
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
|
||||
}
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
@@ -66,12 +66,12 @@ ava_1.default("download codeql bundle cache explicitly requested with pinned dif
|
||||
nock_1.default("https://example.com")
|
||||
.get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`)
|
||||
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`));
|
||||
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true));
|
||||
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
|
||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
|
||||
nock_1.default("https://example.com")
|
||||
.get(`/download/codeql-bundle-20200610/codeql-bundle.tar.gz`)
|
||||
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
|
||||
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200610/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true));
|
||||
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200610/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
|
||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
||||
});
|
||||
});
|
||||
@@ -81,9 +81,9 @@ ava_1.default("don't download codeql bundle cache with pinned different version
|
||||
nock_1.default("https://example.com")
|
||||
.get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`)
|
||||
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`));
|
||||
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true));
|
||||
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
|
||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
|
||||
await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true));
|
||||
await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 1);
|
||||
});
|
||||
@@ -94,7 +94,7 @@ ava_1.default("download codeql bundle cache with different version cached (not p
|
||||
nock_1.default("https://example.com")
|
||||
.get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`)
|
||||
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
|
||||
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true));
|
||||
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
|
||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
|
||||
const platform = process.platform === "win32"
|
||||
? "win64"
|
||||
@@ -104,7 +104,7 @@ ava_1.default("download codeql bundle cache with different version cached (not p
|
||||
nock_1.default("https://github.com")
|
||||
.get(`/github/codeql-action/releases/download/${defaults.bundleVersion}/codeql-bundle-${platform}.tar.gz`)
|
||||
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
|
||||
await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true));
|
||||
await codeql.setupCodeQL(undefined, sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 2);
|
||||
});
|
||||
@@ -115,7 +115,7 @@ ava_1.default('download codeql bundle cache with pinned different version cached
|
||||
nock_1.default("https://example.com")
|
||||
.get(`/download/codeql-bundle-20200601/codeql-bundle.tar.gz`)
|
||||
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`));
|
||||
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true));
|
||||
await codeql.setupCodeQL("https://example.com/download/codeql-bundle-20200601/codeql-bundle.tar.gz", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
|
||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
|
||||
const platform = process.platform === "win32"
|
||||
? "win64"
|
||||
@@ -125,7 +125,7 @@ ava_1.default('download codeql bundle cache with pinned different version cached
|
||||
nock_1.default("https://github.com")
|
||||
.get(`/github/codeql-action/releases/download/${defaults.bundleVersion}/codeql-bundle-${platform}.tar.gz`)
|
||||
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle.tar.gz`));
|
||||
await codeql.setupCodeQL("latest", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true));
|
||||
await codeql.setupCodeQL("latest", sampleApiDetails, tmpDir, tmpDir, util.GitHubVariant.DOTCOM, logging_1.getRunnerLogger(true), false);
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 2);
|
||||
});
|
||||
@@ -153,7 +153,7 @@ ava_1.default("download codeql bundle from github ae endpoint", async (t) => {
|
||||
nock_1.default("https://example.githubenterprise.com")
|
||||
.get(`/github/codeql-action/releases/download/${defaults.bundleVersion}/${codeQLBundleName}`)
|
||||
.replyWithFile(200, path.join(__dirname, `/../src/testdata/codeql-bundle-pinned.tar.gz`));
|
||||
await codeql.setupCodeQL(undefined, sampleGHAEApiDetails, tmpDir, tmpDir, util.GitHubVariant.GHAE, logging_1.getRunnerLogger(true));
|
||||
await codeql.setupCodeQL(undefined, sampleGHAEApiDetails, tmpDir, tmpDir, util.GitHubVariant.GHAE, logging_1.getRunnerLogger(true), false);
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
t.is(cachedVersions.length, 1);
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
24
lib/count-loc.js
generated
24
lib/count-loc.js
generated
@@ -1,9 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.countLoc = exports.getIdPrefix = void 0;
|
||||
exports.countLoc = void 0;
|
||||
const github_linguist_1 = require("github-linguist");
|
||||
const languages_1 = require("./languages");
|
||||
const util_1 = require("./util");
|
||||
// Map from linguist language names to language prefixes used in the action and codeql
|
||||
const linguistToMetrics = {
|
||||
c: languages_1.Language.cpp,
|
||||
@@ -23,27 +22,6 @@ const nameToLinguist = Object.entries(linguistToMetrics).reduce((obj, [key, name
|
||||
obj[name].push(key);
|
||||
return obj;
|
||||
}, {});
|
||||
function getIdPrefix(language) {
|
||||
switch (language) {
|
||||
case languages_1.Language.cpp:
|
||||
return "cpp";
|
||||
case languages_1.Language.csharp:
|
||||
return "cs";
|
||||
case languages_1.Language.go:
|
||||
return "go";
|
||||
case languages_1.Language.java:
|
||||
return "java";
|
||||
case languages_1.Language.javascript:
|
||||
return "js";
|
||||
case languages_1.Language.python:
|
||||
return "py";
|
||||
case languages_1.Language.ruby:
|
||||
return "rb";
|
||||
default:
|
||||
util_1.assertNever(language);
|
||||
}
|
||||
}
|
||||
exports.getIdPrefix = getIdPrefix;
|
||||
/**
|
||||
* Count the lines of code of the specified language using the include
|
||||
* and exclude glob paths.
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"count-loc.js","sourceRoot":"","sources":["../src/count-loc.ts"],"names":[],"mappings":";;;AAAA,qDAAyC;AAEzC,2CAAuC;AAEvC,iCAAqC;AAKrC,sFAAsF;AACtF,MAAM,iBAAiB,GAA6B;IAClD,CAAC,EAAE,oBAAQ,CAAC,GAAG;IACf,KAAK,EAAE,oBAAQ,CAAC,GAAG;IACnB,IAAI,EAAE,oBAAQ,CAAC,MAAM;IACrB,EAAE,EAAE,oBAAQ,CAAC,EAAE;IACf,IAAI,EAAE,oBAAQ,CAA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upload.js
generated
@@ -57,7 +57,7 @@ async function uploadDatabases(repositoryNwo, config, apiDetails, logger) {
|
||||
}
|
||||
return;
|
||||
}
|
||||
const codeql = codeql_1.getCodeQL(config.codeQLCmd);
|
||||
const codeql = await codeql_1.getCodeQL(config.codeQLCmd);
|
||||
for (const language of config.languages) {
|
||||
// Bundle the database up into a single zip file
|
||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||
|
||||
@@ -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;AAExB,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,yBAAY,CAAC,UAAU,CAAC,CAAC;IACxC,IAAI;QACF,MAAM,MAAM,CAAC,OAAO,CAClB,wDAAwD,EACxD;YACE,KAAK,EAAE,aAAa,CAAC,KAAK;YAC1B,IAAI,EAAE,aAAa,CAAC,IAAI;SACzB,CACF,CAAC;KACH;IAAC,OAAO,CAAC,EAAE;QACV,IAAI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AQ,IAAI,MAAM,CAAC,SAAS,EAAE;QACvC,gDAAgD;QAChD,MAAM,YAAY,GAAG,IAAI,CAAC,qBAAqB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAClE,MAAM,kBAAkB,GAAG,GAAG,YAAY,MAAM,CAAC;QACjD,MAAM,MAAM,CAAC,cAAc,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;QAE9D,6BAA6B;QAC7B,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;QACpD,IAAI;YACF,MAAM,MAAM,CAAC,OAAO,CAClB,kEAAkE,EAClE;gBACE,KAAK,EAAE,aAAa,CAAC,KAAK;gBAC1B,IAAI,EAAE,aAAa,CAAC,IAAI;gBACxB,QAAQ;gBACR,IAAI,EAAE,OAAO;aACd,CACF,CAAC;YACF,MAAM,CAAC,KAAK,CAAC,sCAAsC,QAAQ,EAAE,CAAC,CAAC;SAChE;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;AAtED,0CAsEC"}
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"bundleVersion": "codeql-bundle-20210809"
|
||||
"bundleVersion": "codeql-bundle-20210907"
|
||||
}
|
||||
|
||||
2
lib/init.js
generated
2
lib/init.js
generated
@@ -31,7 +31,7 @@ const tracer_config_1 = require("./tracer-config");
|
||||
const util = __importStar(require("./util"));
|
||||
async function initCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger) {
|
||||
logger.startGroup("Setup CodeQL tools");
|
||||
const { codeql, toolsVersion } = await codeql_1.setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger);
|
||||
const { codeql, toolsVersion } = await codeql_1.setupCodeQL(codeqlURL, apiDetails, tempDir, toolCacheDir, variant, logger, true);
|
||||
await codeql.printVersion();
|
||||
logger.endGroup();
|
||||
return { codeql, toolsVersion };
|
||||
|
||||
@@ -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;AAG9C,mDAAwE;AACxE,6CAA+B;AAExB,KAAK,UAAU,UAAU,CAC9B,SAA6B,EAC7B,UAA4B,EAC5B,OAAe,EACf,YAAoB,EACpB,OAA2B,EAC3B,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,oBAAW,CAChD,SAAS,EACT,UAAU,EACV,OAAO,EACP,YAAY,EACZ,OAAO,EACP,MAAM,CACP,CAAC;IACF,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;IAC5B,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAClC,CAAC;AApBD,gCAoBC;AAEM,KAAK,UAAU,UAAU,CAC9B,cAAkC,EAClC,YAAgC,EAChC,UAA8B,EAC9B,UAA8B,EAC9B,UAA8B,EAC9B,UAAyB,EACzB,OAAe,EACf,YAAoB,EACpB,MAAc,EACd,aAAqB,EACrB,aAAiC,EACjC,UAAoC,EACpC,MAAc;IAEd,MAAM,CAAC,UAAU,CAAC,6BAA6B,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,UAAU,CACzC,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,OAAO,EACP,YAAY,EACZ,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,MAAM,CACP,CA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,7 +136,7 @@ program
|
||||
util_1.checkGitHubVersionInRange(gitHubVersion, logger, util_1.Mode.runner);
|
||||
let codeql;
|
||||
if (cmd.codeqlPath !== undefined) {
|
||||
codeql = codeql_1.getCodeQL(cmd.codeqlPath);
|
||||
codeql = await codeql_1.getCodeQL(cmd.codeqlPath);
|
||||
}
|
||||
else {
|
||||
codeql = (await init_1.initCodeQL(undefined, apiDetails, tempDir, toolsDir, gitHubVersion.type, logger)).codeql;
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
lib/util.js
generated
2
lib/util.js
generated
@@ -129,7 +129,7 @@ function getAddSnippetsFlag(userInput) {
|
||||
exports.getAddSnippetsFlag = getAddSnippetsFlag;
|
||||
/**
|
||||
* Get the codeql `--threads` value specified for the `threads` input.
|
||||
* If not value was specified, all available threads will be used.
|
||||
* If no value was specified, all available threads will be used.
|
||||
*
|
||||
* The value will be capped to the number of available CPUs.
|
||||
*
|
||||
|
||||
8
node_modules/.package-lock.json
generated
vendored
8
node_modules/.package-lock.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "1.0.12",
|
||||
"version": "1.0.15",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
@@ -2960,9 +2960,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/github-linguist": {
|
||||
"version": "2.4.3",
|
||||
"resolved": "https://registry.npmjs.org/github-linguist/-/github-linguist-2.4.3.tgz",
|
||||
"integrity": "sha512-hKWn1QQ+9oUyOIcUhPzi6AxTcAkYHg4OOwK79Pr05SBTFmdNr7GQkMDJabSGCZwu7SDhEb5YeUwUGqrUfyo7PA==",
|
||||
"version": "2.4.4",
|
||||
"resolved": "https://registry.npmjs.org/github-linguist/-/github-linguist-2.4.4.tgz",
|
||||
"integrity": "sha512-QSw/HfSTqA13t7eqNeGLd62ghnTsTQAUrJQKkUG100NZqqzpsKB9c7gH7lFaGU1ZWGmNSWfhG6q1Ok/xotOA/g==",
|
||||
"dependencies": {
|
||||
"chalk": "^2.2.0",
|
||||
"commander": "^2.11.0",
|
||||
|
||||
1
node_modules/github-linguist/.eslintcache
generated
vendored
Normal file
1
node_modules/github-linguist/.eslintcache
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[{"/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/cli.ts":"1","/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/directory.ts":"2","/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/file.ts":"3","/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/index.ts":"4","/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/languages.ts":"5","/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/utils.ts":"6","/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/declarations.d.ts":"7"},{"size":1802,"mtime":1629757721099,"results":"8","hashOfConfig":"9"},{"size":4764,"mtime":1629758968321,"results":"10","hashOfConfig":"9"},{"size":4177,"mtime":1629759033403,"results":"11","hashOfConfig":"9"},{"size":751,"mtime":1629758749896,"results":"12","hashOfConfig":"9"},{"size":5651,"mtime":1629759502034,"results":"13","hashOfConfig":"14"},{"size":541,"mtime":1629758671936,"results":"15","hashOfConfig":"9"},{"size":25,"mtime":1629758437358,"results":"16","hashOfConfig":"9"},{"filePath":"17","messages":"18","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1ug2nbr",{"filePath":"19","messages":"20","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"21","messages":"22","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"23","messages":"24","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"25","messages":"26","errorCount":1,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"1okz2by",{"filePath":"27","messages":"28","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/cli.ts",[],"/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/directory.ts",[],"/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/file.ts",[],"/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/index.ts",[],"/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/languages.ts",["31"],"/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/utils.ts",[],"/Users/andrew.eisenberg/Eclipse/git-repos/linguist/src/declarations.d.ts",[],{"ruleId":"32","severity":2,"message":"33","line":4,"column":21,"nodeType":"34","messageId":"35","endLine":4,"endColumn":44},"@typescript-eslint/no-var-requires","Require statement not part of import statement.","CallExpression","noVarReqs"]
|
||||
37
node_modules/github-linguist/.eslintrc.js
generated
vendored
37
node_modules/github-linguist/.eslintrc.js
generated
vendored
@@ -1,3 +1,38 @@
|
||||
module.exports = {
|
||||
extends: [require.resolve('@umijs/fabric/dist/eslint')],
|
||||
root: true,
|
||||
extends: [
|
||||
'eslint-config-airbnb-base',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
env: {
|
||||
node: true,
|
||||
es6: true,
|
||||
jest: true,
|
||||
},
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
node: {
|
||||
extensions: ['.js', '.ts']
|
||||
}
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
'import/extensions': 'off',
|
||||
'no-await-in-loop': 'off',
|
||||
'no-console': 'off',
|
||||
'class-methods-use-this': 'off',
|
||||
'no-continue': 'off',
|
||||
'@typescript-eslint/naming-convention': { format: 'camelCase' },
|
||||
'@typescript-eslint/explicit-member-accessibility': 0,
|
||||
'@typescript-eslint/interface-name-prefix': 0,
|
||||
'@typescript-eslint/no-explicit-any': 0,
|
||||
'@typescript-eslint/explicit-module-boundary-types': 0,
|
||||
'@typescript-eslint/naming-convention': 0,
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
22
node_modules/github-linguist/.github/workflows/ci.yml
generated
vendored
22
node_modules/github-linguist/.github/workflows/ci.yml
generated
vendored
@@ -1,26 +1,34 @@
|
||||
name: Node CI
|
||||
|
||||
on: [push]
|
||||
on:
|
||||
- push
|
||||
- workflow_dispatch
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
node_version: [10.x, 12.x]
|
||||
node_version: [12.x, 14.x]
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
steps:
|
||||
- run: git config --global core.autocrlf false
|
||||
if: matrix.os == 'windows-latest'
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js ${{ matrix.node_version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node_version }}
|
||||
|
||||
- run: echo ${{github.ref}}
|
||||
- run: yarn
|
||||
- run: yarn run lint
|
||||
- run: yarn run test
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- run: npm run lint
|
||||
|
||||
- run: npm run test
|
||||
env:
|
||||
CI: true
|
||||
PROGRESS: none
|
||||
NODE_ENV: test
|
||||
NODE_OPTIONS: --max_old_space_size=4096
|
||||
|
||||
16
node_modules/github-linguist/.prettierrc.js
generated
vendored
16
node_modules/github-linguist/.prettierrc.js
generated
vendored
@@ -1,5 +1,15 @@
|
||||
const fabric = require('@umijs/fabric');
|
||||
|
||||
module.exports = {
|
||||
...fabric.prettier,
|
||||
singleQuote: true,
|
||||
trailingComma: 'all',
|
||||
printWidth: 100,
|
||||
proseWrap: 'never',
|
||||
endOfLine: 'lf',
|
||||
overrides: [
|
||||
{
|
||||
files: '.prettierrc',
|
||||
options: {
|
||||
parser: 'json',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
17
node_modules/github-linguist/.vscode/launch.json
generated
vendored
17
node_modules/github-linguist/.vscode/launch.json
generated
vendored
@@ -6,26 +6,13 @@
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Tests",
|
||||
"program": "${workspaceFolder}/node_modules/.bin/umi-test",
|
||||
"program": "${workspaceFolder}/node_modules/.bin/jest",
|
||||
"request": "launch",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"type": "pwa-node",
|
||||
"args": ["--testNamePattern", "example dir info"]
|
||||
},
|
||||
{
|
||||
"type": "pwa-node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"program": "${workspaceFolder}/dist/index.js",
|
||||
"preLaunchTask": "tsc: build - tsconfig.json",
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/dist/**/*.js"
|
||||
]
|
||||
"args": ["--testNamePattern", "example dir info"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
2
node_modules/github-linguist/README.md
generated
vendored
2
node_modules/github-linguist/README.md
generated
vendored
@@ -63,7 +63,7 @@ const dir = new LocDir({
|
||||
include: // string or string[] containing path patterns to include (default include all)
|
||||
exclude: // string or string[] containing path patterns to exclude (default exclude none)
|
||||
});
|
||||
const { info } = dir.getInfo();
|
||||
const { info } = dir.loadInfo();
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
8
node_modules/github-linguist/dist/cli.js
generated
vendored
8
node_modules/github-linguist/dist/cli.js
generated
vendored
@@ -15,7 +15,7 @@ commander_1.default
|
||||
.description('count lines of code in a file')
|
||||
.action(async (pathPattern) => {
|
||||
try {
|
||||
const info = await (new file_1.LocFile(pathPattern).getFileInfo());
|
||||
const info = await new file_1.LocFile(pathPattern).getFileInfo();
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(chalk_1.default.cyan(`
|
||||
path: \t\t${pathPattern}
|
||||
@@ -42,9 +42,9 @@ const formatInfo = (info, languages) => `
|
||||
.join('')}`;
|
||||
commander_1.default.arguments('<cmd> [env]').action(async (cmd) => {
|
||||
try {
|
||||
const { info, languages } = await (new directory_1.LocDir({
|
||||
include: cmd
|
||||
}).loadInfo());
|
||||
const { info, languages } = await new directory_1.LocDir({
|
||||
include: cmd,
|
||||
}).loadInfo();
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(chalk_1.default.cyan(formatInfo(info, languages)));
|
||||
}
|
||||
|
||||
2
node_modules/github-linguist/dist/cli.js.map
generated
vendored
2
node_modules/github-linguist/dist/cli.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAEA,kDAA0B;AAC1B,0DAAgC;AAEhC,2CAAqC;AACrC,iCAA2C;AAC3C,mCAAqC;AAErC,mBAAO;KACJ,OAAO,CAAC,kBAAU,EAAE,EAAE,IAAI,CAAC;KAC3B,OAAO,CAAC,aAAa,CAAC;KACtB,WAAW,CAAC,+BAA+B,CAAC;KAC5C,MAAM,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;IAC5B,IAAI;QACF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,cAAO,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QAC5D,sCAAsC;QACtC,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,IAAI,CAAC;oBACC,WAAW;sBACT,IAAI,CAAC,SAAS;yBACX,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;wBACzB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;2BACpB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,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MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;0BACjB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC;KAC3C,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;IACX,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,OAAO,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,kBAAkB,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,MAAM,CACtF,YAAY,CAAC,KAAK,CACnB,eAAe,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;AACtF,CAAC,CAAC;KACD,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AAEhB,mBAAO,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACpD,IAAI;QACF,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,IAAI,kBAAM,CAAC;YAC3C,OAAO,EAAE,GAAG;SACb,CAAC,CAAC,QAAQ,EAAE,CAAC;QACd,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;KACtD;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;KACxB;AACH,CAAC,CAAC,CAAC;AAEH,mBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
||||
43
node_modules/github-linguist/dist/directory.js
generated
vendored
43
node_modules/github-linguist/dist/directory.js
generated
vendored
@@ -7,7 +7,6 @@ exports.LocDir = void 0;
|
||||
const globby_1 = __importDefault(require("globby"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
// @ts-ignore
|
||||
const slash2_1 = __importDefault(require("slash2"));
|
||||
const file_1 = require("./file");
|
||||
const languages_1 = require("./languages");
|
||||
@@ -26,16 +25,16 @@ const defaultExclude = [
|
||||
'**/*.snap',
|
||||
// java
|
||||
'**/target',
|
||||
"**/*.class",
|
||||
"**/*.o",
|
||||
"**/bin",
|
||||
"**/*.map",
|
||||
'**/*.class',
|
||||
'**/*.o',
|
||||
'**/bin',
|
||||
'**/*.map',
|
||||
// python
|
||||
"**/*.pyc",
|
||||
"**/*.pyo",
|
||||
'**/*.pyc',
|
||||
'**/*.pyo',
|
||||
// other
|
||||
"**/*.dil",
|
||||
"**/*.ra",
|
||||
'**/*.dil',
|
||||
'**/*.ra',
|
||||
// images
|
||||
'**/*.png',
|
||||
'**/*.jpg',
|
||||
@@ -97,6 +96,12 @@ const defaultExclude = [
|
||||
'**/*.tbz',
|
||||
'**/*.tgz',
|
||||
];
|
||||
function ensureArray(arr, dfault) {
|
||||
if (!arr) {
|
||||
return dfault ? [dfault] : [];
|
||||
}
|
||||
return Array.isArray(arr) ? arr : [arr];
|
||||
}
|
||||
/**
|
||||
* Collect the info of a directory.
|
||||
*/
|
||||
@@ -136,12 +141,12 @@ class LocDir {
|
||||
// that end in .ts because the globstar indicates 0 or more directory paths.
|
||||
this.exclude = ensureArray(options.exclude)
|
||||
.concat(defaultExclude)
|
||||
.map(item => item.endsWith('**') ? item : `${item}/**`);
|
||||
.map((item) => (item.endsWith('**') ? item : `${item}/**`));
|
||||
// remove all leading './' since this messes up globstar matches in the
|
||||
// excludes.
|
||||
this.include = ensureArray(options.include, '**')
|
||||
.map(item => item.startsWith('./') ? item.substring(2) : item)
|
||||
.map(item => item.endsWith('**') ? item : `${item}/**`);
|
||||
.map((item) => (item.startsWith('./') ? item.substring(2) : item))
|
||||
.map((item) => (item.endsWith('**') ? item : `${item}/**`));
|
||||
this.cwd = options.cwd || process.cwd();
|
||||
this.analysisLanguages = options.analysisLanguages;
|
||||
}
|
||||
@@ -152,13 +157,14 @@ class LocDir {
|
||||
const paths = await globby_1.default(this.include, {
|
||||
cwd: this.cwd,
|
||||
ignore: this.exclude,
|
||||
nodir: true
|
||||
nodir: true,
|
||||
});
|
||||
const files = [];
|
||||
const info = { ...defaultInfo };
|
||||
let languages = {};
|
||||
// We _could_ use Promise.all to count the files in parallel, but that
|
||||
// would lead to out of memory errors when there are many files.
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const pathItem of paths) {
|
||||
const fullPath = slash2_1.default(path_1.default.join(this.cwd, pathItem));
|
||||
if (!pathItem ||
|
||||
@@ -195,16 +201,9 @@ class LocDir {
|
||||
* and this language is not one of them.
|
||||
*/
|
||||
ignoreLanguage(pathItem) {
|
||||
return this.analysisLanguages && !this.analysisLanguages.includes(this.allLanguages.getType(pathItem));
|
||||
return (this.analysisLanguages &&
|
||||
!this.analysisLanguages.includes(this.allLanguages.getType(pathItem)));
|
||||
}
|
||||
}
|
||||
exports.LocDir = LocDir;
|
||||
function ensureArray(arr, dfault) {
|
||||
if (!arr) {
|
||||
return dfault ? [dfault] : [];
|
||||
}
|
||||
return Array.isArray(arr)
|
||||
? arr
|
||||
: [arr];
|
||||
}
|
||||
//# sourceMappingURL=directory.js.map
|
||||
2
node_modules/github-linguist/dist/directory.js.map
generated
vendored
2
node_modules/github-linguist/dist/directory.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"directory.js","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,wDAA0B;AAC1B,gDAAwB;AACxB,aAAa;AACb,oDAA2B;AAE3B,iCAA2C;AAC3C,2CAAwC;AAExC,MAAM,WAAW,GAAa;IAC5B,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;CACX,CAAC;AAmBF,MAAM,cAAc,GAAG;IACrB,aAAa;IACb,UAAU;IACV,WAAW;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;IACK,cAAc,CAAC,QAAgB;QACrC,OAAO,CACL,IAAI,CAAC,iBAAiB;YACtB,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CACtE,CAAC;IACJ,CAAC;CACF;AA7FD,wBA6FC"}
|
||||
29
node_modules/github-linguist/dist/file.js
generated
vendored
29
node_modules/github-linguist/dist/file.js
generated
vendored
@@ -27,8 +27,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LocFile = void 0;
|
||||
const fs = __importStar(require("fs-extra"));
|
||||
const Path = __importStar(require("path"));
|
||||
// @ts-ignore
|
||||
const slash2_1 = __importDefault(require("slash2"));
|
||||
const languages_1 = require("./languages");
|
||||
const DefaultLine = {
|
||||
@@ -84,15 +82,16 @@ class LocFile {
|
||||
let codeLength = lines.length;
|
||||
const total = codeLength;
|
||||
let inMultiLineComment = false;
|
||||
lines.forEach((line) => {
|
||||
lines.forEach((origLine) => {
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
let lineType = 'code';
|
||||
line = line.trim();
|
||||
const line = origLine.trim();
|
||||
if (inMultiLineComment) {
|
||||
let noCode = true;
|
||||
if (regexes.multiLineCommentClose.test(line)) {
|
||||
if ((_a = regexes.multiLineCommentClose) === null || _a === void 0 ? void 0 : _a.test(line)) {
|
||||
// line contains the end of a multi-line comment
|
||||
inMultiLineComment = false;
|
||||
if (!regexes.multiLineCommentCloseEnd.test(line)) {
|
||||
if (!((_b = regexes.multiLineCommentCloseEnd) === null || _b === void 0 ? void 0 : _b.test(line))) {
|
||||
// the multiline comment does not end this line.
|
||||
// there is real code on it.
|
||||
noCode = false;
|
||||
@@ -106,21 +105,21 @@ class LocFile {
|
||||
}
|
||||
else if (line) {
|
||||
// non-empty line
|
||||
if (regexes.multiLineCommentOpen.test(line)) {
|
||||
if ((_c = regexes.multiLineCommentOpen) === null || _c === void 0 ? void 0 : _c.test(line)) {
|
||||
// line contains the start of a multi-line comment
|
||||
// might contain some real code, but we'll let that slide
|
||||
if (!regexes.multiLineCommentOpenAndClose.test(line)) {
|
||||
if (!((_d = regexes.multiLineCommentOpenAndClose) === null || _d === void 0 ? void 0 : _d.test(line))) {
|
||||
// comment is not also closed on this line
|
||||
inMultiLineComment = true;
|
||||
}
|
||||
if (regexes.multiLineCommentOpenStart.test(line)) {
|
||||
if ((_e = regexes.multiLineCommentOpenStart) === null || _e === void 0 ? void 0 : _e.test(line)) {
|
||||
// The comment starts the line. There is no other code on this line
|
||||
commentLength += 1;
|
||||
codeLength -= 1;
|
||||
lineType = 'comm';
|
||||
}
|
||||
}
|
||||
else if (regexes.singleLineComment.test(line)) {
|
||||
else if ((_f = regexes.singleLineComment) === null || _f === void 0 ? void 0 : _f.test(line)) {
|
||||
// line contains only a single line comment
|
||||
commentLength += 1;
|
||||
codeLength -= 1;
|
||||
@@ -155,14 +154,16 @@ class LocFile {
|
||||
throw new Error(`Error: file ${this.rawPath} does not exist.`);
|
||||
}
|
||||
let newData = data;
|
||||
const info = Object.assign({}, DefaultFileInfo);
|
||||
const name = this.path.split(Path.sep).pop() || '';
|
||||
const info = { ...DefaultFileInfo };
|
||||
// note: do not use Path.sep here since we have already
|
||||
// translated the path to a posix path using slash(...).
|
||||
const name = this.path.split('/').pop() || '';
|
||||
try {
|
||||
const stat = await fs.stat(this.path);
|
||||
if (!stat.isFile()) {
|
||||
return info;
|
||||
}
|
||||
newData = data || await fs.readFile(this.path, 'utf-8');
|
||||
newData = data || (await fs.readFile(this.path, 'utf-8'));
|
||||
info.name = name;
|
||||
info.size = (stat && stat.size) || 0;
|
||||
info.languages = this.languages.getType(this.path);
|
||||
@@ -180,7 +181,7 @@ class LocFile {
|
||||
return info;
|
||||
}
|
||||
getFileInfoByContent(name, data) {
|
||||
const info = Object.assign({}, DefaultFileInfo);
|
||||
const info = { ...DefaultFileInfo };
|
||||
info.name = name;
|
||||
info.languages = this.languages.getType(name);
|
||||
info.lines = this.filterData(data, this.languages.getRegexes(info.languages));
|
||||
|
||||
2
node_modules/github-linguist/dist/file.js.map
generated
vendored
2
node_modules/github-linguist/dist/file.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"file.js","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,2CAA6B;AAC7B,aAAa;AACb,oDAA2B;AAE3B,2CAAiD;AAejD,MAAM,WAAW,GAAa;IAC5B,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;CACX,CAAC;AAEF,MAAM,eAAe,GAAa;IAChC,IAAI,EAAE,EAAE;IACR,SAAS,EAAE,EAAE;IACb,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,WAAW;CACnB,CAAC;AAEF;;GAEG;AACH,MAAa,OAAO;IAMlB;;OAEG;IACH,YAAY,OAAe,EAAU,QAAQ,KAAK;;;;;mBAAb;;QARrC;;;;;WAAoB;QACpB;;;;;WAAwB;QAExB;;;;mBAAoB,IAAI,qBAAS,EAAE;WAAC;QAUpC;;;;mBAAqB,CAAC,IAAY,EAAE,OAAgB,EAAY,EAAE;gBAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC/B,IAAI,aAAa,GAAG,CAAC,CAAC;gBACtB,IAAI,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;gBAC9B,MAAM,KAAK,GAAG,UAAU,CAAC;gBAEzB,IAAI,kBAAkB,GAAG,KAAK,CAAC;gBAC/B,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;oBAErB,IAAI,QAAQ,GAAG,MAAM,CAAC;oBACtB,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;oBAEnB,IAAI,kBAAkB,EAAE;wBAEtB,IAAI,MAAM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C;QAC9C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAC9E,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA/HD,0BA+HC"}
|
||||
1
node_modules/github-linguist/dist/index.js
generated
vendored
1
node_modules/github-linguist/dist/index.js
generated
vendored
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// @ts-ignore
|
||||
const slash2_1 = __importDefault(require("slash2"));
|
||||
const fs_extra_1 = __importDefault(require("fs-extra"));
|
||||
const directory_1 = require("./directory");
|
||||
|
||||
2
node_modules/github-linguist/dist/index.js.map
generated
vendored
2
node_modules/github-linguist/dist/index.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,aAAa;AACb,oDAA2B;AAC3B,wDAA0B;AAE1B,2CAAgD;AAChD,iCAAiC;AAEjC,yCAAoD;AAA3C,mGAAA,MAAM,OAAA;AACf,+BAA2C;AAAlC,+FAAA,OAAO,OAAA;AAEhB,MAAM,GAAG,GAAG,KAAK,EACf,SAAiB,EACG,EAAE;IACtB,MAAM,IAAI,GAAG,MAAM,kBAAE,CAAC,IAAI,CAAC,gBAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7C,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE;QACjB,MAAM,OAAO,GAAG,IAAI,cAAO,CAAC,gBAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC9C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CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE;SAC3D,CAAC;KACH;IACD,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,EAAE,GAAG,EAAE,gBAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
||||
16
node_modules/github-linguist/dist/languages.d.ts
generated
vendored
16
node_modules/github-linguist/dist/languages.d.ts
generated
vendored
@@ -1,4 +1,10 @@
|
||||
export interface DetectorOptions {
|
||||
export interface Regexes {
|
||||
singleLineComment: RegExp;
|
||||
multiLineCommentOpen?: RegExp;
|
||||
multiLineCommentOpenStart?: RegExp;
|
||||
multiLineCommentClose?: RegExp;
|
||||
multiLineCommentCloseEnd?: RegExp;
|
||||
multiLineCommentOpenAndClose?: RegExp;
|
||||
}
|
||||
/**
|
||||
* detecte program language through file extension
|
||||
@@ -37,11 +43,3 @@ export declare class Languages {
|
||||
*/
|
||||
getType(path: string): string;
|
||||
}
|
||||
export interface Regexes {
|
||||
singleLineComment: RegExp;
|
||||
multiLineCommentOpen: RegExp;
|
||||
multiLineCommentOpenStart: RegExp;
|
||||
multiLineCommentClose: RegExp;
|
||||
multiLineCommentCloseEnd: RegExp;
|
||||
multiLineCommentOpenAndClose: RegExp;
|
||||
}
|
||||
|
||||
139
node_modules/github-linguist/dist/languages.js
generated
vendored
139
node_modules/github-linguist/dist/languages.js
generated
vendored
@@ -1,9 +1,11 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Languages = void 0;
|
||||
const languages_json_1 = __importDefault(require("language-map/languages.json"));
|
||||
const utils_1 = require("./utils");
|
||||
// tslint:disable-next-line
|
||||
const languageMap = require('language-map');
|
||||
/**
|
||||
* The extension map can contain multiple languages with the same extension,
|
||||
* but we only want a single one. For the moment, these clashes are resolved
|
||||
@@ -12,7 +14,70 @@ const languageMap = require('language-map');
|
||||
* where the extension is ambiguous. The ordering of the list matters and
|
||||
* languages earlier on will get a higher priority when resolving clashes.
|
||||
*/
|
||||
const importantLanguages = ["javascript", "typescript", "ruby", "python", "java", "c", "c++", "c#", "rust", "scala", "perl", "go"];
|
||||
const importantLanguages = [
|
||||
'javascript',
|
||||
'typescript',
|
||||
'ruby',
|
||||
'python',
|
||||
'java',
|
||||
'c',
|
||||
'c++',
|
||||
'c#',
|
||||
'rust',
|
||||
'scala',
|
||||
'perl',
|
||||
'go',
|
||||
];
|
||||
const ALL_REGEXES = {
|
||||
c: {
|
||||
// matches when // are the first two characters of a line
|
||||
singleLineComment: /^\/\//,
|
||||
// matches when /* exists in a line
|
||||
multiLineCommentOpen: /\/\*/,
|
||||
// matches when /* starts a line
|
||||
multiLineCommentOpenStart: /^\/\*/,
|
||||
// matches when */ exists a line
|
||||
multiLineCommentClose: /\*\//,
|
||||
// matches when */ ends a line
|
||||
multiLineCommentCloseEnd: /\*\/$/,
|
||||
// matches /* ... */
|
||||
multiLineCommentOpenAndClose: /\/\*.*\*\//,
|
||||
},
|
||||
python: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
},
|
||||
ruby: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
// For ruby multiline comments, =begin and =end must be
|
||||
// on their own lines
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /^=begin/,
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^=begin/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /^=end/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /^=end$/,
|
||||
// not possible in ruby
|
||||
multiLineCommentOpenAndClose: /^\0$/,
|
||||
},
|
||||
html: {
|
||||
// There is no single line comment
|
||||
singleLineComment: /^\0$/,
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /<!--/,
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^<!--/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /-->/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /-->$/,
|
||||
// matches <!-- ... -->
|
||||
multiLineCommentOpenAndClose: /<!--.*-->/,
|
||||
},
|
||||
};
|
||||
/**
|
||||
* detecte program language through file extension
|
||||
*
|
||||
@@ -39,8 +104,8 @@ class Languages {
|
||||
writable: true,
|
||||
value: () => {
|
||||
const extensions = {};
|
||||
Object.keys(languageMap).forEach((language) => {
|
||||
const languageMode = languageMap[language];
|
||||
Object.keys(languages_json_1.default).forEach((language) => {
|
||||
const languageMode = languages_json_1.default[language];
|
||||
const languageExtensions = (languageMode && languageMode.extensions) || [];
|
||||
languageExtensions.forEach((extension) => {
|
||||
const lowerCaseExtension = extension.toLowerCase();
|
||||
@@ -61,7 +126,7 @@ class Languages {
|
||||
}
|
||||
});
|
||||
});
|
||||
return Object.assign({}, extensions, utils_1.ExtensionJustify);
|
||||
return { ...extensions, ...utils_1.ExtensionJustify };
|
||||
}
|
||||
});
|
||||
this.extensionMap = this.loadExtensionMap();
|
||||
@@ -102,66 +167,4 @@ class Languages {
|
||||
}
|
||||
}
|
||||
exports.Languages = Languages;
|
||||
const ALL_REGEXES = {
|
||||
c: {
|
||||
// matches when // are the first two characters of a line
|
||||
singleLineComment: /^\/\//,
|
||||
// matches when /* exists in a line
|
||||
multiLineCommentOpen: /\/\*/,
|
||||
// matches when /* starts a line
|
||||
multiLineCommentOpenStart: /^\/\*/,
|
||||
// matches when */ exists a line
|
||||
multiLineCommentClose: /\*\//,
|
||||
// matches when */ ends a line
|
||||
multiLineCommentCloseEnd: /\*\/$/,
|
||||
// matches /* ... */
|
||||
multiLineCommentOpenAndClose: /\/\*.*\*\//
|
||||
},
|
||||
python: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
// matches when """ starts a line. This is not right, since
|
||||
// a multiline string is not always a comment, but for the
|
||||
// sake of simplicity, we will do that here.
|
||||
multiLineCommentOpen: /"""/,
|
||||
// matches when """ starts a line
|
||||
multiLineCommentOpenStart: /^"""/,
|
||||
// matches when """ exists in a line
|
||||
multiLineCommentClose: /"""/,
|
||||
// matches when """ ends a line
|
||||
multiLineCommentCloseEnd: /"""$/,
|
||||
// matches """ ... """
|
||||
multiLineCommentOpenAndClose: /""".*"""/
|
||||
},
|
||||
ruby: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
// For ruby multiline comments, =begin and =end must be
|
||||
// on their own lines
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /^=begin/,
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^=begin/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /^=end/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /^=end$/,
|
||||
// not possible in ruby
|
||||
multiLineCommentOpenAndClose: /^\0$/
|
||||
},
|
||||
html: {
|
||||
// There is no single line comment
|
||||
singleLineComment: /^\0$/,
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /<!--/,
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^<!--/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /-->/,
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /-->$/,
|
||||
// matches <!-- ... -->
|
||||
multiLineCommentOpenAndClose: /<!--.*-->/
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=languages.js.map
|
||||
2
node_modules/github-linguist/dist/languages.js.map
generated
vendored
2
node_modules/github-linguist/dist/languages.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"languages.js","sourceRoot":"","sources":["../src/languages.ts"],"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WAAW,CAAC,IAAI,CAAC;YAE1B,KAAK,MAAM;gBACT,OAAO,WAAW,CAAC,IAAI,CAAC;YAE1B,KAAK,QAAQ;gBACX,OAAO,WAAW,CAAC,MAAM,CAAC;YAE5B;gBACE,2EAA2E;gBAC3E,OAAO,WAAW,CAAC,CAAC,CAAC;SACxB;IACH,CAAC;IAED;;OAEG;IACI,eAAe;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED;;OAEG;IACI,OAAO,CAAC,IAAY;QACzB,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;IAChD,CAAC;CACF;AAnFD,8BAmFC"}
|
||||
1
node_modules/github-linguist/dist/utils.js
generated
vendored
1
node_modules/github-linguist/dist/utils.js
generated
vendored
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ExtensionJustify = exports.getVersion = void 0;
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
// @ts-ignore
|
||||
const slash2_1 = __importDefault(require("slash2"));
|
||||
const packagePath = slash2_1.default(path_1.default.join(__dirname, '../', 'package.json'));
|
||||
/**
|
||||
|
||||
2
node_modules/github-linguist/dist/utils.js.map
generated
vendored
2
node_modules/github-linguist/dist/utils.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,aAAa;AACb,oDAA2B;AAE3B,MAAM,WAAW,GAAG,gBAAK,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,SAAgB,UAAU;IACxB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAErE,OAAO,CAAC,WAAW,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,kBAAkB,CAAC;AACpE,CAAC;AAJD,gCAIC;AAEY,QAAA,gBAAgB,GAAG;IAC9B,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;CACrB,CAAC"}
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,oDAA2B;AAE3B,MAAM,WAAW,GAAG,gBAAK,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,SAAgB,UAAU;IACxB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAErE,OAAO,CAAC,WAAW,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI,kBAAkB,CAAC;AACpE,CAAC;AAJD,gCAIC;AAEY,QAAA,gBAAgB,GAAG;IAC9B,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;CACrB,CAAC"}
|
||||
14
node_modules/github-linguist/jest.config.ts
generated
vendored
Normal file
14
node_modules/github-linguist/jest.config.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* For a detailed explanation regarding each configuration property and type check, visit:
|
||||
* https://jestjs.io/docs/configuration
|
||||
*/
|
||||
|
||||
export default {
|
||||
// Automatically clear mock calls and instances between every test
|
||||
clearMocks: true,
|
||||
|
||||
// Indicates whether each individual test should be reported during the run
|
||||
verbose: undefined,
|
||||
|
||||
preset: 'ts-jest',
|
||||
};
|
||||
26
node_modules/github-linguist/package.json
generated
vendored
26
node_modules/github-linguist/package.json
generated
vendored
@@ -1,12 +1,11 @@
|
||||
{
|
||||
"name": "github-linguist",
|
||||
"version": "2.4.3",
|
||||
"version": "2.4.4",
|
||||
"description": "A tool to count lines of code in a repository powered by github-linguist langauge mappings.",
|
||||
"keywords": [
|
||||
"loc",
|
||||
"cloc",
|
||||
"linguist",
|
||||
"umijs",
|
||||
"lines of code"
|
||||
],
|
||||
"homepage": "https://github.com/aeisenberg/linguist#readme",
|
||||
@@ -33,10 +32,10 @@
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc -d",
|
||||
"lint": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
|
||||
"lint": "eslint --cache --ext .ts ./src",
|
||||
"prettier": "prettier -c --write \"**/*\"",
|
||||
"prepublishOnly": "npm run build",
|
||||
"test": "umi-test"
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "^2.2.0",
|
||||
@@ -52,15 +51,22 @@
|
||||
"@types/commander": "^2.11.0",
|
||||
"@types/fs-extra": "^4.0.2",
|
||||
"@types/globby": "^6.1.0",
|
||||
"@types/jest": "^25.1.5",
|
||||
"@types/jest": "^27.0.1",
|
||||
"@types/mocha": "^2.2.43",
|
||||
"@types/node": "^8.0.45",
|
||||
"@umijs/fabric": "^2.0.7",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.3",
|
||||
"@typescript-eslint/parser": "^4.29.3",
|
||||
"chai": "^4.1.2",
|
||||
"coveralls": "^3.0.0",
|
||||
"eslint": "^6.8.0",
|
||||
"prettier": "^2.0.2",
|
||||
"typescript": "^3.8.3",
|
||||
"umi-test": "^1.9.6"
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.24.1",
|
||||
"eslint-plugin-prettier": "^3.4.1",
|
||||
"jest": "^27.0.6",
|
||||
"prettier": "^2.3.2",
|
||||
"ts-jest": "^27.0.5",
|
||||
"ts-node": "^10.2.1",
|
||||
"typescript": "^3.9.10"
|
||||
}
|
||||
}
|
||||
8
node_modules/github-linguist/src/cli.ts
generated
vendored
8
node_modules/github-linguist/src/cli.ts
generated
vendored
@@ -13,7 +13,7 @@ program
|
||||
.description('count lines of code in a file')
|
||||
.action(async (pathPattern) => {
|
||||
try {
|
||||
const info = await (new LocFile(pathPattern).getFileInfo());
|
||||
const info = await new LocFile(pathPattern).getFileInfo();
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(
|
||||
chalk.cyan(`
|
||||
@@ -52,9 +52,9 @@ const formatInfo = (
|
||||
|
||||
program.arguments('<cmd> [env]').action(async (cmd) => {
|
||||
try {
|
||||
const { info, languages } = await (new LocDir({
|
||||
include: cmd
|
||||
}).loadInfo());
|
||||
const { info, languages } = await new LocDir({
|
||||
include: cmd,
|
||||
}).loadInfo();
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(chalk.cyan(formatInfo(info, languages)));
|
||||
} catch (e) {
|
||||
|
||||
2
node_modules/github-linguist/src/declarations.d.ts
generated
vendored
Normal file
2
node_modules/github-linguist/src/declarations.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare module 'slash2';
|
||||
declare module 'language-map/languages.json';
|
||||
53
node_modules/github-linguist/src/directory.ts
generated
vendored
53
node_modules/github-linguist/src/directory.ts
generated
vendored
@@ -1,7 +1,6 @@
|
||||
import globby from 'globby';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
// @ts-ignore
|
||||
import slash from 'slash2';
|
||||
|
||||
import { LineInfo, LocFile } from './file';
|
||||
@@ -41,18 +40,18 @@ const defaultExclude = [
|
||||
|
||||
// java
|
||||
'**/target',
|
||||
"**/*.class",
|
||||
"**/*.o",
|
||||
"**/bin",
|
||||
"**/*.map",
|
||||
'**/*.class',
|
||||
'**/*.o',
|
||||
'**/bin',
|
||||
'**/*.map',
|
||||
|
||||
// python
|
||||
"**/*.pyc",
|
||||
"**/*.pyo",
|
||||
'**/*.pyc',
|
||||
'**/*.pyo',
|
||||
|
||||
// other
|
||||
"**/*.dil",
|
||||
"**/*.ra",
|
||||
'**/*.dil',
|
||||
'**/*.ra',
|
||||
|
||||
// images
|
||||
'**/*.png',
|
||||
@@ -122,29 +121,39 @@ const defaultExclude = [
|
||||
'**/*.tgz',
|
||||
];
|
||||
|
||||
function ensureArray(arr?: string[] | string, dfault?: string) {
|
||||
if (!arr) {
|
||||
return dfault ? [dfault] : [];
|
||||
}
|
||||
return Array.isArray(arr) ? arr : [arr];
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect the info of a directory.
|
||||
*/
|
||||
export class LocDir {
|
||||
private cwd: string;
|
||||
|
||||
private include: string[];
|
||||
|
||||
private exclude: string[];
|
||||
|
||||
private analysisLanguages?: string[];
|
||||
|
||||
private allLanguages = new Languages();
|
||||
|
||||
constructor(options: LocDirOptions) {
|
||||
|
||||
// ensure all excludes are globstar. Note that '**/*.ts/**' matches files
|
||||
// that end in .ts because the globstar indicates 0 or more directory paths.
|
||||
this.exclude = ensureArray(options.exclude)
|
||||
.concat(defaultExclude)
|
||||
.map(item => item.endsWith('**') ? item : `${item}/**`);
|
||||
.map((item) => (item.endsWith('**') ? item : `${item}/**`));
|
||||
|
||||
// remove all leading './' since this messes up globstar matches in the
|
||||
// excludes.
|
||||
this.include = ensureArray(options.include, '**')
|
||||
.map(item => item.startsWith('./') ? item.substring(2) : item)
|
||||
.map(item => item.endsWith('**') ? item : `${item}/**`);
|
||||
.map((item) => (item.startsWith('./') ? item.substring(2) : item))
|
||||
.map((item) => (item.endsWith('**') ? item : `${item}/**`));
|
||||
this.cwd = options.cwd || process.cwd();
|
||||
this.analysisLanguages = options.analysisLanguages;
|
||||
}
|
||||
@@ -156,7 +165,7 @@ export class LocDir {
|
||||
const paths = await globby(this.include, {
|
||||
cwd: this.cwd,
|
||||
ignore: this.exclude,
|
||||
nodir: true
|
||||
nodir: true,
|
||||
});
|
||||
const files: string[] = [];
|
||||
const info: LineInfo = { ...defaultInfo };
|
||||
@@ -168,6 +177,7 @@ export class LocDir {
|
||||
|
||||
// We _could_ use Promise.all to count the files in parallel, but that
|
||||
// would lead to out of memory errors when there are many files.
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const pathItem of paths) {
|
||||
const fullPath = slash(path.join(this.cwd, pathItem));
|
||||
if (
|
||||
@@ -178,6 +188,7 @@ export class LocDir {
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const file = new LocFile(fullPath);
|
||||
const fileLineInfo = await file.getFileInfo();
|
||||
const { lines } = fileLineInfo;
|
||||
@@ -208,15 +219,9 @@ export class LocDir {
|
||||
* and this language is not one of them.
|
||||
*/
|
||||
private ignoreLanguage(pathItem: string): boolean {
|
||||
return this.analysisLanguages && !this.analysisLanguages.includes(this.allLanguages.getType(pathItem));
|
||||
return (
|
||||
this.analysisLanguages &&
|
||||
!this.analysisLanguages.includes(this.allLanguages.getType(pathItem))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function ensureArray(arr?: string[] | string, dfault?: string) {
|
||||
if (!arr) {
|
||||
return dfault ? [dfault] : [];
|
||||
}
|
||||
return Array.isArray(arr)
|
||||
? arr
|
||||
: [arr];
|
||||
}
|
||||
|
||||
37
node_modules/github-linguist/src/file.ts
generated
vendored
37
node_modules/github-linguist/src/file.ts
generated
vendored
@@ -3,8 +3,6 @@
|
||||
*/
|
||||
|
||||
import * as fs from 'fs-extra';
|
||||
import * as Path from 'path';
|
||||
// @ts-ignore
|
||||
import slash from 'slash2';
|
||||
|
||||
import { Languages, Regexes } from './languages';
|
||||
@@ -40,6 +38,7 @@ const DefaultFileInfo: FileInfo = {
|
||||
*/
|
||||
export class LocFile {
|
||||
public path: string;
|
||||
|
||||
private rawPath: string;
|
||||
|
||||
private languages = new Languages();
|
||||
@@ -59,18 +58,16 @@ export class LocFile {
|
||||
const total = codeLength;
|
||||
|
||||
let inMultiLineComment = false;
|
||||
lines.forEach((line) => {
|
||||
|
||||
lines.forEach((origLine) => {
|
||||
let lineType = 'code';
|
||||
line = line.trim();
|
||||
const line = origLine.trim();
|
||||
|
||||
if (inMultiLineComment) {
|
||||
|
||||
let noCode = true;
|
||||
if (regexes.multiLineCommentClose.test(line)) {
|
||||
if (regexes.multiLineCommentClose?.test(line)) {
|
||||
// line contains the end of a multi-line comment
|
||||
inMultiLineComment = false;
|
||||
if (!regexes.multiLineCommentCloseEnd.test(line)) {
|
||||
if (!regexes.multiLineCommentCloseEnd?.test(line)) {
|
||||
// the multiline comment does not end this line.
|
||||
// there is real code on it.
|
||||
noCode = false;
|
||||
@@ -82,33 +79,29 @@ export class LocFile {
|
||||
commentLength += 1;
|
||||
codeLength -= 1;
|
||||
}
|
||||
|
||||
} else if (line) {
|
||||
|
||||
// non-empty line
|
||||
if (regexes.multiLineCommentOpen.test(line)) {
|
||||
if (regexes.multiLineCommentOpen?.test(line)) {
|
||||
// line contains the start of a multi-line comment
|
||||
// might contain some real code, but we'll let that slide
|
||||
|
||||
if (!regexes.multiLineCommentOpenAndClose.test(line)) {
|
||||
if (!regexes.multiLineCommentOpenAndClose?.test(line)) {
|
||||
// comment is not also closed on this line
|
||||
inMultiLineComment = true;
|
||||
}
|
||||
|
||||
if (regexes.multiLineCommentOpenStart.test(line)) {
|
||||
if (regexes.multiLineCommentOpenStart?.test(line)) {
|
||||
// The comment starts the line. There is no other code on this line
|
||||
commentLength += 1;
|
||||
codeLength -= 1;
|
||||
lineType = 'comm';
|
||||
}
|
||||
|
||||
} else if (regexes.singleLineComment.test(line)) {
|
||||
} else if (regexes.singleLineComment?.test(line)) {
|
||||
// line contains only a single line comment
|
||||
commentLength += 1;
|
||||
codeLength -= 1;
|
||||
lineType = 'comm';
|
||||
}
|
||||
|
||||
} else {
|
||||
// empty line
|
||||
codeLength -= 1;
|
||||
@@ -116,7 +109,7 @@ export class LocFile {
|
||||
}
|
||||
|
||||
if (this.debug) {
|
||||
console.log(lineType, line)
|
||||
console.log(lineType, line);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -137,14 +130,16 @@ export class LocFile {
|
||||
}
|
||||
|
||||
let newData = data;
|
||||
const info: FileInfo = Object.assign({}, DefaultFileInfo);
|
||||
const name = this.path.split(Path.sep).pop() || '';
|
||||
const info: FileInfo = { ...DefaultFileInfo };
|
||||
// note: do not use Path.sep here since we have already
|
||||
// translated the path to a posix path using slash(...).
|
||||
const name = this.path.split('/').pop() || '';
|
||||
try {
|
||||
const stat = await fs.stat(this.path);
|
||||
if (!stat.isFile()) {
|
||||
return info;
|
||||
}
|
||||
newData = data || await fs.readFile(this.path, 'utf-8');
|
||||
newData = data || (await fs.readFile(this.path, 'utf-8'));
|
||||
info.name = name;
|
||||
info.size = (stat && stat.size) || 0;
|
||||
info.languages = this.languages.getType(this.path);
|
||||
@@ -162,7 +157,7 @@ export class LocFile {
|
||||
}
|
||||
|
||||
public getFileInfoByContent(name: string, data: string): FileInfo {
|
||||
const info: FileInfo = Object.assign({}, DefaultFileInfo);
|
||||
const info: FileInfo = { ...DefaultFileInfo };
|
||||
info.name = name;
|
||||
info.languages = this.languages.getType(name);
|
||||
info.lines = this.filterData(data, this.languages.getRegexes(info.languages));
|
||||
|
||||
5
node_modules/github-linguist/src/index.ts
generated
vendored
5
node_modules/github-linguist/src/index.ts
generated
vendored
@@ -1,4 +1,3 @@
|
||||
// @ts-ignore
|
||||
import slash from 'slash2';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
@@ -8,9 +7,7 @@ import { LocFile } from './file';
|
||||
export { LocDir, LocDirOptions } from './directory';
|
||||
export { LocFile, LineInfo } from './file';
|
||||
|
||||
const loc = async (
|
||||
fileOrDir: string,
|
||||
): Promise<LocResult> => {
|
||||
const loc = async (fileOrDir: string): Promise<LocResult> => {
|
||||
const stat = await fs.stat(slash(fileOrDir));
|
||||
if (stat.isFile()) {
|
||||
const locFile = new LocFile(slash(fileOrDir));
|
||||
|
||||
228
node_modules/github-linguist/src/languages.ts
generated
vendored
228
node_modules/github-linguist/src/languages.ts
generated
vendored
@@ -1,16 +1,10 @@
|
||||
import languageMap from 'language-map/languages.json';
|
||||
import { ExtensionJustify } from './utils';
|
||||
|
||||
// tslint:disable-next-line
|
||||
const languageMap = require('language-map');
|
||||
// tslint:disable-next-line
|
||||
// const lang = require('language-classifier');
|
||||
|
||||
interface ExtensionsTypes {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export interface DetectorOptions {}
|
||||
|
||||
/**
|
||||
* The extension map can contain multiple languages with the same extension,
|
||||
* but we only want a single one. For the moment, these clashes are resolved
|
||||
@@ -19,8 +13,116 @@ export interface DetectorOptions {}
|
||||
* where the extension is ambiguous. The ordering of the list matters and
|
||||
* languages earlier on will get a higher priority when resolving clashes.
|
||||
*/
|
||||
const importantLanguages = ["javascript", "typescript", "ruby", "python", "java", "c", "c++", "c#", "rust", "scala", "perl", "go"];
|
||||
const importantLanguages = [
|
||||
'javascript',
|
||||
'typescript',
|
||||
'ruby',
|
||||
'python',
|
||||
'java',
|
||||
'c',
|
||||
'c++',
|
||||
'c#',
|
||||
'rust',
|
||||
'scala',
|
||||
'perl',
|
||||
'go',
|
||||
];
|
||||
|
||||
export interface Regexes {
|
||||
singleLineComment: RegExp;
|
||||
multiLineCommentOpen?: RegExp;
|
||||
multiLineCommentOpenStart?: RegExp;
|
||||
multiLineCommentClose?: RegExp;
|
||||
multiLineCommentCloseEnd?: RegExp;
|
||||
multiLineCommentOpenAndClose?: RegExp;
|
||||
}
|
||||
|
||||
const ALL_REGEXES: Record<string, Regexes> = {
|
||||
c: {
|
||||
// matches when // are the first two characters of a line
|
||||
singleLineComment: /^\/\//,
|
||||
|
||||
// matches when /* exists in a line
|
||||
multiLineCommentOpen: /\/\*/,
|
||||
|
||||
// matches when /* starts a line
|
||||
multiLineCommentOpenStart: /^\/\*/,
|
||||
|
||||
// matches when */ exists a line
|
||||
multiLineCommentClose: /\*\//,
|
||||
|
||||
// matches when */ ends a line
|
||||
multiLineCommentCloseEnd: /\*\/$/,
|
||||
|
||||
// matches /* ... */
|
||||
multiLineCommentOpenAndClose: /\/\*.*\*\//,
|
||||
},
|
||||
|
||||
python: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
|
||||
// matches when """ starts a line. This is not right, since
|
||||
// a multiline string is not always a comment, but for the
|
||||
// sake of simplicity, we will do that here.
|
||||
// multiLineCommentOpen: /"""/,
|
||||
|
||||
// matches when """ starts a line
|
||||
// multiLineCommentOpenStart: /^"""/,
|
||||
|
||||
// matches when """ exists in a line
|
||||
// multiLineCommentClose: /"""/,
|
||||
|
||||
// matches when """ ends a line
|
||||
// multiLineCommentCloseEnd: /"""$/,
|
||||
|
||||
// matches """ ... """
|
||||
// multiLineCommentOpenAndClose: /""".*"""/,
|
||||
},
|
||||
|
||||
ruby: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
|
||||
// For ruby multiline comments, =begin and =end must be
|
||||
// on their own lines
|
||||
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /^=begin/,
|
||||
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^=begin/,
|
||||
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /^=end/,
|
||||
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /^=end$/,
|
||||
|
||||
// not possible in ruby
|
||||
multiLineCommentOpenAndClose: /^\0$/,
|
||||
},
|
||||
|
||||
html: {
|
||||
// There is no single line comment
|
||||
singleLineComment: /^\0$/,
|
||||
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /<!--/,
|
||||
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^<!--/,
|
||||
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /-->/,
|
||||
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /-->$/,
|
||||
|
||||
// matches <!-- ... -->
|
||||
multiLineCommentOpenAndClose: /<!--.*-->/,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* detecte program language through file extension
|
||||
@@ -51,11 +153,13 @@ export class Languages {
|
||||
const languageExtensions = (languageMode && languageMode.extensions) || [];
|
||||
languageExtensions.forEach((extension: string) => {
|
||||
const lowerCaseExtension = extension.toLowerCase();
|
||||
const lowerCaseLanguage = language.toLowerCase()
|
||||
const lowerCaseLanguage = language.toLowerCase();
|
||||
if (!extensions[lowerCaseExtension]) {
|
||||
extensions[lowerCaseExtension] = lowerCaseLanguage;
|
||||
} else {
|
||||
const currentLanguagePriority = importantLanguages.indexOf(extensions[lowerCaseExtension]);
|
||||
const currentLanguagePriority = importantLanguages.indexOf(
|
||||
extensions[lowerCaseExtension],
|
||||
);
|
||||
if (currentLanguagePriority === -1) {
|
||||
extensions[lowerCaseExtension] = lowerCaseLanguage;
|
||||
} else {
|
||||
@@ -67,8 +171,8 @@ export class Languages {
|
||||
});
|
||||
});
|
||||
|
||||
return Object.assign({}, extensions, ExtensionJustify);
|
||||
}
|
||||
return { ...extensions, ...ExtensionJustify };
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve the regular expressions for a given language.
|
||||
@@ -78,7 +182,7 @@ export class Languages {
|
||||
* @param language the language to retrieve regexes for
|
||||
*/
|
||||
public getRegexes(language: string): Regexes {
|
||||
switch(language) {
|
||||
switch (language) {
|
||||
case 'html':
|
||||
case 'xml':
|
||||
return ALL_REGEXES.html;
|
||||
@@ -105,104 +209,8 @@ export class Languages {
|
||||
/**
|
||||
* get file type through a path
|
||||
*/
|
||||
public getType(path: string): string {
|
||||
public getType(path: string): string {
|
||||
const fileExtension = `.${path.split('.').pop()}`;
|
||||
return this.extensionMap[fileExtension] || '';
|
||||
}
|
||||
}
|
||||
|
||||
export interface Regexes {
|
||||
singleLineComment: RegExp;
|
||||
multiLineCommentOpen: RegExp;
|
||||
multiLineCommentOpenStart: RegExp;
|
||||
multiLineCommentClose: RegExp;
|
||||
multiLineCommentCloseEnd: RegExp;
|
||||
multiLineCommentOpenAndClose: RegExp;
|
||||
}
|
||||
|
||||
const ALL_REGEXES: Record<string, Regexes> = {
|
||||
c: {
|
||||
// matches when // are the first two characters of a line
|
||||
singleLineComment: /^\/\//,
|
||||
|
||||
// matches when /* exists in a line
|
||||
multiLineCommentOpen: /\/\*/,
|
||||
|
||||
// matches when /* starts a line
|
||||
multiLineCommentOpenStart: /^\/\*/,
|
||||
|
||||
// matches when */ exists a line
|
||||
multiLineCommentClose: /\*\//,
|
||||
|
||||
// matches when */ ends a line
|
||||
multiLineCommentCloseEnd: /\*\/$/,
|
||||
|
||||
// matches /* ... */
|
||||
multiLineCommentOpenAndClose: /\/\*.*\*\//
|
||||
},
|
||||
|
||||
python: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
|
||||
// matches when """ starts a line. This is not right, since
|
||||
// a multiline string is not always a comment, but for the
|
||||
// sake of simplicity, we will do that here.
|
||||
multiLineCommentOpen: /"""/,
|
||||
|
||||
// matches when """ starts a line
|
||||
multiLineCommentOpenStart: /^"""/,
|
||||
|
||||
// matches when """ exists in a line
|
||||
multiLineCommentClose: /"""/,
|
||||
|
||||
// matches when """ ends a line
|
||||
multiLineCommentCloseEnd: /"""$/,
|
||||
|
||||
// matches """ ... """
|
||||
multiLineCommentOpenAndClose: /""".*"""/
|
||||
},
|
||||
|
||||
ruby: {
|
||||
// matches when # the first character of a line
|
||||
singleLineComment: /^#/,
|
||||
|
||||
// For ruby multiline comments, =begin and =end must be
|
||||
// on their own lines
|
||||
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /^=begin/,
|
||||
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^=begin/,
|
||||
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /^=end/,
|
||||
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /^=end$/,
|
||||
|
||||
// not possible in ruby
|
||||
multiLineCommentOpenAndClose: /^\0$/
|
||||
},
|
||||
|
||||
html: {
|
||||
// There is no single line comment
|
||||
singleLineComment: /^\0$/,
|
||||
|
||||
// matches when =begin starts a line
|
||||
multiLineCommentOpen: /<!--/,
|
||||
|
||||
// matches when "begin starts a line
|
||||
multiLineCommentOpenStart: /^<!--/,
|
||||
|
||||
// matches when "end ends a line
|
||||
multiLineCommentClose: /-->/,
|
||||
|
||||
// matches when "end ends a line
|
||||
multiLineCommentCloseEnd: /-->$/,
|
||||
|
||||
// matches <!-- ... -->
|
||||
multiLineCommentOpenAndClose: /<!--.*-->/
|
||||
}
|
||||
};
|
||||
|
||||
1
node_modules/github-linguist/src/utils.ts
generated
vendored
1
node_modules/github-linguist/src/utils.ts
generated
vendored
@@ -1,6 +1,5 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
// @ts-ignore
|
||||
import slash from 'slash2';
|
||||
|
||||
const packagePath = slash(path.join(__dirname, '../', 'package.json'));
|
||||
|
||||
5
node_modules/github-linguist/tsconfig.json
generated
vendored
5
node_modules/github-linguist/tsconfig.json
generated
vendored
@@ -13,7 +13,8 @@
|
||||
"sourceMap": true,
|
||||
"paths": {
|
||||
"*": ["node_modules/*", "src/types/*"]
|
||||
}
|
||||
},
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
"include": ["src/**/*", "test/declarations.d.ts"]
|
||||
}
|
||||
|
||||
18
package-lock.json
generated
18
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "1.0.12",
|
||||
"version": "1.0.15",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "codeql",
|
||||
"version": "1.0.12",
|
||||
"version": "1.0.15",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/artifact": "^0.5.2",
|
||||
@@ -24,7 +24,7 @@
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"file-url": "^3.0.0",
|
||||
"fs": "0.0.1-security",
|
||||
"github-linguist": "^2.4.3",
|
||||
"github-linguist": "^2.4.4",
|
||||
"glob": "^7.1.7",
|
||||
"js-yaml": "^4.1.0",
|
||||
"jsonschema": "1.2.6",
|
||||
@@ -3014,9 +3014,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/github-linguist": {
|
||||
"version": "2.4.3",
|
||||
"resolved": "https://registry.npmjs.org/github-linguist/-/github-linguist-2.4.3.tgz",
|
||||
"integrity": "sha512-hKWn1QQ+9oUyOIcUhPzi6AxTcAkYHg4OOwK79Pr05SBTFmdNr7GQkMDJabSGCZwu7SDhEb5YeUwUGqrUfyo7PA==",
|
||||
"version": "2.4.4",
|
||||
"resolved": "https://registry.npmjs.org/github-linguist/-/github-linguist-2.4.4.tgz",
|
||||
"integrity": "sha512-QSw/HfSTqA13t7eqNeGLd62ghnTsTQAUrJQKkUG100NZqqzpsKB9c7gH7lFaGU1ZWGmNSWfhG6q1Ok/xotOA/g==",
|
||||
"dependencies": {
|
||||
"chalk": "^2.2.0",
|
||||
"commander": "^2.11.0",
|
||||
@@ -8320,9 +8320,9 @@
|
||||
}
|
||||
},
|
||||
"github-linguist": {
|
||||
"version": "2.4.3",
|
||||
"resolved": "https://registry.npmjs.org/github-linguist/-/github-linguist-2.4.3.tgz",
|
||||
"integrity": "sha512-hKWn1QQ+9oUyOIcUhPzi6AxTcAkYHg4OOwK79Pr05SBTFmdNr7GQkMDJabSGCZwu7SDhEb5YeUwUGqrUfyo7PA==",
|
||||
"version": "2.4.4",
|
||||
"resolved": "https://registry.npmjs.org/github-linguist/-/github-linguist-2.4.4.tgz",
|
||||
"integrity": "sha512-QSw/HfSTqA13t7eqNeGLd62ghnTsTQAUrJQKkUG100NZqqzpsKB9c7gH7lFaGU1ZWGmNSWfhG6q1Ok/xotOA/g==",
|
||||
"requires": {
|
||||
"chalk": "^2.2.0",
|
||||
"commander": "^2.11.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql",
|
||||
"version": "1.0.12",
|
||||
"version": "1.0.15",
|
||||
"private": true,
|
||||
"description": "CodeQL action",
|
||||
"scripts": {
|
||||
@@ -37,7 +37,7 @@
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"file-url": "^3.0.0",
|
||||
"fs": "0.0.1-security",
|
||||
"github-linguist": "^2.4.3",
|
||||
"github-linguist": "^2.4.4",
|
||||
"glob": "^7.1.7",
|
||||
"js-yaml": "^4.1.0",
|
||||
"jsonschema": "1.2.6",
|
||||
|
||||
17
pr-checks/checks/go-custom-queries.yml
Normal file
17
pr-checks/checks/go-custom-queries.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
name: "Go: Custom queries"
|
||||
description: "Checks that Go works in conjunction with a config file specifying custom queries"
|
||||
steps:
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: "^1.13.1"
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
config-file: ./.github/codeql/custom-queries.yml
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
TEST_MODE: true
|
||||
24
pr-checks/checks/go-custom-tracing-autobuild.yml
Normal file
24
pr-checks/checks/go-custom-tracing-autobuild.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
name: "Go: Autobuild custom tracing"
|
||||
description: "Checks that Go tracing works in conjunction with the autobuilder"
|
||||
os: ["ubuntu-latest", "macos-latest"]
|
||||
env:
|
||||
CODEQL_EXTRACTOR_GO_BUILD_TRACING: "true"
|
||||
steps:
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: "^1.13.1"
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: go
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/autobuild
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/codeql_databases"
|
||||
if [[ ! -d go ]]; then
|
||||
echo "Did not find a Go database"
|
||||
exit 1
|
||||
fi
|
||||
18
pr-checks/checks/go-custom-tracing.yml
Normal file
18
pr-checks/checks/go-custom-tracing.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
name: "Go: Custom tracing"
|
||||
description: "Checks that Go tracing works"
|
||||
env:
|
||||
CODEQL_EXTRACTOR_GO_BUILD_TRACING: "true"
|
||||
steps:
|
||||
- uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: "^1.13.1"
|
||||
- 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
|
||||
env:
|
||||
TEST_MODE: true
|
||||
27
pr-checks/checks/javascript-source-root.yml
Normal file
27
pr-checks/checks/javascript-source-root.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
name: "Custom source root"
|
||||
description: "Checks that the argument specifying a non-default source root works"
|
||||
versions: ["latest", "cached", "nightly-latest"] # This feature is not compatible with old CLIs
|
||||
os: ["ubuntu-latest"]
|
||||
steps:
|
||||
- name: Move codeql-action
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir ../new-source-root
|
||||
mv * ../new-source-root
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: javascript
|
||||
source-root: ../new-source-root
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
skip-queries: true
|
||||
upload: false
|
||||
- name: Assert database exists
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/codeql_databases"
|
||||
if [[ ! -d javascript ]]; then
|
||||
echo "Did not find a JavaScript database"
|
||||
exit 1
|
||||
fi
|
||||
47
pr-checks/checks/multi-language-autodetect.yml
Normal file
47
pr-checks/checks/multi-language-autodetect.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
name: "Multi-language repository"
|
||||
description: "An end-to-end integration test of a multi-language repository using automatic language detection"
|
||||
os: ["ubuntu-latest", "macos-latest"]
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
db-location: "${{ runner.temp }}/customDbLocation"
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
id: analysis
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- shell: bash
|
||||
run: |
|
||||
CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }}
|
||||
if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||
echo "Did not create a database for CPP, or created it in the wrong location."
|
||||
exit 1
|
||||
fi
|
||||
CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }}
|
||||
if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||
echo "Did not create a database for C Sharp, or created it in the wrong location."
|
||||
exit 1
|
||||
fi
|
||||
GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }}
|
||||
if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||
echo "Did not create a database for Go, or created it in the wrong location."
|
||||
exit 1
|
||||
fi
|
||||
JAVA_DB=${{ fromJson(steps.analysis.outputs.db-locations).java }}
|
||||
if [[ ! -d $JAVA_DB ]] || [[ ! $JAVA_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||
echo "Did not create a database for Java, or created it in the wrong location."
|
||||
exit 1
|
||||
fi
|
||||
JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }}
|
||||
if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||
echo "Did not create a database for Javascript, or created it in the wrong location."
|
||||
exit 1
|
||||
fi
|
||||
PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }}
|
||||
if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then
|
||||
echo "Did not create a database for Python, or created it in the wrong location."
|
||||
exit 1
|
||||
fi
|
||||
33
pr-checks/checks/packaging-config-inputs-js.yml
Normal file
33
pr-checks/checks/packaging-config-inputs-js.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
name: "Packaging: Config and input"
|
||||
description: "Checks that specifying packages using a combination of a config file and input to the Action works"
|
||||
versions: ["nightly-20210831"] # This CLI version is known to work with package used in this test
|
||||
os: ["ubuntu-latest", "macos-latest"]
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
config-file: ".github/codeql/codeql-config-packaging3.yml"
|
||||
packs: +dsp-testing/codeql-pack1@0.1.0
|
||||
languages: javascript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: "${{ runner.temp }}/results"
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert Results
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
# We should have 3 hits from these rules
|
||||
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
|
||||
|
||||
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
|
||||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
|
||||
echo "Found matching rules '$RULES'"
|
||||
if [ "$RULES" != "$EXPECTED_RULES" ]; then
|
||||
echo "Did not match expected rules '$EXPECTED_RULES'."
|
||||
exit 1
|
||||
fi
|
||||
32
pr-checks/checks/packaging-config-js.yml
Normal file
32
pr-checks/checks/packaging-config-js.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
name: "Packaging: Config file"
|
||||
description: "Checks that specifying packages using only a config file works"
|
||||
versions: ["nightly-20210831"] # This CLI version is known to work with package used in this test
|
||||
os: ["ubuntu-latest", "macos-latest"]
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
config-file: ".github/codeql/codeql-config-packaging.yml"
|
||||
languages: javascript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: "${{ runner.temp }}/results"
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert Results
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
# We should have 3 hits from these rules
|
||||
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
|
||||
|
||||
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
|
||||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
|
||||
echo "Found matching rules '$RULES'"
|
||||
if [ "$RULES" != "$EXPECTED_RULES" ]; then
|
||||
echo "Did not match expected rules '$EXPECTED_RULES'."
|
||||
exit 1
|
||||
fi
|
||||
33
pr-checks/checks/packaging-inputs-js.yml
Normal file
33
pr-checks/checks/packaging-inputs-js.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
name: "Packaging: Action input"
|
||||
description: "Checks that specifying packages using the input to the Action works"
|
||||
versions: ["nightly-20210831"] # This CLI version is known to work with package used in this test
|
||||
os: ["ubuntu-latest", "macos-latest"]
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
config-file: ".github/codeql/codeql-config-packaging2.yml"
|
||||
languages: javascript
|
||||
packs: dsp-testing/codeql-pack1@0.1.0, dsp-testing/codeql-pack2
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: "${{ runner.temp }}/results"
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert Results
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
# We should have 3 hits from these rules
|
||||
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
|
||||
|
||||
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
|
||||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
|
||||
echo "Found matching rules '$RULES'"
|
||||
if [ "$RULES" != "$EXPECTED_RULES" ]; then
|
||||
echo "Did not match expected rules '$EXPECTED_RULES'."
|
||||
exit 1
|
||||
fi
|
||||
14
pr-checks/checks/remote-config.yml
Normal file
14
pr-checks/checks/remote-config.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
name: "Remote config file"
|
||||
description: "Checks that specifying packages using only a config file works"
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
languages: cpp,csharp,java,javascript,python
|
||||
config-file: github/codeql-action/tests/multi-language-repo/.github/codeql/custom-queries.yml@${{ github.sha }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
TEST_MODE: true
|
||||
26
pr-checks/checks/rubocop-multi-language.yml
Normal file
26
pr-checks/checks/rubocop-multi-language.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
name: "RuboCop multi-language"
|
||||
description: "Tests using RuboCop to analyze a multi-language repository and then using the CodeQL Action to upload the resulting SARIF"
|
||||
os: ["ubuntu-latest"]
|
||||
steps:
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
- name: Install Code Scanning integration
|
||||
shell: bash
|
||||
run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: bundle install
|
||||
- name: RuboCop run
|
||||
shell: bash
|
||||
run: |
|
||||
bash -c "
|
||||
bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
|
||||
[[ $? -ne 2 ]]
|
||||
"
|
||||
- uses: ./../action/upload-sarif
|
||||
with:
|
||||
sarif_file: rubocop.sarif
|
||||
env:
|
||||
TEST_MODE: true
|
||||
46
pr-checks/checks/split-workflow.yml
Normal file
46
pr-checks/checks/split-workflow.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
name: "Split workflow"
|
||||
description: "Tests a split-up workflow in which we first build a database and later analyze it"
|
||||
versions: ["nightly-20210831"] # This CLI version is known to work with package used in this test
|
||||
os: ["ubuntu-latest", "macos-latest"]
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
config-file: ".github/codeql/codeql-config-packaging3.yml"
|
||||
packs: +dsp-testing/codeql-pack1@0.1.0
|
||||
languages: javascript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
skip-queries: true
|
||||
output: "${{ runner.temp }}/results"
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert No Results
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "$(ls -A $RUNNER_TEMP/results)" ]; then
|
||||
echo "Expected results directory to be empty after skipping query execution!"
|
||||
exit 1
|
||||
fi
|
||||
- uses: ./../action/analyze
|
||||
with:
|
||||
output: "${{ runner.temp }}/results"
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Assert Results
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/results"
|
||||
# We should have 3 hits from these rules
|
||||
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block"
|
||||
|
||||
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
|
||||
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
|
||||
echo "Found matching rules '$RULES'"
|
||||
if [ "$RULES" != "$EXPECTED_RULES" ]; then
|
||||
echo "Did not match expected rules '$EXPECTED_RULES'."
|
||||
exit 1
|
||||
fi
|
||||
20
pr-checks/checks/test-local-codeql.yml
Normal file
20
pr-checks/checks/test-local-codeql.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
name: "Local CodeQL bundle"
|
||||
description: "Tests using a CodeQL bundle from a local file rather than a URL"
|
||||
versions: ["nightly-latest"]
|
||||
os: ["ubuntu-latest"]
|
||||
steps:
|
||||
- name: Fetch a CodeQL bundle
|
||||
shell: bash
|
||||
env:
|
||||
CODEQL_URL: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
run: |
|
||||
wget "$CODEQL_URL"
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
tools: ./codeql-bundle.tar.gz
|
||||
- name: Build code
|
||||
shell: bash
|
||||
run: ./build.sh
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
TEST_MODE: true
|
||||
22
pr-checks/checks/test-proxy.yml
Normal file
22
pr-checks/checks/test-proxy.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
name: "Proxy test"
|
||||
description: "Tests using a proxy specified by the https_proxy environment variable"
|
||||
versions: ["latest"]
|
||||
os: ["ubuntu-latest"]
|
||||
container:
|
||||
image: ubuntu:18.04
|
||||
options: --dns 127.0.0.1
|
||||
services:
|
||||
squid-proxy:
|
||||
image: datadog/squid:latest
|
||||
ports:
|
||||
- 3128:3128
|
||||
env:
|
||||
https_proxy: http://squid-proxy:3128
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: javascript
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/analyze
|
||||
env:
|
||||
TEST_MODE: true
|
||||
23
pr-checks/checks/test-ruby.yml
Normal file
23
pr-checks/checks/test-ruby.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
name: "Ruby analysis"
|
||||
description: "Tests creation of a Ruby database"
|
||||
versions: ["latest", "cached", "nightly-latest"]
|
||||
os: ["ubuntu-latest", "macos-latest"]
|
||||
env:
|
||||
CODEQL_ENABLE_EXPERIMENTAL_FEATURES: "true"
|
||||
steps:
|
||||
- uses: ./../action/init
|
||||
with:
|
||||
languages: ruby
|
||||
tools: ${{ steps.prepare-test.outputs.tools-url }}
|
||||
- uses: ./../action/analyze
|
||||
id: analysis
|
||||
env:
|
||||
TEST_MODE: true
|
||||
- name: Check database
|
||||
shell: bash
|
||||
run: |
|
||||
RUBY_DB="${{ fromJson(steps.analysis.outputs.db-locations).ruby }}"
|
||||
if [[ ! -d "$RUBY_DB" ]]; then
|
||||
echo "Did not create a database for Ruby."
|
||||
exit 1
|
||||
fi
|
||||
104
pr-checks/sync.py
Normal file
104
pr-checks/sync.py
Normal file
@@ -0,0 +1,104 @@
|
||||
import ruamel.yaml
|
||||
import os
|
||||
|
||||
defaultTestVersions = [
|
||||
# The oldest supported CodeQL version: 2.3.1. If bumping, update `CODEQL_MINIMUM_VERSION` in `codeql.ts`
|
||||
"stable-20201028",
|
||||
# The last CodeQL release in the 2.4 series: 2.4.6.
|
||||
"stable-20210319",
|
||||
# The last CodeQL release in the 2.5 series: 2.5.9.
|
||||
"stable-20210809",
|
||||
# The version of CodeQL currently in the toolcache. Typically either the latest release or the one before.
|
||||
"cached",
|
||||
# The latest release of CodeQL.
|
||||
"latest",
|
||||
# A nightly build directly from the our private repo, built in the last 24 hours.
|
||||
"nightly-latest"
|
||||
]
|
||||
defaultOperatingSystems = ["ubuntu-latest", "macos-latest", "windows-latest"]
|
||||
header = """# Warning: This file is generated automatically, and should not be modified.
|
||||
# Instead, please modify the template in the pr-checks directory and run:
|
||||
# pip install ruamel.yaml && python3 sync.py
|
||||
# to regenerate this file.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class NonAliasingRTRepresenter(ruamel.yaml.representer.RoundTripRepresenter):
|
||||
def ignore_aliases(self, data):
|
||||
return True
|
||||
|
||||
|
||||
def writeHeader(checkStream):
|
||||
checkStream.write(header)
|
||||
|
||||
|
||||
yaml = ruamel.yaml.YAML()
|
||||
yaml.Representer = NonAliasingRTRepresenter
|
||||
allJobs = {}
|
||||
for file in os.listdir('checks'):
|
||||
with open(f"checks/{file}", 'r') as checkStream:
|
||||
checkSpecification = yaml.load(checkStream)
|
||||
|
||||
versions = defaultTestVersions
|
||||
if 'versions' in checkSpecification:
|
||||
versions = checkSpecification['versions']
|
||||
operatingSystems = defaultOperatingSystems
|
||||
if 'os' in checkSpecification:
|
||||
operatingSystems = checkSpecification['os']
|
||||
|
||||
steps = [
|
||||
{
|
||||
'name': 'Check out repository',
|
||||
'uses': 'actions/checkout@v2'
|
||||
},
|
||||
{
|
||||
'name': 'Prepare test',
|
||||
'id': 'prepare-test',
|
||||
'uses': './.github/prepare-test',
|
||||
'with': {
|
||||
'version': '${{ matrix.version }}'
|
||||
}
|
||||
}
|
||||
]
|
||||
steps.extend(checkSpecification['steps'])
|
||||
|
||||
checkJob = {
|
||||
'strategy': {
|
||||
'matrix': {
|
||||
'version': versions,
|
||||
'os': operatingSystems
|
||||
}
|
||||
},
|
||||
'name': checkSpecification['name'],
|
||||
'runs-on': '${{ matrix.os }}',
|
||||
'steps': steps
|
||||
}
|
||||
|
||||
for key in ["env", "container", "services"]:
|
||||
if key in checkSpecification:
|
||||
checkJob[key] = checkSpecification[key]
|
||||
|
||||
checkName = file[:len(file) - 4]
|
||||
|
||||
with open(f"../.github/workflows/__{checkName}.yml", 'w') as output_stream:
|
||||
writeHeader(output_stream)
|
||||
yaml.dump({
|
||||
'name': f"PR Check - {checkSpecification['name']}",
|
||||
'env': {
|
||||
'GITHUB_TOKEN': '${{ secrets.GITHUB_TOKEN }}',
|
||||
'GO111MODULE': 'auto',
|
||||
},
|
||||
'on': {
|
||||
'push': {
|
||||
'branches': ['main', 'v1']
|
||||
},
|
||||
'pull_request': {
|
||||
'types': ["opened", "synchronize", "reopened", "ready_for_review"]
|
||||
},
|
||||
'workflow_dispatch': {}
|
||||
},
|
||||
'jobs': {
|
||||
checkName: checkJob
|
||||
}
|
||||
}, output_stream)
|
||||
32
runner/package-lock.json
generated
32
runner/package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql-runner",
|
||||
"version": "1.0.12",
|
||||
"version": "1.0.15",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -92,9 +92,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "16.4.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.4.12.tgz",
|
||||
"integrity": "sha512-zxrTNFl9Z8boMJXs6ieqZP0wAhvkdzmHSxTlJabM16cf5G9xBc1uPRH5Bbv2omEDDiM8MzTfqTJXBf0Ba4xFWA==",
|
||||
"version": "16.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.6.1.tgz",
|
||||
"integrity": "sha512-Sr7BhXEAer9xyGuCN3Ek9eg9xPviCF2gfu9kTfuU2HkTVAMYSDeX40fvpmo72n5nansg3nsBjuQBrsS28r+NUw==",
|
||||
"dev": true
|
||||
},
|
||||
"@webassemblyjs/ast": {
|
||||
@@ -427,9 +427,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30001249",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001249.tgz",
|
||||
"integrity": "sha512-vcX4U8lwVXPdqzPWi6cAJ3FnQaqXbBqy/GZseKNQzRj37J7qZdGcBtxq/QLFNLLlfsoXLUdHw8Iwenri86Tagw==",
|
||||
"version": "1.0.30001251",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz",
|
||||
"integrity": "sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A==",
|
||||
"dev": true
|
||||
},
|
||||
"chalk": {
|
||||
@@ -584,9 +584,9 @@
|
||||
}
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.3.796",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.796.tgz",
|
||||
"integrity": "sha512-agwJFgM0FUC1UPPbQ4aII3HamaaJ09fqWGAWYHmzxDWqdmTleCHyyA0kt3fJlTd5M440IaeuBfzXzXzCotnZcQ==",
|
||||
"version": "1.3.806",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.806.tgz",
|
||||
"integrity": "sha512-AH/otJLAAecgyrYp0XK1DPiGVWcOgwPeJBOLeuFQ5l//vhQhwC9u6d+GijClqJAmsHG4XDue81ndSQPohUu0xA==",
|
||||
"dev": true
|
||||
},
|
||||
"emoji-regex": {
|
||||
@@ -1296,9 +1296,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node-releases": {
|
||||
"version": "1.1.73",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.73.tgz",
|
||||
"integrity": "sha512-uW7fodD6pyW2FZNZnp/Z3hvWKeEW1Y8R1+1CnErE8cXFXzl5blBOoVB41CvMer6P6Q0S5FXDwcHgFd1Wj0U9zg==",
|
||||
"version": "1.1.74",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.74.tgz",
|
||||
"integrity": "sha512-caJBVempXZPepZoZAPCWRTNxYQ+xtG/KAi4ozTA5A+nJ7IU+kLQCbqaUjb5Rwy14M9upBWiQ4NutcmW04LJSRw==",
|
||||
"dev": true
|
||||
},
|
||||
"noop-logger": {
|
||||
@@ -1979,9 +1979,9 @@
|
||||
}
|
||||
},
|
||||
"webpack": {
|
||||
"version": "5.48.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.48.0.tgz",
|
||||
"integrity": "sha512-CGe+nfbHrYzbk7SKoYITCgN3LRAG0yVddjNUecz9uugo1QtYdiyrVD8nP1PhkNqPfdxC2hknmmKpP355Epyn6A==",
|
||||
"version": "5.50.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.50.0.tgz",
|
||||
"integrity": "sha512-hqxI7t/KVygs0WRv/kTgUW8Kl3YC81uyWQSo/7WUs5LsuRw0htH/fCwbVBGCuiX/t4s7qzjXFcf41O8Reiypag==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/eslint-scope": "^3.7.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codeql-runner",
|
||||
"version": "1.0.12",
|
||||
"version": "1.0.15",
|
||||
"private": true,
|
||||
"description": "CodeQL runner",
|
||||
"scripts": {
|
||||
@@ -11,7 +11,7 @@
|
||||
"devDependencies": {
|
||||
"pkg": "^5.3.1",
|
||||
"ts-loader": "9.2.5",
|
||||
"webpack": "^5.48.0",
|
||||
"webpack": "^5.50.0",
|
||||
"webpack-cli": "^4.7.2"
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import * as sinon from "sinon";
|
||||
import { runQueries } from "./analyze";
|
||||
import { setCodeQL } from "./codeql";
|
||||
import { Config } from "./config-utils";
|
||||
import { getIdPrefix } from "./count-loc";
|
||||
import * as count from "./count-loc";
|
||||
import { Language } from "./languages";
|
||||
import { getRunnerLogger } from "./logging";
|
||||
@@ -68,33 +67,7 @@ test("status report fields and search path setting", async (t) => {
|
||||
sarifFile,
|
||||
JSON.stringify({
|
||||
runs: [
|
||||
// variant 1 uses ruleId
|
||||
{
|
||||
properties: {
|
||||
metricResults: [
|
||||
{
|
||||
ruleId: `${getIdPrefix(
|
||||
language
|
||||
)}/summary/lines-of-code`,
|
||||
value: 123,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
// variant 2 uses rule.id
|
||||
{
|
||||
properties: {
|
||||
metricResults: [
|
||||
{
|
||||
rule: {
|
||||
id: `${getIdPrefix(language)}/summary/lines-of-code`,
|
||||
},
|
||||
value: 123,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
// variant 3 references a rule with the lines-of-code tag
|
||||
// references a rule with the lines-of-code tag, so baseline should be injected
|
||||
{
|
||||
tool: {
|
||||
extensions: [
|
||||
@@ -231,38 +204,13 @@ test("status report fields and search path setting", async (t) => {
|
||||
function verifyLineCounts(tmpDir: string) {
|
||||
// eslint-disable-next-line github/array-foreach
|
||||
Object.keys(Language).forEach((lang, i) => {
|
||||
verifyLineCountForFile(
|
||||
lang as Language,
|
||||
path.join(tmpDir, `${lang}.sarif`),
|
||||
i + 1
|
||||
);
|
||||
verifyLineCountForFile(path.join(tmpDir, `${lang}.sarif`), i + 1);
|
||||
});
|
||||
}
|
||||
|
||||
function verifyLineCountForFile(
|
||||
lang: Language,
|
||||
filePath: string,
|
||||
lineCount: number
|
||||
) {
|
||||
const idPrefix = getIdPrefix(lang);
|
||||
function verifyLineCountForFile(filePath: string, lineCount: number) {
|
||||
const sarif = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
||||
t.deepEqual(sarif.runs[0].properties.metricResults, [
|
||||
{
|
||||
ruleId: `${idPrefix}/summary/lines-of-code`,
|
||||
value: 123,
|
||||
baseline: lineCount,
|
||||
},
|
||||
]);
|
||||
t.deepEqual(sarif.runs[1].properties.metricResults, [
|
||||
{
|
||||
rule: {
|
||||
id: `${idPrefix}/summary/lines-of-code`,
|
||||
},
|
||||
value: 123,
|
||||
baseline: lineCount,
|
||||
},
|
||||
]);
|
||||
t.deepEqual(sarif.runs[2].properties.metricResults, [
|
||||
{
|
||||
rule: {
|
||||
index: 0,
|
||||
@@ -275,7 +223,7 @@ test("status report fields and search path setting", async (t) => {
|
||||
},
|
||||
]);
|
||||
// when the rule doesn't exist, it should not be added
|
||||
t.deepEqual(sarif.runs[3].properties.metricResults, []);
|
||||
t.deepEqual(sarif.runs[1].properties.metricResults, []);
|
||||
}
|
||||
|
||||
function verifyQuerySuites(tmpDir: string) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as yaml from "js-yaml";
|
||||
import * as analysisPaths from "./analysis-paths";
|
||||
import { getCodeQL } from "./codeql";
|
||||
import * as configUtils from "./config-utils";
|
||||
import { countLoc, getIdPrefix } from "./count-loc";
|
||||
import { countLoc } from "./count-loc";
|
||||
import { isScannedLanguage, Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
import * as sharedEnv from "./shared-environment";
|
||||
@@ -116,7 +116,7 @@ async function createdDBForScannedLanguages(
|
||||
// we extract any scanned languages.
|
||||
analysisPaths.includeAndExcludeAnalysisPaths(config);
|
||||
|
||||
const codeql = getCodeQL(config.codeQLCmd);
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
for (const language of config.languages) {
|
||||
if (
|
||||
isScannedLanguage(language) &&
|
||||
@@ -164,7 +164,7 @@ async function finalizeDatabaseCreation(
|
||||
) {
|
||||
await createdDBForScannedLanguages(config, logger);
|
||||
|
||||
const codeql = getCodeQL(config.codeQLCmd);
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
for (const language of config.languages) {
|
||||
if (dbIsFinalized(config, language, logger)) {
|
||||
logger.info(
|
||||
@@ -230,7 +230,7 @@ export async function runQueries(
|
||||
logger.info("*************");
|
||||
logger.startGroup(`Downloading custom packs for ${language}`);
|
||||
|
||||
const codeql = getCodeQL(config.codeQLCmd);
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
const results = await codeql.packDownload(packsWithVersion);
|
||||
logger.info(
|
||||
`Downloaded packs: ${results.packs
|
||||
@@ -320,7 +320,7 @@ export async function runQueries(
|
||||
sarifFile: string
|
||||
): Promise<string> {
|
||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||
const codeql = getCodeQL(config.codeQLCmd);
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
return await codeql.databaseInterpretResults(
|
||||
databasePath,
|
||||
queries,
|
||||
@@ -346,7 +346,7 @@ export async function runQueries(
|
||||
`Query suite file for ${language}-${type}...\n${querySuiteContents}`
|
||||
);
|
||||
|
||||
const codeql = getCodeQL(config.codeQLCmd);
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
await codeql.databaseRunQueries(
|
||||
databasePath,
|
||||
searchPath,
|
||||
@@ -402,7 +402,7 @@ export async function runCleanup(
|
||||
): Promise<void> {
|
||||
logger.startGroup("Cleaning up databases");
|
||||
for (const language of config.languages) {
|
||||
const codeql = getCodeQL(config.codeQLCmd);
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||
await codeql.databaseCleanup(databasePath, cleanupLevel);
|
||||
}
|
||||
@@ -415,27 +415,15 @@ async function injectLinesOfCode(
|
||||
locPromise: Promise<Partial<Record<Language, number>>>
|
||||
) {
|
||||
const lineCounts = await locPromise;
|
||||
const idPrefix = getIdPrefix(language);
|
||||
if (language in lineCounts) {
|
||||
const sarif = JSON.parse(fs.readFileSync(sarifFile, "utf8"));
|
||||
|
||||
if (Array.isArray(sarif.runs)) {
|
||||
for (const run of sarif.runs) {
|
||||
// Old style: Baseline is inserted when rule ID has suffix /summary/lines-of-code
|
||||
const ruleId = `${idPrefix}/summary/lines-of-code`;
|
||||
run.properties = run.properties || {};
|
||||
run.properties.metricResults = run.properties.metricResults || [];
|
||||
const rule = run.properties.metricResults.find(
|
||||
// the rule id can be in either of two places
|
||||
(r) => r.ruleId === ruleId || r.rule?.id === ruleId
|
||||
);
|
||||
// only add the baseline value if the rule already exists
|
||||
if (rule) {
|
||||
rule.baseline = lineCounts[language];
|
||||
}
|
||||
|
||||
// New style: Baseline is inserted when matching rule has tag lines-of-code
|
||||
for (const metric of run.properties.metricResults) {
|
||||
// Baseline is inserted when matching rule has tag lines-of-code
|
||||
if (metric.rule && metric.rule.toolComponent) {
|
||||
const matchingRule =
|
||||
run.tool.extensions[metric.rule.toolComponent.index].rules[
|
||||
|
||||
@@ -40,7 +40,7 @@ export async function runAutobuild(
|
||||
logger: Logger
|
||||
) {
|
||||
logger.startGroup(`Attempting to automatically build ${language} code`);
|
||||
const codeQL = getCodeQL(config.codeQLCmd);
|
||||
const codeQL = await getCodeQL(config.codeQLCmd);
|
||||
await codeQL.runAutobuild(language);
|
||||
logger.endGroup();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,8 @@ test("download codeql bundle cache", async (t) => {
|
||||
tmpDir,
|
||||
tmpDir,
|
||||
util.GitHubVariant.DOTCOM,
|
||||
getRunnerLogger(true)
|
||||
getRunnerLogger(true),
|
||||
false
|
||||
);
|
||||
|
||||
t.assert(toolcache.find("CodeQL", `0.0.0-${version}`));
|
||||
@@ -78,7 +79,8 @@ test("download codeql bundle cache explicitly requested with pinned different ve
|
||||
tmpDir,
|
||||
tmpDir,
|
||||
util.GitHubVariant.DOTCOM,
|
||||
getRunnerLogger(true)
|
||||
getRunnerLogger(true),
|
||||
false
|
||||
);
|
||||
|
||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
|
||||
@@ -96,7 +98,8 @@ test("download codeql bundle cache explicitly requested with pinned different ve
|
||||
tmpDir,
|
||||
tmpDir,
|
||||
util.GitHubVariant.DOTCOM,
|
||||
getRunnerLogger(true)
|
||||
getRunnerLogger(true),
|
||||
false
|
||||
);
|
||||
|
||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200610"));
|
||||
@@ -120,7 +123,8 @@ test("don't download codeql bundle cache with pinned different version cached",
|
||||
tmpDir,
|
||||
tmpDir,
|
||||
util.GitHubVariant.DOTCOM,
|
||||
getRunnerLogger(true)
|
||||
getRunnerLogger(true),
|
||||
false
|
||||
);
|
||||
|
||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
|
||||
@@ -131,7 +135,8 @@ test("don't download codeql bundle cache with pinned different version cached",
|
||||
tmpDir,
|
||||
tmpDir,
|
||||
util.GitHubVariant.DOTCOM,
|
||||
getRunnerLogger(true)
|
||||
getRunnerLogger(true),
|
||||
false
|
||||
);
|
||||
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
@@ -157,7 +162,8 @@ test("download codeql bundle cache with different version cached (not pinned)",
|
||||
tmpDir,
|
||||
tmpDir,
|
||||
util.GitHubVariant.DOTCOM,
|
||||
getRunnerLogger(true)
|
||||
getRunnerLogger(true),
|
||||
false
|
||||
);
|
||||
|
||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
|
||||
@@ -183,7 +189,8 @@ test("download codeql bundle cache with different version cached (not pinned)",
|
||||
tmpDir,
|
||||
tmpDir,
|
||||
util.GitHubVariant.DOTCOM,
|
||||
getRunnerLogger(true)
|
||||
getRunnerLogger(true),
|
||||
false
|
||||
);
|
||||
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
@@ -209,7 +216,8 @@ test('download codeql bundle cache with pinned different version cached if "late
|
||||
tmpDir,
|
||||
tmpDir,
|
||||
util.GitHubVariant.DOTCOM,
|
||||
getRunnerLogger(true)
|
||||
getRunnerLogger(true),
|
||||
false
|
||||
);
|
||||
|
||||
t.assert(toolcache.find("CodeQL", "0.0.0-20200601"));
|
||||
@@ -236,7 +244,8 @@ test('download codeql bundle cache with pinned different version cached if "late
|
||||
tmpDir,
|
||||
tmpDir,
|
||||
util.GitHubVariant.DOTCOM,
|
||||
getRunnerLogger(true)
|
||||
getRunnerLogger(true),
|
||||
false
|
||||
);
|
||||
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
@@ -290,7 +299,8 @@ test("download codeql bundle from github ae endpoint", async (t) => {
|
||||
tmpDir,
|
||||
tmpDir,
|
||||
util.GitHubVariant.GHAE,
|
||||
getRunnerLogger(true)
|
||||
getRunnerLogger(true),
|
||||
false
|
||||
);
|
||||
|
||||
const cachedVersions = toolcache.findAllVersions("CodeQL");
|
||||
|
||||
@@ -178,7 +178,26 @@ let cachedCodeQL: CodeQL | undefined = undefined;
|
||||
const CODEQL_BUNDLE_VERSION = defaults.bundleVersion;
|
||||
const CODEQL_DEFAULT_ACTION_REPOSITORY = "github/codeql-action";
|
||||
|
||||
/**
|
||||
* The oldest version of CodeQL that the Action will run with. This should be
|
||||
* at least three minor versions behind the current version. The version flags
|
||||
* below can be used to conditionally enable certain features on versions newer
|
||||
* than this. Please record the reason we cannot support an older version.
|
||||
*
|
||||
* Reason: Changes to how the tracing environment is set up.
|
||||
*/
|
||||
const CODEQL_MINIMUM_VERSION = "2.3.1";
|
||||
|
||||
/**
|
||||
* Versions of CodeQL that version-flag certain functionality in the Action.
|
||||
* For convenience, please keep these in descending order. Once a version
|
||||
* flag is older than the oldest supported version above, it may be removed.
|
||||
*/
|
||||
const CODEQL_VERSION_RAM_FINALIZE = "2.5.8";
|
||||
const CODEQL_VERSION_DIAGNOSTICS = "2.5.6";
|
||||
const CODEQL_VERSION_METRICS = "2.5.5";
|
||||
const CODEQL_VERSION_GROUP_RULES = "2.5.5";
|
||||
const CODEQL_VERSION_SARIF_GROUP = "2.5.3";
|
||||
|
||||
function getCodeQLBundleName(): string {
|
||||
let platform: string;
|
||||
@@ -319,7 +338,8 @@ export async function setupCodeQL(
|
||||
tempDir: string,
|
||||
toolCacheDir: string,
|
||||
variant: util.GitHubVariant,
|
||||
logger: Logger
|
||||
logger: Logger,
|
||||
checkVersion: boolean
|
||||
): Promise<{ codeql: CodeQL; toolsVersion: string }> {
|
||||
try {
|
||||
// We use the special value of 'latest' to prioritize the version in the
|
||||
@@ -430,7 +450,7 @@ export async function setupCodeQL(
|
||||
throw new Error(`Unsupported platform: ${process.platform}`);
|
||||
}
|
||||
|
||||
cachedCodeQL = getCodeQLForCmd(codeqlCmd);
|
||||
cachedCodeQL = await getCodeQLForCmd(codeqlCmd, checkVersion);
|
||||
return { codeql: cachedCodeQL, toolsVersion: codeqlURLVersion };
|
||||
} catch (e) {
|
||||
logger.error(e);
|
||||
@@ -467,9 +487,9 @@ export function convertToSemVer(version: string, logger: Logger): string {
|
||||
/**
|
||||
* Use the CodeQL executable located at the given path.
|
||||
*/
|
||||
export function getCodeQL(cmd: string): CodeQL {
|
||||
export async function getCodeQL(cmd: string): Promise<CodeQL> {
|
||||
if (cachedCodeQL === undefined) {
|
||||
cachedCodeQL = getCodeQLForCmd(cmd);
|
||||
cachedCodeQL = await getCodeQLForCmd(cmd, true);
|
||||
}
|
||||
return cachedCodeQL;
|
||||
}
|
||||
@@ -542,13 +562,19 @@ export function getCachedCodeQL(): CodeQL {
|
||||
return cachedCodeQL;
|
||||
}
|
||||
|
||||
function getCodeQLForCmd(cmd: string): CodeQL {
|
||||
return {
|
||||
async function getCodeQLForCmd(
|
||||
cmd: string,
|
||||
checkVersion: boolean
|
||||
): Promise<CodeQL> {
|
||||
let cachedVersion: undefined | Promise<string> = undefined;
|
||||
const codeql = {
|
||||
getPath() {
|
||||
return cmd;
|
||||
},
|
||||
async getVersion() {
|
||||
return await runTool(cmd, ["version", "--format=terse"]);
|
||||
if (cachedVersion === undefined)
|
||||
cachedVersion = runTool(cmd, ["version", "--format=terse"]);
|
||||
return await cachedVersion;
|
||||
},
|
||||
async printVersion() {
|
||||
await runTool(cmd, ["version", "--format=json"]);
|
||||
@@ -775,15 +801,21 @@ function getCodeQLForCmd(cmd: string): CodeQL {
|
||||
"interpret-results",
|
||||
threadsFlag,
|
||||
"--format=sarif-latest",
|
||||
"--print-diagnostics-summary",
|
||||
"--print-metrics-summary",
|
||||
"--sarif-group-rules-by-pack",
|
||||
"-v",
|
||||
`--output=${sarifFile}`,
|
||||
addSnippetsFlag,
|
||||
...getExtraOptionsFromEnv(["database", "interpret-results"]),
|
||||
];
|
||||
if (automationDetailsId !== undefined) {
|
||||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_DIAGNOSTICS))
|
||||
codeqlArgs.push("--print-diagnostics-summary");
|
||||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_METRICS))
|
||||
codeqlArgs.push("--print-metrics-summary");
|
||||
if (await util.codeQlVersionAbove(this, CODEQL_VERSION_GROUP_RULES))
|
||||
codeqlArgs.push("--sarif-group-rules-by-pack");
|
||||
if (
|
||||
automationDetailsId !== undefined &&
|
||||
(await util.codeQlVersionAbove(this, CODEQL_VERSION_SARIF_GROUP))
|
||||
) {
|
||||
codeqlArgs.push("--sarif-category", automationDetailsId);
|
||||
}
|
||||
codeqlArgs.push(databasePath, ...querySuitePaths);
|
||||
@@ -856,6 +888,15 @@ function getCodeQLForCmd(cmd: string): CodeQL {
|
||||
await new toolrunner.ToolRunner(cmd, args).exec();
|
||||
},
|
||||
};
|
||||
if (
|
||||
checkVersion &&
|
||||
!(await util.codeQlVersionAbove(codeql, CODEQL_MINIMUM_VERSION))
|
||||
) {
|
||||
throw new Error(
|
||||
`Expected a CodeQL CLI with version at least ${CODEQL_MINIMUM_VERSION} but got version ${await codeql.getVersion()}`
|
||||
);
|
||||
}
|
||||
return codeql;
|
||||
}
|
||||
|
||||
function packWithVersionToString(pack: PackWithVersion): string {
|
||||
|
||||
@@ -2,10 +2,6 @@ import { LocDir } from "github-linguist";
|
||||
|
||||
import { Language } from "./languages";
|
||||
import { Logger } from "./logging";
|
||||
import { assertNever } from "./util";
|
||||
|
||||
// Language IDs used by codeql when specifying its metrics.
|
||||
export type IdPrefix = "cpp" | "cs" | "go" | "java" | "js" | "py" | "rb";
|
||||
|
||||
// Map from linguist language names to language prefixes used in the action and codeql
|
||||
const linguistToMetrics: Record<string, Language> = {
|
||||
@@ -31,28 +27,6 @@ const nameToLinguist = Object.entries(linguistToMetrics).reduce(
|
||||
{} as Record<Language, string[]>
|
||||
);
|
||||
|
||||
export function getIdPrefix(language: Language): IdPrefix {
|
||||
switch (language) {
|
||||
case Language.cpp:
|
||||
return "cpp";
|
||||
case Language.csharp:
|
||||
return "cs";
|
||||
case Language.go:
|
||||
return "go";
|
||||
case Language.java:
|
||||
return "java";
|
||||
case Language.javascript:
|
||||
return "js";
|
||||
case Language.python:
|
||||
return "py";
|
||||
case Language.ruby:
|
||||
return "rb";
|
||||
|
||||
default:
|
||||
assertNever(language);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the lines of code of the specified language using the include
|
||||
* and exclude glob paths.
|
||||
|
||||
@@ -52,7 +52,7 @@ export async function uploadDatabases(
|
||||
return;
|
||||
}
|
||||
|
||||
const codeql = getCodeQL(config.codeQLCmd);
|
||||
const codeql = await getCodeQL(config.codeQLCmd);
|
||||
for (const language of config.languages) {
|
||||
// Bundle the database up into a single zip file
|
||||
const databasePath = util.getCodeQLDatabasePath(config, language);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"bundleVersion": "codeql-bundle-20210809"
|
||||
"bundleVersion": "codeql-bundle-20210907"
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ export async function initCodeQL(
|
||||
tempDir,
|
||||
toolCacheDir,
|
||||
variant,
|
||||
logger
|
||||
logger,
|
||||
true
|
||||
);
|
||||
await codeql.printVersion();
|
||||
logger.endGroup();
|
||||
|
||||
@@ -195,7 +195,7 @@ program
|
||||
|
||||
let codeql: CodeQL;
|
||||
if (cmd.codeqlPath !== undefined) {
|
||||
codeql = getCodeQL(cmd.codeqlPath);
|
||||
codeql = await getCodeQL(cmd.codeqlPath);
|
||||
} else {
|
||||
codeql = (
|
||||
await initCodeQL(
|
||||
|
||||
@@ -123,7 +123,7 @@ export function getAddSnippetsFlag(
|
||||
|
||||
/**
|
||||
* Get the codeql `--threads` value specified for the `threads` input.
|
||||
* If not value was specified, all available threads will be used.
|
||||
* If no value was specified, all available threads will be used.
|
||||
*
|
||||
* The value will be capped to the number of available CPUs.
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user