mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Merge branch 'main' into cklin/rc-3.18-mergeback
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)$"
|
||||
|
||||
1
ruby/ql/integration-tests/compression/methods.expected
Normal file
1
ruby/ql/integration-tests/compression/methods.expected
Normal file
@@ -0,0 +1 @@
|
||||
| source.rb:1:1:3:3 | f |
|
||||
4
ruby/ql/integration-tests/compression/methods.ql
Normal file
4
ruby/ql/integration-tests/compression/methods.ql
Normal file
@@ -0,0 +1,4 @@
|
||||
import codeql.ruby.AST
|
||||
|
||||
from Method m
|
||||
select m
|
||||
3
ruby/ql/integration-tests/compression/source.rb
Normal file
3
ruby/ql/integration-tests/compression/source.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
def f
|
||||
puts "hello"
|
||||
end
|
||||
26
ruby/ql/integration-tests/compression/test.py
Normal file
26
ruby/ql/integration-tests/compression/test.py
Normal 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"
|
||||
Reference in New Issue
Block a user