Skip to content

Commit d3ebc81

Browse files
authored
Merge pull request #8631 from github/cklin/merge-codeql-go
Merge codeql-go repository into codeql
2 parents 9b0d84c + 7f96319 commit d3ebc81

File tree

2,276 files changed

+199112
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,276 files changed

+199112
-13
lines changed

.codeqlmanifest.json

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"*/ql/examples/qlpack.yml",
77
"*/ql/consistency-queries/qlpack.yml",
88
"cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml",
9+
"go/ql/config/legacy-support/qlpack.yml",
10+
"go/build/codeql-extractor-go/codeql-extractor.yml",
911
"javascript/ql/experimental/adaptivethreatmodeling/lib/qlpack.yml",
1012
"javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/qlpack.yml",
1113
"javascript/ql/experimental/adaptivethreatmodeling/src/qlpack.yml",

.gitattributes

+9
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
*.py text
4040
*.lua text
4141
*.expected text
42+
*.go text
4243

4344
# Explicitly set a bunch of known extensions to binary, because Git < 2.10 will treat
4445
# `* text=auto eol=lf` as `* text eol=lf`
@@ -52,6 +53,14 @@
5253
java/ql/test/stubs/**/*.java linguist-generated=true
5354
java/ql/test/experimental/stubs/**/*.java linguist-generated=true
5455

56+
# Force git not to modify line endings for go or html files under the go/ql directory
57+
go/ql/**/*.go -text
58+
go/ql/**/*.html -text
59+
# Force git not to modify line endings for go dbschemes
60+
go/*.dbscheme -text
61+
# Preserve unusual line ending from codeql-go merge
62+
go/extractor/opencsv/CSVReader.java -text
63+
5564
# For some languages, upgrade script testing references really old dbscheme
5665
# files from legacy upgrades that have CRLF line endings. Since upgrade
5766
# resolution relies on object hashes, we must suppress line ending conversion
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "codeql-query-format",
5+
"pattern": [
6+
{
7+
"regexp": "^((.*) would change by autoformatting\\.)$",
8+
"file": 2,
9+
"message": 1
10+
}
11+
]
12+
}
13+
]
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "codeql-syntax-check",
5+
"pattern": [
6+
{
7+
"regexp": "^((ERROR|WARNING): .* \\((.*):(\\d+),(\\d+)-\\d+\\))$",
8+
"message": 1,
9+
"file": 3,
10+
"line": 4,
11+
"col": 5,
12+
"severity": 2
13+
}
14+
]
15+
}
16+
]
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "codeql-test-run",
5+
"pattern": [
6+
{
7+
"regexp": "(\\[.*\\] FAILED\\((RESULT|COMPILATION)\\) (.*))$",
8+
"file": 3,
9+
"message": 1
10+
}
11+
]
12+
}
13+
]
14+
}

.github/problem-matchers/make.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "make",
5+
"pattern": [
6+
{
7+
"regexp": "^(make: \\*\\*\\* .*)$",
8+
"message": 1
9+
}
10+
]
11+
}
12+
]
13+
}

.github/workflows/go-tests.yml

+157
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: "Go: Run Tests"
2+
on: [pull_request]
3+
jobs:
4+
5+
test-linux:
6+
name: Test Linux (Ubuntu)
7+
runs-on: ubuntu-latest
8+
steps:
9+
10+
- name: Set up Go 1.18.1
11+
uses: actions/setup-go@v1
12+
with:
13+
go-version: 1.18.1
14+
id: go
15+
16+
- name: Set up CodeQL CLI
17+
run: |
18+
echo "Removing old CodeQL Directory..."
19+
rm -rf $HOME/codeql
20+
echo "Done"
21+
cd $HOME
22+
echo "Downloading CodeQL CLI..."
23+
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | grep -v beta | tail -1)
24+
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-linux64.zip "$LATEST"
25+
echo "Done"
26+
echo "Unpacking CodeQL CLI..."
27+
unzip -q codeql-linux64.zip
28+
rm -f codeql-linux64.zip
29+
echo "Done"
30+
env:
31+
GITHUB_TOKEN: ${{ github.token }}
32+
33+
- name: Check out code
34+
uses: actions/checkout@v2
35+
36+
- name: Enable problem matchers in repository
37+
shell: bash
38+
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
39+
40+
- name: Build
41+
run: |
42+
cd go
43+
env PATH=$PATH:$HOME/codeql make
44+
45+
- name: Check that all QL and Go code is autoformatted
46+
run: |
47+
cd go
48+
env PATH=$PATH:$HOME/codeql make check-formatting
49+
50+
- name: Compile qhelp files to markdown
51+
run: |
52+
cd go
53+
env PATH=$PATH:$HOME/codeql QHELP_OUT_DIR=qhelp-out make qhelp-to-markdown
54+
55+
- name: Upload qhelp markdown
56+
uses: actions/upload-artifact@v2
57+
with:
58+
name: qhelp-markdown
59+
path: go/qhelp-out/**/*.md
60+
61+
- name: Test
62+
run: |
63+
cd go
64+
env PATH=$PATH:$HOME/codeql make test
65+
66+
test-mac:
67+
name: Test MacOS
68+
runs-on: macOS-latest
69+
steps:
70+
- name: Set up Go 1.18.1
71+
uses: actions/setup-go@v1
72+
with:
73+
go-version: 1.18.1
74+
id: go
75+
76+
- name: Set up CodeQL CLI
77+
run: |
78+
echo "Removing old CodeQL Directory..."
79+
rm -rf $HOME/codeql
80+
echo "Done"
81+
cd $HOME
82+
echo "Downloading CodeQL CLI..."
83+
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | grep -v beta | tail -1)
84+
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-osx64.zip "$LATEST"
85+
echo "Done"
86+
echo "Unpacking CodeQL CLI..."
87+
unzip -q codeql-osx64.zip
88+
rm -f codeql-osx64.zip
89+
echo "Done"
90+
env:
91+
GITHUB_TOKEN: ${{ github.token }}
92+
93+
- name: Check out code
94+
uses: actions/checkout@v2
95+
96+
- name: Enable problem matchers in repository
97+
shell: bash
98+
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
99+
100+
- name: Build
101+
run: |
102+
cd go
103+
env PATH=$PATH:$HOME/codeql make
104+
105+
- name: Test
106+
run: |
107+
cd go
108+
env PATH=$PATH:$HOME/codeql make test
109+
110+
test-win:
111+
name: Test Windows
112+
runs-on: windows-2019
113+
steps:
114+
- name: Set up Go 1.18.1
115+
uses: actions/setup-go@v1
116+
with:
117+
go-version: 1.18.1
118+
id: go
119+
120+
- name: Set up CodeQL CLI
121+
run: |
122+
echo "Removing old CodeQL Directory..."
123+
rm -rf $HOME/codeql
124+
echo "Done"
125+
cd "$HOME"
126+
echo "Downloading CodeQL CLI..."
127+
LATEST=$(gh release list --repo https://github.com/github/codeql-cli-binaries | cut -f 1 | sort --version-sort | grep -v beta | tail -1)
128+
gh release download --repo https://github.com/github/codeql-cli-binaries --pattern codeql-win64.zip "$LATEST"
129+
echo "Done"
130+
echo "Unpacking CodeQL CLI..."
131+
unzip -q -o codeql-win64.zip
132+
unzip -q -o codeql-win64.zip codeql/codeql.exe
133+
rm -f codeql-win64.zip
134+
echo "Done"
135+
env:
136+
GITHUB_TOKEN: ${{ github.token }}
137+
shell:
138+
bash
139+
140+
- name: Check out code
141+
uses: actions/checkout@v2
142+
143+
- name: Enable problem matchers in repository
144+
shell: bash
145+
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
146+
147+
- name: Build
148+
run: |
149+
$Env:Path += ";$HOME\codeql"
150+
cd go
151+
make
152+
153+
- name: Test
154+
run: |
155+
$Env:Path += ";$HOME\codeql"
156+
cd go
157+
make test

.github/workflows/ql-for-ql-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ jobs:
140140
runs-on: ubuntu-latest
141141
strategy:
142142
matrix:
143-
folder: [cpp, csharp, java, javascript, python, ql, ruby, swift]
143+
folder: [cpp, csharp, java, javascript, python, ql, ruby, swift, go]
144144

145145
needs:
146146
- package

.github/workflows/ql-for-ql-dataset_measure.yml

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919
matrix:
2020
repo:
2121
- github/codeql
22-
- github/codeql-go
2322
runs-on: ubuntu-latest
2423
steps:
2524
- uses: actions/checkout@v3

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# qltest projects and artifacts
1010
*/ql/test/**/*.testproj
1111
*/ql/test/**/*.actual
12+
*/ql/test/**/go.sum
1213

1314
# Visual studio temporaries, except a file used by QL4VS
1415
.vs/*
@@ -42,3 +43,15 @@ csharp/extractor/Semmle.Extraction.CSharp.Driver/Properties/launchSettings.json
4243

4344
# CLion project files
4445
/.clwb
46+
47+
# Go build artifacts
48+
go/build/*
49+
50+
# Go binaries
51+
go/tools/bin
52+
go/tools/linux64
53+
go/tools/osx64
54+
go/tools/win64
55+
go/tools/tokenizer.jar
56+
go/main
57+

.lgtm.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ path_classifiers:
66
test:
77
- csharp/ql/src
88
- csharp/ql/test
9+
- go/ql/test
910
- javascript/extractor/parser-tests
1011
- javascript/extractor/tests
1112
- javascript/ql/src
1213
- javascript/ql/test
1314
- python/ql/src
1415
- python/ql/test
1516

17+
example:
18+
- go/ql/src
19+
1620
queries:
1721
- include: "*"
1822

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/cpp/ @github/codeql-c-analysis
22
/csharp/ @github/codeql-csharp
3+
/go/ @github/codeql-go
34
/java/ @github/codeql-java
45
/javascript/ @github/codeql-javascript
56
/python/ @github/codeql-python

go/CODE_OF_CONDUCT.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to make participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies within all project spaces, and it also applies when
49+
an individual is representing the project or its community in public spaces.
50+
Examples of representing a project or community include using an official
51+
project e-mail address, posting via an official social media account, or acting
52+
as an appointed representative at an online or offline event. Representation of
53+
a project may be further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct/
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq/

0 commit comments

Comments
 (0)