Merge branch 'main' into cklin/rc-3.18-mergeback

This commit is contained in:
Chuan-kai Lin
2025-06-09 07:19:40 -07:00
893 changed files with 27680 additions and 10497 deletions

View File

@@ -65,4 +65,4 @@ extractor: $(FILES) $(BIN_FILES)
cp ../target/release/codeql-extractor-ruby$(EXE) extractor-pack/tools/$(CODEQL_PLATFORM)/extractor$(EXE)
test: extractor dbscheme
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
codeql test run --check-databases --check-diff-informed --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path .. --consistency-queries ql/consistency-queries ql/test

View File

@@ -27,7 +27,7 @@ options:
title: Controls compression for the TRAP files written by the extractor.
description: >
This option is only intended for use in debugging the extractor. Accepted
values are 'gzip' (the default, to write gzip-compressed TRAP) and 'none'
(to write uncompressed TRAP).
values are 'gzip' (the default, to write gzip-compressed TRAP) 'zstd' (to
write Zstandard-compressed TRAP) and 'none' (to write uncompressed TRAP).
type: string
pattern: "^(none|gzip)$"
pattern: "^(none|gzip|zstd)$"

View File

@@ -0,0 +1 @@
| source.rb:1:1:3:3 | f |

View File

@@ -0,0 +1,4 @@
import codeql.ruby.AST
from Method m
select m

View File

@@ -0,0 +1,3 @@
def f
puts "hello"
end

View File

@@ -0,0 +1,26 @@
import pytest
@pytest.mark.parametrize(("compression", "suffix"), [
pytest.param("none", [], id="none"),
pytest.param("gzip", [".gz"], id="gzip"),
pytest.param("zstd", [".zst"], id="zstd"),
])
def test(codeql, ruby, compression, suffix, cwd):
codeql.database.create(
_env={
"CODEQL_EXTRACTOR_RUBY_OPTION_TRAP_COMPRESSION": compression,
}
)
trap_files = [*(cwd / "test-db" / "trap").rglob("*.trap*")]
assert trap_files, "No trap files found"
expected_suffixes = [".trap"] + suffix
def is_of_expected_format(file):
return file.name == "metadata.trap.gz" or \
file.suffixes[-len(expected_suffixes):] == expected_suffixes
files_with_wrong_format = [
f for f in trap_files if not is_of_expected_format(f)
]
assert not files_with_wrong_format, f"Found trap files with wrong format"