-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add QL for QL #7410
Merged
erik-krogh
merged 860 commits into
github:main
from
erik-krogh:erik-krogh/publish-ql-for-ql
Dec 17, 2021
Merged
Add QL for QL #7410
Changes from 250 commits
Commits
Show all changes
860 commits
Select commit
Hold shift + click to select a range
ab11bce
document usage
esbena dfa0e77
QL: New performance query: Transitive step in recursion.
aschackmull ec292db
New performance query: Transitive step in recursion.
aschackmull 1013cb4
QL: Query for finding missing or unwanted bidirectional imports of ab…
joefarebrother ec6a8b9
Query for finding missing or unwanted bidirectional imports of abstra…
joefarebrother be36de9
QL: Fix isAbstract
joefarebrother 9b786c2
Fix isAbstract
joefarebrother 9330fa0
QL: Merge pull request #105 from github/aschackmull/transitive-step
MathiasVP 3e2fb5a
Merge pull request #105 from github/aschackmull/transitive-step
MathiasVP ecf27ff
QL: Add ql/missing-qldoc query.
geoffw0 0a3705b
Add ql/missing-qldoc query.
geoffw0 187c24e
QL: QL: Add query for finding missing nomagic on candidate predicates.
MathiasVP 4016a8e
QL: Add query for finding missing nomagic on candidate predicates.
MathiasVP 37e9024
QL: Query: Noninitial imports of the standard library
tausbn c6a52ed
Query: Noninitial imports of the standard library
tausbn 632d42f
QL: Autoformat
tausbn 71f6999
Autoformat
tausbn f9d8ae5
QL: fix implicit this
erik-krogh 016ff2a
fix implicit this
erik-krogh f29457f
QL: Merge pull request #113 from github/erik-krogh/fix-implcit-this
MathiasVP 50e80dc
Merge pull request #113 from github/erik-krogh/fix-implcit-this
MathiasVP 153f8fe
QL: fix the signature of regexpCapture and regexpFind
erik-krogh c31bd7a
fix the signature of regexpCapture and regexpFind
erik-krogh 74a7945
QL: fix `getArity` on `PredicateOrBuiltin`
erik-krogh f19dd78
fix `getArity` on `PredicateOrBuiltin`
erik-krogh 6cd11d2
QL: update expected output
erik-krogh 1641d0f
update expected output
erik-krogh f071da4
QL: add test
erik-krogh 29ebe7b
add test
erik-krogh ddc0ade
QL: hook up consistency query
erik-krogh 541dcb3
hook up consistency query
erik-krogh 8e6bc11
QL: Merge pull request #86 from github/use-set-literal
MathiasVP e1871a2
Merge pull request #86 from github/use-set-literal
MathiasVP 2352cf7
QL: Merge pull request #114 from github/erik-krogh/consistency
tausbn fed640b
Merge pull request #114 from github/erik-krogh/consistency
tausbn e862dfd
QL: Merge pull request #102 from github/esbena/simple-codeql-action
erik-krogh e6b0707
Merge pull request #102 from github/esbena/simple-codeql-action
erik-krogh 2f77b92
QL: Merge pull request #107 from github/missing-qldoc
geoffw0 ee7ac53
Merge pull request #107 from github/missing-qldoc
geoffw0 6fe7579
QL: remove leftover test predicate
erik-krogh e3d42a1
remove leftover test predicate
erik-krogh 9f4c829
QL: Upgrade the extractor generator
tausbn 816bfbe
Upgrade the extractor generator
tausbn 8020040
QL: Autoformat
tausbn 7f80514
Autoformat
tausbn 0954584
QL: add test for qlpacks, and get them to work
erik-krogh 741e4a7
add test for qlpacks, and get them to work
erik-krogh 53e362c
QL: Merge pull request #112 from github/tausbn/import-language-first
tausbn 310ea6b
Merge pull request #112 from github/tausbn/import-language-first
tausbn 514f8f3
QL: Also update `qltest.cmd`
tausbn 5ef7b97
Also update `qltest.cmd`
tausbn 3fc0bed
QL: Remove some FPs.
aschackmull 6c70f52
Remove some FPs.
aschackmull b75e19a
QL: Merge branch 'main' into tausbn/update-extractor-generator
tausbn 89d2f93
Merge branch 'main' into tausbn/update-extractor-generator
tausbn 4238a5b
QL: Merge pull request #116 from github/erik-krogh/qlpack-test
tausbn bd52438
Merge pull request #116 from github/erik-krogh/qlpack-test
tausbn e5dab01
QL: Update `build.yml` to supply generator args
tausbn 2a0c291
Update `build.yml` to supply generator args
tausbn 85e5b68
QL: Fix `dataset_measure.yml`, hopefully
tausbn 44fff65
Fix `dataset_measure.yml`, hopefully
tausbn 4fe4315
QL: QL: Add dataflow library.
MathiasVP 5c70c6a
QL: Add dataflow library.
MathiasVP d90de13
QL: QL: Add query for using toString in query logic.
MathiasVP c9f80b1
QL: Add query for using toString in query logic.
MathiasVP 9c82f72
QL: Ignore overridden predicates in consistency check
tausbn ccaef19
Ignore overridden predicates in consistency check
tausbn 53cbde0
QL: Merge branch 'main' into tausbn/add-override-test
tausbn 1fb8a17
Merge branch 'main' into tausbn/add-override-test
tausbn 6f4370a
QL: Update `bleeding-codeql-analysis.yml`
tausbn e185382
Update `bleeding-codeql-analysis.yml`
tausbn 24959a5
QL: Fix bad merge
tausbn 10aeadb
Fix bad merge
tausbn 8aa354c
QL: fix performance
erik-krogh 1a79b13
fix performance
erik-krogh 510f825
QL: New query: Don't use library annotation.
aschackmull b0bbbc5
New query: Don't use library annotation.
aschackmull 1d331fc
QL: Remove the dataflow library.
MathiasVP 3071731
Remove the dataflow library.
MathiasVP ed15ee8
QL: Merge pull request #122 from github/aschackmull/library-annot
MathiasVP 67b65b6
Merge pull request #122 from github/aschackmull/library-annot
MathiasVP 21caef3
QL: QL: Reduce precision to 'medium'.
MathiasVP 1469766
QL: Reduce precision to 'medium'.
MathiasVP 7745a13
QL: Merge pull request #117 from github/tausbn/update-extractor-gener…
tausbn 8ceeb71
Merge pull request #117 from github/tausbn/update-extractor-generator
tausbn 370d75b
QL: Merge pull request #104 from github/bidirectional-import
aschackmull 684600c
Merge pull request #104 from github/bidirectional-import
aschackmull 1375e1d
QL: Support `super` with `instanceof`
tausbn 5b261d8
Support `super` with `instanceof`
tausbn 5dbeaa1
QL: Merge pull request #123 from github/tausbn/add-instanceof-super-r…
MathiasVP ed17bd9
Merge pull request #123 from github/tausbn/add-instanceof-super-resol…
MathiasVP d6dd752
QL: Merge pull request #95 from github/tausbn/add-override-test
tausbn eb787ae
Merge pull request #95 from github/tausbn/add-override-test
tausbn 4d5901a
QL: QL: Respond to PR reviews.
MathiasVP f5bb1d0
QL: Respond to PR reviews.
MathiasVP 02c2603
QL: Merge pull request #119 from github/query-depends-on-tostring
MathiasVP df3d5ae
Merge pull request #119 from github/query-depends-on-tostring
MathiasVP 188a6b1
QL: Merge branch 'main' into missing-nomagic
MathiasVP dbc3b49
Merge branch 'main' into missing-nomagic
MathiasVP 0bfedc7
QL: fix performance of the transitive step query
erik-krogh 62355f3
fix performance of the transitive step query
erik-krogh 24334e4
QL: Merge pull request #109 from github/missing-nomagic
MathiasVP 299500f
Merge pull request #109 from github/missing-nomagic
MathiasVP 9a02a22
QL: Merge pull request #124 from github/erik-krogh/fix-step-performance
tausbn d950b59
Merge pull request #124 from github/erik-krogh/fix-step-performance
tausbn 8391580
QL: add an consistency test for the totality of `getParent()`
erik-krogh d0aa219
add an consistency test for the totality of `getParent()`
erik-krogh b40e307
QL: add failing callgraph test
erik-krogh 535904e
add failing callgraph test
erik-krogh c7aa89b
QL: add missing `getChild()` relations
erik-krogh 7ce2750
add missing `getChild()` relations
erik-krogh 1239b1a
QL: fix getEnclosingModule, which broke the callgraph
erik-krogh f8138c9
fix getEnclosingModule, which broke the callgraph
erik-krogh 3252c04
QL: improve resolution of buildin predicates (and getAQlClass())
erik-krogh 145efa4
improve resolution of buildin predicates (and getAQlClass())
erik-krogh e060708
QL: correctly resolve super calls in char preds
erik-krogh 3b1c04b
correctly resolve super calls in char preds
erik-krogh 865e4f0
QL: find dbscheme files that are contained within a subfolder
erik-krogh f19a229
find dbscheme files that are contained within a subfolder
erik-krogh efff86e
QL: Merge pull request #125 from github/erik-krogh/fix-my-own-mistake
erik-krogh 6004ecc
Merge pull request #125 from github/erik-krogh/fix-my-own-mistake
erik-krogh e528c6f
QL: add test for type resolution
erik-krogh 2a5d567
add test for type resolution
erik-krogh 34d4e55
QL: better type resolution of add expressions
erik-krogh c1b011d
better type resolution of add expressions
erik-krogh 4c32b7e
QL: add test for super-types
erik-krogh c43ff2f
add test for super-types
erik-krogh 928b91d
QL: resolve super-expressions when the super-type is explicitly menti…
erik-krogh f99ce11
resolve super-expressions when the super-type is explicitly mentioned
erik-krogh a652892
QL: better support for getType on super
erik-krogh b31ea30
better support for getType on super
erik-krogh 1b9793d
QL: only resolve imports to qll files, and not e.g. dbschemes
erik-krogh 74b1c19
only resolve imports to qll files, and not e.g. dbschemes
erik-krogh 84d2cb8
QL: and consistency query that will highlight new consistency errors
erik-krogh 9d9663d
and consistency query that will highlight new consistency errors
erik-krogh 8ad5b34
QL: add test for predicateExpr
erik-krogh 2af3fb5
add test for predicateExpr
erik-krogh 6cec644
QL: NewTypeBranches are Predicates
erik-krogh 055937e
NewTypeBranches are Predicates
erik-krogh 9681119
QL: add `noResolvePredicateExpr` to the list of empty consistency pre…
erik-krogh dc354f8
add `noResolvePredicateExpr` to the list of empty consistency predicates
erik-krogh 4db6702
QL: fix predicate resolution
erik-krogh 9127fa5
fix predicate resolution
erik-krogh 48d4fcd
QL: fix some inconsistencies related to primitive types
erik-krogh 18eede5
fix some inconsistencies related to primitive types
erik-krogh 8997989
QL: fix code-scanning alert
erik-krogh 09f60f2
fix code-scanning alert
erik-krogh b317d73
QL: fix broken import in unused file
erik-krogh ade2061
fix broken import in unused file
erik-krogh 9e4e428
QL: add support for libraryPathDependencies in qlpacks
erik-krogh 9a73c36
add support for libraryPathDependencies in qlpacks
erik-krogh ef6ea19
QL: add nonTotalGetParent to the list of empty consistency queries
erik-krogh 509e77b
add nonTotalGetParent to the list of empty consistency queries
erik-krogh 7e2b00e
QL: use workflow_call in bleeding-codeql-analysis.yml
esbena c200ec3
use workflow_call in bleeding-codeql-analysis.yml
esbena dc715af
QL: add nightly-changes workflow
esbena eded7b8
add nightly-changes workflow
esbena f29813b
QL: Merge pull request #131 from github/esbena/workflow-improvements
esbena a9cef84
Merge pull request #131 from github/esbena/workflow-improvements
esbena 6cc14b1
QL: change branch name
esbena a089e0e
change branch name
esbena d49db92
QL: change code-scanning branch
esbena e851ba2
change code-scanning branch
esbena 032a0dc
QL: Merge pull request #132 from github/esbena/fix-branch
esbena b96ad38
Merge pull request #132 from github/esbena/fix-branch
esbena 5fa1c04
QL: Update bleeding-codeql-analysis.yml
esbena 3f420c4
Update bleeding-codeql-analysis.yml
esbena 769f787
QL: Update readme with alerts and actions information
esbena 0760c1c
Update readme with alerts and actions information
esbena ac78e26
QL: Merge pull request #133 from github/esbena/update-readme
esbena 629605c
Merge pull request #133 from github/esbena/update-readme
esbena c00e18f
QL: cleanup
erik-krogh 631a503
cleanup
erik-krogh 3bc209d
QL: Fix create-extractor-pack.ps1
geoffw0 1f2b32f
Fix create-extractor-pack.ps1
geoffw0 fff1f12
QL: Merge pull request #135 from github/winfix
tausbn 7214d70
Merge pull request #135 from github/winfix
tausbn f54f70d
QL: Merge pull request #130 from github/erik-krogh/more-types
erik-krogh cc16fde
Merge pull request #130 from github/erik-krogh/more-types
erik-krogh 1b19a3e
QL: introduce FieldDecl in the ast
erik-krogh 5a76e7d
introduce FieldDecl in the ast
erik-krogh 7c82c5e
QL: refactor away the `ComparisonOp` ast class
erik-krogh 9d308ba
refactor away the `ComparisonOp` ast class
erik-krogh 0154f4e
QL: add getLeft/getRight helper predicates to disjunction/conjunction
erik-krogh 84d277d
add getLeft/getRight helper predicates to disjunction/conjunction
erik-krogh c3f3628
QL: performance improvements
erik-krogh ac4476f
performance improvements
erik-krogh 28444c7
QL: move implementation of implicit-this to Query.qll file
erik-krogh 45def1b
move implementation of implicit-this to Query.qll file
erik-krogh f320414
QL: move use-instanceof implementation to Query.qll, and rename the .…
erik-krogh 33d363e
move use-instanceof implementation to Query.qll, and rename the .ql file
erik-krogh 1cbacc4
QL: move use-set-literal implementation to Query.qll file
erik-krogh 112cd9d
move use-set-literal implementation to Query.qll file
erik-krogh 12a3fa7
QL: add var unused in disjunct query
erik-krogh 97461d1
add var unused in disjunct query
erik-krogh d8bf7ed
QL: add redundant inline cast query
erik-krogh 89604de
add redundant inline cast query
erik-krogh d64c7fc
QL: rename "use matches" query, and refactor into Query.qll
erik-krogh 38b925b
rename "use matches" query, and refactor into Query.qll
erik-krogh 1b070f1
QL: Merge pull request #129 from github/erik-krogh/cartesian
erik-krogh 349b556
Merge pull request #129 from github/erik-krogh/cartesian
erik-krogh c07d553
QL: update import script
erik-krogh fb40b8a
update import script
erik-krogh fa54855
QL: Add codeql sources (6c2713dd8bf76ae1207e3123900a04d6f89b5162)
erik-krogh 61b7180
Add codeql sources (6c2713dd8bf76ae1207e3123900a04d6f89b5162)
erik-krogh fe09778
QL: Add codeql-go sources (4cae4b23fc1b2b1760e259b660996e9bb5573279)
erik-krogh e3c0e19
Add codeql-go sources (4cae4b23fc1b2b1760e259b660996e9bb5573279)
erik-krogh 9a6c9c4
QL: remove codeql-ruby sources
erik-krogh a0bf130
remove codeql-ruby sources
erik-krogh 44ffc7e
QL: Merge pull request #126 from github/erik-krogh/update-sources
erik-krogh 036d749
Merge pull request #126 from github/erik-krogh/update-sources
erik-krogh 37c2db2
QL: update inefficientStringComparison, to avoid underscores
erik-krogh 15b5658
update inefficientStringComparison, to avoid underscores
erik-krogh d89e430
QL: introduce type resolution consistency checks
erik-krogh 1a0379a
introduce type resolution consistency checks
erik-krogh 70f6493
QL: Add codeql sources (1f3f7e9ccc631177f671f3d465faec3477cbe1c5)
erik-krogh a86f2c3
Add codeql sources (1f3f7e9ccc631177f671f3d465faec3477cbe1c5)
erik-krogh 172684c
QL: Merge pull request #137 from github/erik-krogh/even-more-consistency
erik-krogh e25f03f
Merge pull request #137 from github/erik-krogh/even-more-consistency
erik-krogh da5c2fb
QL: bump the severity of ql/implicit-this
erik-krogh 8e1b4e3
bump the severity of ql/implicit-this
erik-krogh 44c3787
QL: Add codeql sources (3c59aa319ee79d8038eec863df7ab18372c7b30e)
erik-krogh d852b28
Add codeql sources (3c59aa319ee79d8038eec863df7ab18372c7b30e)
erik-krogh a3d11c6
QL: Add codeql-go sources (894102defd0777931a0e261ad66e631e63ec0ad8)
erik-krogh 3ebf1e3
Add codeql-go sources (894102defd0777931a0e261ad66e631e63ec0ad8)
erik-krogh a722aeb
QL: Merge pull request #138 from github/erik-krogh/bump-this
erik-krogh fe1a473
Merge pull request #138 from github/erik-krogh/bump-this
erik-krogh d06ac78
QL: move files and folder, except dotfiles, into a ql subfolder
erik-krogh 56a8cdb
move files and folder, except dotfiles, into a ql subfolder
erik-krogh 8eac1dc
QL: move .vscode folder inside the ql subfolder
erik-krogh 08b0642
QL: remove repo-tests
erik-krogh b73b60d
QL: remove the .devcontainer
erik-krogh 633597c
QL: remove the nightly ql-for-ql job
erik-krogh fdb15d6
QL: remove workflow that ran CodeQL with a published pack
erik-krogh f5788b9
QL: adjust remaining workflows to work in the QL folder
erik-krogh dc91877
QL: simplify the build/analyze workflow into a single workflow
erik-krogh d89c41b
QL: update the readme
erik-krogh 5d93309
QL: call the product `QL for QL` (because it rolls nicely).
erik-krogh 24c2578
QL: cache query compilation
erik-krogh faaa74b
QL: move .git files into the ql/ folder
erik-krogh 77cb822
QL: fix search path for dataset measure
erik-krogh 8d91ba2
QL: fix Esbens workflow comments
erik-krogh 0ac3e5c
Merge QL for QL into github/codeql
erik-krogh fb97923
QL: merge the .codeqlmanifest.json file in the root
erik-krogh 4beacee
QL: fix Buildins/Builtins typo
erik-krogh 133c496
Merge branch 'main' into erik-krogh/publish-ql-for-ql
erik-krogh 76dcfd4
more specific search path for dataset measure job
erik-krogh 8eda061
add dbscheme and codeql version to query hash
erik-krogh be076dc
add Erik and Taus as QL-for-QL reviewers
erik-krogh 2626b0b
QL: fix test workflow
erik-krogh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
name: Run QL for QL | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
queries: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache queries | ||
id: cache-queries | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ runner.temp }}/query-pack.zip | ||
key: queries-${{ hashFiles('**/*.ql*') }} | ||
- name: Find codeql | ||
if: steps.cache-queries.outputs.cache-hit != 'true' | ||
id: find-codeql | ||
uses: github/codeql-action/init@esbena/ql | ||
erik-krogh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
with: | ||
languages: javascript # does not matter | ||
erik-krogh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Build query pack | ||
if: steps.cache-queries.outputs.cache-hit != 'true' | ||
run: | | ||
cd ql/ql/src | ||
"${CODEQL}" pack create | ||
cd .codeql/pack/codeql/ql-all/0.0.0 | ||
zip "${PACKZIP}" -r . | ||
env: | ||
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} | ||
PACKZIP: ${{ runner.temp }}/query-pack.zip | ||
- name: Upload query pack | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: query-pack-zip | ||
path: ${{ runner.temp }}/query-pack.zip | ||
|
||
extractors: | ||
strategy: | ||
fail-fast: false | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
ql/target | ||
key: ${{ runner.os }}-rust-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Check formatting | ||
run: cd ql; cargo fmt --all -- --check | ||
- name: Build | ||
run: cd ql; cargo build --verbose | ||
- name: Run tests | ||
run: cd ql; cargo test --verbose | ||
- name: Release build | ||
run: cd ql; cargo build --release | ||
- name: Generate dbscheme | ||
run: ql/target/release/ql-generator --dbscheme ql/ql/src/ql.dbscheme --library ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: extractor-ubuntu-latest | ||
path: | | ||
ql/target/release/ql-extractor | ||
ql/target/release/ql-extractor.exe | ||
retention-days: 1 | ||
package: | ||
runs-on: ubuntu-latest | ||
|
||
needs: | ||
- extractors | ||
- queries | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: query-pack-zip | ||
path: query-pack-zip | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: extractor-ubuntu-latest | ||
path: linux64 | ||
- run: | | ||
unzip query-pack-zip/*.zip -d pack | ||
cp -r ql/codeql-extractor.yml ql/tools ql/ql/src/ql.dbscheme.stats pack/ | ||
mkdir -p pack/tools/linux64 | ||
if [[ -f linux64/ql-extractor ]]; then | ||
cp linux64/ql-extractor pack/tools/linux64/extractor | ||
chmod +x pack/tools/linux64/extractor | ||
fi | ||
cd pack | ||
zip -rq ../codeql-ql.zip . | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: codeql-ql-pack | ||
path: codeql-ql.zip | ||
retention-days: 1 | ||
analyze: | ||
runs-on: ubuntu-latest | ||
|
||
needs: | ||
- package | ||
|
||
steps: | ||
- name: Download pack | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: codeql-ql-pack | ||
path: ${{ runner.temp }}/codeql-ql-pack-artifact | ||
|
||
- name: Prepare pack | ||
run: | | ||
unzip "${PACK_ARTIFACT}/*.zip" -d "${PACK}" | ||
env: | ||
PACK_ARTIFACT: ${{ runner.temp }}/codeql-ql-pack-artifact | ||
PACK: ${{ runner.temp }}/pack | ||
- name: Hack codeql-action options | ||
run: | | ||
JSON=$(jq -nc --arg pack "${PACK}" '.resolve.queries=["--search-path", $pack] | .resolve.extractor=["--search-path", $pack] | .database.init=["--search-path", $pack]') | ||
echo "CODEQL_ACTION_EXTRA_OPTIONS=${JSON}" >> ${GITHUB_ENV} | ||
env: | ||
PACK: ${{ runner.temp }}/pack | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@esbena/ql | ||
with: | ||
languages: ql | ||
db-location: ${{ runner.temp }}/db | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@esbena/ql | ||
erik-krogh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Collect database stats for QL for QL | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- ql/ql/src/ql.dbscheme | ||
pull_request: | ||
branches: [main] | ||
paths: | ||
- ql/ql/src/ql.dbscheme | ||
workflow_dispatch: | ||
|
||
jobs: | ||
measure: | ||
env: | ||
CODEQL_THREADS: 4 # TODO: remove this once it's set by the CLI | ||
strategy: | ||
matrix: | ||
repo: | ||
- github/codeql | ||
- github/codeql-go | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Find codeql | ||
id: find-codeql | ||
uses: github/codeql-action/init@esbena/ql | ||
with: | ||
languages: javascript # does not matter | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
ql/target | ||
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Build Extractor | ||
run: cd ql; env "PATH=$PATH:`dirname ${CODEQL}`" ./create-extractor-pack.sh | ||
env: | ||
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} | ||
- name: Checkout ${{ matrix.repo }} | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: ${{ matrix.repo }} | ||
path: ${{ github.workspace }}/repo | ||
- name: Create database | ||
run: | | ||
"${CODEQL}" database create \ | ||
--search-path "ql/extractor-pack" \ | ||
--threads 4 \ | ||
--language ql --source-root "${{ github.workspace }}/repo" \ | ||
"${{ runner.temp }}/database" | ||
env: | ||
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} | ||
- name: Measure database | ||
run: | | ||
mkdir -p "stats/${{ matrix.repo }}" | ||
"${CODEQL}" dataset measure --threads 4 --output "stats/${{ matrix.repo }}/stats.xml" "${{ runner.temp }}/database/db-ql" | ||
env: | ||
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: measurements | ||
path: stats | ||
retention-days: 1 | ||
|
||
merge: | ||
runs-on: ubuntu-latest | ||
needs: measure | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: measurements | ||
path: stats | ||
- run: | | ||
python -m pip install --user lxml | ||
find stats -name 'stats.xml' -print0 | sort -z | xargs -0 python ql/scripts/merge_stats.py --output ql/ql/src/ql.dbscheme.stats --normalise ql_tokeninfo | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: ql.dbscheme.stats | ||
path: ql/ql/src/ql.dbscheme.stats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Run QL for QL Tests | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- ql/* | ||
pull_request: | ||
branches: [main] | ||
paths: | ||
- ql/* | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
qltest: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Find codeql | ||
id: find-codeql | ||
uses: github/codeql-action/init@esbena/ql | ||
with: | ||
languages: javascript # does not matter | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
ql/target | ||
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Build Extractor | ||
run: cd ql; env "PATH=$PATH:`dirname ${CODEQL}`" ./create-extractor-pack.sh | ||
env: | ||
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} | ||
- name: Run QL tests | ||
run: "${CODEQL}" test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}"/ql --consistency-queries ql/ql/consistency-queries ql/ql/test | ||
env: | ||
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} | ||
- name: Check QL formatting | ||
run: find ql/ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 "${CODEQL}" query format --check-only | ||
env: | ||
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} | ||
- name: Check QL compilation | ||
run: "${CODEQL}" query compile --check-only --threads=4 --warnings=error --search-path "${{ github.workspace }}" "ql/ql/src" "ql/ql/examples" | ||
env: | ||
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Cargo.lock -diff -whitespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
target | ||
extractor-pack | ||
.vscode/launch.json | ||
.cache | ||
ql/test/**/*.testproj | ||
ql/test/**/*.actual | ||
ql/test/**/CONSISTENCY | ||
work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "cargo", | ||
"subcommand": "build", | ||
"problemMatcher": [ | ||
"$rustc" | ||
], | ||
"group": "build", | ||
"label": "Rust: cargo build" | ||
} | ||
] | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Technically, the dbscheme and its stats belong to this key as well. But so does the hash of the
codeql
-cli itself.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the version (from
codeql-version
) and the hash of the dbscheme files to the key.