codeql-go merge prep: integrate go/ into codeql

This commit is contained in:
Chuan-kai Lin 2022-04-26 09:49:37 -07:00
Родитель 097d5189e9
Коммит 1276c41e83
19 изменённых файлов: 52 добавлений и 116 удалений

Просмотреть файл

@ -6,6 +6,8 @@
"*/ql/examples/qlpack.yml", "*/ql/examples/qlpack.yml",
"*/ql/consistency-queries/qlpack.yml", "*/ql/consistency-queries/qlpack.yml",
"cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml", "cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml",
"go/ql/config/legacy-support/qlpack.yml",
"go/build/codeql-extractor-go/codeql-extractor.yml",
"javascript/ql/experimental/adaptivethreatmodeling/lib/qlpack.yml", "javascript/ql/experimental/adaptivethreatmodeling/lib/qlpack.yml",
"javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/qlpack.yml", "javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/qlpack.yml",
"javascript/ql/experimental/adaptivethreatmodeling/src/qlpack.yml", "javascript/ql/experimental/adaptivethreatmodeling/src/qlpack.yml",

9
.gitattributes поставляемый
Просмотреть файл

@ -39,6 +39,7 @@
*.py text *.py text
*.lua text *.lua text
*.expected text *.expected text
*.go text
# Explicitly set a bunch of known extensions to binary, because Git < 2.10 will treat # Explicitly set a bunch of known extensions to binary, because Git < 2.10 will treat
# `* text=auto eol=lf` as `* text eol=lf` # `* text=auto eol=lf` as `* text eol=lf`
@ -52,6 +53,14 @@
java/ql/test/stubs/**/*.java linguist-generated=true java/ql/test/stubs/**/*.java linguist-generated=true
java/ql/test/experimental/stubs/**/*.java linguist-generated=true java/ql/test/experimental/stubs/**/*.java linguist-generated=true
# Force git not to modify line endings for go or html files under the go/ql directory
go/ql/**/*.go -text
go/ql/**/*.html -text
# Force git not to modify line endings for go dbschemes
go/*.dbscheme -text
# Preserve unusual line ending from codeql-go merge
go/extractor/opencsv/CSVReader.java -text
# For some languages, upgrade script testing references really old dbscheme # For some languages, upgrade script testing references really old dbscheme
# files from legacy upgrades that have CRLF line endings. Since upgrade # files from legacy upgrades that have CRLF line endings. Since upgrade
# resolution relies on object hashes, we must suppress line ending conversion # resolution relies on object hashes, we must suppress line ending conversion

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,4 +1,4 @@
name: CodeQL tests name: "Go: Run Tests"
on: [pull_request] on: [pull_request]
jobs: jobs:
@ -38,22 +38,30 @@ jobs:
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;' run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
- name: Build - name: Build
run: env PATH=$PATH:$HOME/codeql make run: |
cd go
env PATH=$PATH:$HOME/codeql make
- name: Check that all QL and Go code is autoformatted - name: Check that all QL and Go code is autoformatted
run: env PATH=$PATH:$HOME/codeql make check-formatting run: |
cd go
env PATH=$PATH:$HOME/codeql make check-formatting
- name: Compile qhelp files to markdown - name: Compile qhelp files to markdown
run: env PATH=$PATH:$HOME/codeql QHELP_OUT_DIR=qhelp-out make qhelp-to-markdown run: |
cd go
env PATH=$PATH:$HOME/codeql QHELP_OUT_DIR=qhelp-out make qhelp-to-markdown
- name: Upload qhelp markdown - name: Upload qhelp markdown
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: qhelp-markdown name: qhelp-markdown
path: qhelp-out/**/*.md path: go/qhelp-out/**/*.md
- name: Test - name: Test
run: env PATH=$PATH:$HOME/codeql make test run: |
cd go
env PATH=$PATH:$HOME/codeql make test
test-mac: test-mac:
name: Test MacOS name: Test MacOS
@ -90,10 +98,14 @@ jobs:
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;' run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
- name: Build - name: Build
run: env PATH=$PATH:$HOME/codeql make run: |
cd go
env PATH=$PATH:$HOME/codeql make
- name: Test - name: Test
run: env PATH=$PATH:$HOME/codeql make test run: |
cd go
env PATH=$PATH:$HOME/codeql make test
test-win: test-win:
name: Test Windows name: Test Windows
@ -135,9 +147,11 @@ jobs:
- name: Build - name: Build
run: | run: |
$Env:Path += ";$HOME\codeql" $Env:Path += ";$HOME\codeql"
cd go
make make
- name: Test - name: Test
run: | run: |
$Env:Path += ";$HOME\codeql" $Env:Path += ";$HOME\codeql"
cd go
make test make test

2
.github/workflows/ql-for-ql-build.yml поставляемый
Просмотреть файл

@ -140,7 +140,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
folder: [cpp, csharp, java, javascript, python, ql, ruby, swift] folder: [cpp, csharp, java, javascript, python, ql, ruby, swift, go]
needs: needs:
- package - package

13
.gitignore поставляемый
Просмотреть файл

@ -9,6 +9,7 @@
# qltest projects and artifacts # qltest projects and artifacts
*/ql/test/**/*.testproj */ql/test/**/*.testproj
*/ql/test/**/*.actual */ql/test/**/*.actual
*/ql/test/**/go.sum
# Visual studio temporaries, except a file used by QL4VS # Visual studio temporaries, except a file used by QL4VS
.vs/* .vs/*
@ -42,3 +43,15 @@ csharp/extractor/Semmle.Extraction.CSharp.Driver/Properties/launchSettings.json
# CLion project files # CLion project files
/.clwb /.clwb
# Go build artifacts
go/build/*
# Go binaries
go/tools/bin
go/tools/linux64
go/tools/osx64
go/tools/win64
go/tools/tokenizer.jar
go/main

Просмотреть файл

@ -6,6 +6,7 @@ path_classifiers:
test: test:
- csharp/ql/src - csharp/ql/src
- csharp/ql/test - csharp/ql/test
- go/ql/test
- javascript/extractor/parser-tests - javascript/extractor/parser-tests
- javascript/extractor/tests - javascript/extractor/tests
- javascript/ql/src - javascript/ql/src
@ -13,6 +14,9 @@ path_classifiers:
- python/ql/src - python/ql/src
- python/ql/test - python/ql/test
example:
- go/ql/src
queries: queries:
- include: "*" - include: "*"

Просмотреть файл

@ -1,5 +1,6 @@
/cpp/ @github/codeql-c-analysis /cpp/ @github/codeql-c-analysis
/csharp/ @github/codeql-csharp /csharp/ @github/codeql-csharp
/go/ @github/codeql-go
/java/ @github/codeql-java /java/ @github/codeql-java
/javascript/ @github/codeql-javascript /javascript/ @github/codeql-javascript
/python/ @github/codeql-python /python/ @github/codeql-python

Просмотреть файл

@ -1,20 +0,0 @@
{
"provide": [
"ql/src/qlpack.yml",
"ql/lib/qlpack.yml",
"ql/examples/qlpack.yml",
"ql/test/qlpack.yml",
"ql/config/legacy-support/qlpack.yml",
"build/codeql-extractor-go/codeql-extractor.yml"
],
"ignore": [
"the-extractor-which-needs-to-be-built"
],
"versionPolicies": {
"default": {
"requireChangeNotes": true,
"committedPrereleaseSuffix": "dev",
"committedVersion": "nextPatchRelease"
}
}
}

Просмотреть файл

@ -1,10 +0,0 @@
{
"extensions": [
"github.vscode-codeql",
"slevesque.vscode-zipexplorer"
],
"settings": {
"codeQL.runningQueries.memory": 2048,
"codeQL.runningQueries.debug": true
}
}

6
go/.gitattributes поставляемый
Просмотреть файл

@ -1,6 +0,0 @@
# Force git not to modify line endings for go or html files under the ql directory
ql/**/*.go -text
ql/**/*.html -text
# Force git not to modify line endings for dbschemes
*.dbscheme -text

4
go/.github/codeql/codeql-config.yml поставляемый
Просмотреть файл

@ -1,4 +0,0 @@
name: "CodeQL config"
queries:
- uses: security-and-quality

33
go/.github/workflows/check-change-note.yml поставляемый
Просмотреть файл

@ -1,33 +0,0 @@
on:
pull_request_target:
types: [labeled, unlabeled, opened, synchronize, reopened, ready_for_review]
paths:
- "ql/src/**/*.ql"
- "ql/src/**/*.qll"
- "!**/experimental/**"
jobs:
check-change-note:
runs-on: ubuntu-latest
steps:
- name: Check if change note file is present
uses: dorny/paths-filter@7c0f15b688b020e95e00f15c61299b022f08ca95 # v2.8.0
id: paths_filter
with:
filters: |
change_note:
- '**/change-notes/*.md'
- name: Get PR labels
id: pr-labels
uses: joerick/pr-labels-action@0a4cc4ee0ab557ec0b1ae1157fa6fa7f9f4c494b # v1.0.6
- name: Fail if change note is missing
uses: actions/github-script@v3
if: |
github.event.pull_request.draft == false &&
steps.paths_filter.outputs.change_note == 'false' &&
!contains(steps.pr-labels.outputs.labels, ' no-change-note-required ')
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
core.setFailed('No change note found.' +
' Either add one, or add the `no-change-note-required` label.')

28
go/.gitignore поставляемый
Просмотреть файл

@ -1,28 +0,0 @@
# editor and OS artifacts
*~
.DS_STORE
# query compilation caches
.cache
# build artifacts
build/*
# qltest projects and artifacts
ql/test/**/*.testproj
ql/test/**/*.actual
ql/test/**/go.sum
# Java class files
**/*.class
# binaries
tools/bin
tools/linux64
tools/osx64
tools/win64
tools/tokenizer.jar
main
# QL pack output directories
.codeql

Просмотреть файл

@ -1,5 +0,0 @@
path_classifiers:
test:
- ql/test
example:
- ql/src

Просмотреть файл

@ -1 +0,0 @@
* @github/codeql-go