Skip to content

Commit 7649772

Browse files
nickrolfehmac
authored andcommitted
Expose TRAP compression option via the new extractor options feature.
1 parent 3481652 commit 7649772

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

ruby/codeql-extractor.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,17 @@ file_types:
1111
- name: ruby
1212
display_name: Ruby files
1313
extensions:
14-
- .rb
14+
- .rb
1515
- name: erb
1616
display_name: Ruby templates
1717
extensions:
18-
- .erb
18+
- .erb
19+
options:
20+
trap_compression:
21+
title: Controls compression for the TRAP files written by the extractor.
22+
description: >
23+
This option is only intended for use in debugging the extractor. Accepted
24+
values are 'gzip' (the default, to write gzip-compressed TRAP) and 'none'
25+
(to write uncompressed TRAP).
26+
type: string
27+
pattern: "^(none|gzip)$"

ruby/extractor/src/main.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,19 @@ fn main() -> std::io::Result<()> {
9292
"threads"
9393
}
9494
);
95-
let trap_compression = match trap::Compression::from_env("CODEQL_RUBY_TRAP_COMPRESSION") {
96-
Ok(x) => x,
97-
Err(e) => {
98-
main_thread_logger.write(
99-
main_thread_logger
100-
.new_entry("configuration-error", "Configuration error")
101-
.message("{}; using gzip.", &[diagnostics::MessageArg::Code(&e)])
102-
.severity(diagnostics::Severity::Warning),
103-
);
104-
trap::Compression::Gzip
105-
}
106-
};
95+
let trap_compression =
96+
match trap::Compression::from_env("CODEQL_EXTRACTOR_RUBY_OPTION_TRAP_COMPRESSION") {
97+
Ok(x) => x,
98+
Err(e) => {
99+
main_thread_logger.write(
100+
main_thread_logger
101+
.new_entry("configuration-error", "Configuration error")
102+
.message("{}; using gzip.", &[diagnostics::MessageArg::Code(&e)])
103+
.severity(diagnostics::Severity::Warning),
104+
);
105+
trap::Compression::Gzip
106+
}
107+
};
107108
drop(main_thread_logger);
108109
rayon::ThreadPoolBuilder::new()
109110
.num_threads(num_threads)

0 commit comments

Comments
 (0)