Skip to content

Commit 060060b

Browse files
committed
Merge remote-tracking branch 'origin/main' into getPrimaryQlClasses
2 parents 5e783e4 + 51d729a commit 060060b

File tree

196 files changed

+11252
-5984
lines changed

Some content is hidden

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

196 files changed

+11252
-5984
lines changed

.codeqlmanifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"provide": [
3+
"ql/lib/qlpack.yml",
34
"ql/src/qlpack.yml",
45
"ql/consistency-queries/qlpack.yml",
56
"ql/test/qlpack.yml",

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/node-types"
5+
schedule:
6+
interval: "daily"
7+
- package-ecosystem: "cargo"
8+
directory: "/generator"
9+
schedule:
10+
interval: "daily"
11+
- package-ecosystem: "cargo"
12+
directory: "/extractor"
13+
schedule:
14+
interval: "daily"
15+
- package-ecosystem: "cargo"
16+
directory: "/autobuilder"
17+
schedule:
18+
interval: "daily"

.github/workflows/build.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ jobs:
4747
run: cargo build --release
4848
- name: Generate dbscheme
4949
if: ${{ matrix.os == 'ubuntu-latest' }}
50-
run: target/release/ruby-generator --dbscheme ql/src/ruby.dbscheme --library ql/src/codeql_ruby/ast/internal/TreeSitter.qll
50+
run: target/release/ruby-generator --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
5151
- uses: actions/upload-artifact@v2
5252
if: ${{ matrix.os == 'ubuntu-latest' }}
5353
with:
5454
name: ruby.dbscheme
55-
path: ql/src/ruby.dbscheme
55+
path: ql/lib/ruby.dbscheme
5656
- uses: actions/upload-artifact@v2
5757
if: ${{ matrix.os == 'ubuntu-latest' }}
5858
with:
5959
name: TreeSitter.qll
60-
path: ql/src/codeql_ruby/ast/internal/TreeSitter.qll
60+
path: ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
6161
- uses: actions/upload-artifact@v2
6262
with:
6363
name: extractor-${{ matrix.os }}
@@ -82,8 +82,10 @@ jobs:
8282
GITHUB_TOKEN: ${{ github.token }}
8383
- name: Build Query Pack
8484
run: |
85+
codeql/codeql pack create ql/lib --output target/packs
86+
codeql/codeql pack install ql/src
8587
codeql/codeql pack create ql/src --output target/packs
86-
PACK_FOLDER=$(readlink -f target/packs/github/codeql-ruby/*)
88+
PACK_FOLDER=$(readlink -f target/packs/codeql/ruby-queries/*)
8789
codeql/codeql generate query-help --format=sarifv2.1.0 --output="${PACK_FOLDER}/rules.sarif" ql/src
8890
(cd ql/src; find queries \( -name '*.qhelp' -o -name '*.rb' -o -name '*.erb' \) -exec bash -c 'mkdir -p "'"${PACK_FOLDER}"'/$(dirname "{}")"' \; -exec cp "{}" "${PACK_FOLDER}/{}" \;)
8991
- name: Compile with previous CodeQL versions
@@ -126,7 +128,7 @@ jobs:
126128
path: osx64
127129
- run: |
128130
mkdir -p ruby
129-
cp -r codeql-extractor.yml tools ql/src/ruby.dbscheme.stats ruby/
131+
cp -r codeql-extractor.yml tools ql/lib/ruby.dbscheme.stats ruby/
130132
mkdir -p ruby/tools/{linux64,osx64,win64}
131133
cp linux64/ruby-autobuilder ruby/tools/linux64/autobuilder
132134
cp osx64/ruby-autobuilder ruby/tools/osx64/autobuilder
@@ -204,26 +206,20 @@ jobs:
204206
echo "| 2 |" > "test.expected"
205207
echo 'name: sample-tests
206208
version: 0.0.0
207-
libraryPathDependencies:
208-
- codeql-ruby
209+
dependencies:
210+
codeql/ruby-all: 0.0.1
209211
extractor: ruby
210212
tests: .
211213
' > qlpack.yml
212-
echo '- qlpack: codeql-ruby
213-
- include:
214-
kind:
215-
- problem
216-
- path-problem
217-
' > suite.qls
218214
- name: Run QL test
219215
shell: bash
220216
run: |
221-
"${{ runner.temp }}/codeql/codeql" test run --search-path "${{ runner.temp }}/ruby-bundle" .
217+
"${{ runner.temp }}/codeql/codeql" test run --search-path "${{ runner.temp }}/ruby-bundle" --additional-packs "${{ runner.temp }}/ruby-bundle" .
222218
- name: Create database
223219
shell: bash
224220
run: |
225221
"${{ runner.temp }}/codeql/codeql" database create --search-path "${{ runner.temp }}/ruby-bundle" --language ruby --source-root . ../database
226222
- name: Analyze database
227223
shell: bash
228224
run: |
229-
"${{ runner.temp }}/codeql/codeql" database analyze --search-path "${{ runner.temp }}/ruby-bundle" --format=sarifv2.1.0 --output=out.sarif ../database suite.qls
225+
"${{ runner.temp }}/codeql/codeql" database analyze --search-path "${{ runner.temp }}/ruby-bundle" --format=sarifv2.1.0 --output=out.sarif ../database ruby-code-scanning.qls

.github/workflows/dataset_measure.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on:
44
push:
55
branches: [main]
66
paths:
7-
- ql/src/ruby.dbscheme
7+
- ql/lib/ruby.dbscheme
88
pull_request:
99
branches: [main]
1010
paths:
11-
- ql/src/ruby.dbscheme
11+
- ql/lib/ruby.dbscheme
1212
workflow_dispatch:
1313

1414
jobs:
@@ -73,8 +73,8 @@ jobs:
7373
path: stats
7474
- run: |
7575
python -m pip install --user lxml
76-
find stats -name 'stats.xml' | sort | xargs python scripts/merge_stats.py --output ql/src/ruby.dbscheme.stats --normalise ruby_tokeninfo
76+
find stats -name 'stats.xml' | sort | xargs python scripts/merge_stats.py --output ql/lib/ruby.dbscheme.stats --normalise ruby_tokeninfo
7777
- uses: actions/upload-artifact@v2
7878
with:
7979
name: ruby.dbscheme.stats
80-
path: ql/src/ruby.dbscheme.stats
80+
path: ql/lib/ruby.dbscheme.stats

.github/workflows/qltest.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,18 @@ jobs:
3131
- name: Build Extractor
3232
run: env "PATH=$PATH:${{ github.workspace }}/codeql" scripts/create-extractor-pack.sh
3333
- name: Run QL tests
34-
run: codeql/codeql test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}" --consistency-queries ql/consistency-queries ql/test
34+
run: |
35+
codeql/codeql pack install ql/test
36+
codeql/codeql test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}" --additional-packs "${HOME}/.codeql/packages/codeql/suite-helpers/0.0.1" --consistency-queries ql/consistency-queries ql/test
3537
- name: Check QL formatting
3638
run: find ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 codeql/codeql query format --check-only
3739
- name: Check QL compilation
38-
run: codeql/codeql query compile --check-only --threads=4 --warnings=error --search-path "${{ github.workspace }}" "ql/src" "ql/examples"
40+
run: |
41+
codeql/codeql pack install ql/src
42+
codeql/codeql query compile --check-only --threads=4 --warnings=error --search-path "${{ github.workspace }}" "ql/src" "ql/examples"
43+
- name: Check DB upgrade scripts
44+
run: |
45+
echo >empty.trap
46+
codeql/codeql dataset import -S ql/lib/upgrades/initial/ruby.dbscheme testdb empty.trap
47+
codeql/codeql dataset upgrade testdb --additional-packs ql/lib/upgrades
48+
diff -q testdb/ruby.dbscheme ql/lib/ruby.dbscheme

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ extractor-pack
55
ql/test/**/*.testproj
66
ql/test/**/*.actual
77
ql/test/**/CONSISTENCY
8+
.codeql

CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
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.html
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

Cargo.lock

Lines changed: 10 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020-2021 GitHub
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ FILES=codeql-extractor.yml\
2121
tools/autobuild.sh\
2222
tools/qltest.sh\
2323
tools/autobuild.cmd\
24-
ql/src/ruby.dbscheme.stats\
25-
ql/src/ruby.dbscheme
24+
ql/lib/ruby.dbscheme.stats\
25+
ql/lib/ruby.dbscheme
2626

2727
BIN_FILES=target/release/ruby-extractor$(EXE) target/release/ruby-autobuilder$(EXE)
2828

2929
extractor-common:
3030
rm -rf build
3131
mkdir build
3232
mkdir build/codeql-extractor-ruby
33-
cp codeql-extractor.yml ql/src/ruby.dbscheme ql/src/ruby.dbscheme.stats build/codeql-extractor-ruby
33+
cp codeql-extractor.yml ql/lib/ruby.dbscheme ql/lib/ruby.dbscheme.stats build/codeql-extractor-ruby
3434
cp -r tools build/codeql-extractor-ruby/
3535

3636
.PHONY: tools
@@ -45,8 +45,8 @@ target/release/%$(EXE):
4545

4646
dbscheme:
4747
cargo build --bin ruby-generator
48-
cargo run -p ruby-generator -- --dbscheme ql/src/ruby.dbscheme --library ql/src/codeql_ruby/ast/internal/TreeSitter.qll
49-
codeql query format -i ql/src/codeql_ruby/ast/internal/TreeSitter.qll
48+
cargo run -p ruby-generator -- --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
49+
codeql query format -i ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
5050

5151
.PHONY: extractor
5252
extractor: $(FILES) $(BIN_FILES)
@@ -61,7 +61,11 @@ extractor: $(FILES) $(BIN_FILES)
6161
cp tools/autobuild.sh extractor-pack/tools/autobuild.sh
6262
cp tools/qltest.sh extractor-pack/tools/qltest.sh
6363
cp tools/autobuild.cmd extractor-pack/tools/autobuild.cmd
64-
cp ql/src/ruby.dbscheme.stats extractor-pack/ruby.dbscheme.stats
65-
cp ql/src/ruby.dbscheme extractor-pack/ruby.dbscheme
64+
cp ql/lib/ruby.dbscheme.stats extractor-pack/ruby.dbscheme.stats
65+
cp ql/lib/ruby.dbscheme extractor-pack/ruby.dbscheme
6666
cp target/release/ruby-extractor$(EXE) extractor-pack/tools/$(CODEQL_PLATFORM)/extractor$(EXE)
6767
cp target/release/ruby-autobuilder$(EXE) extractor-pack/tools/$(CODEQL_PLATFORM)/autobuilder$(EXE)
68+
69+
test: extractor dbscheme
70+
codeql pack install ql/test
71+
codeql test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path . --consistency-queries ql/consistency-queries ql/test

0 commit comments

Comments
 (0)