Skip to content

Commit 4a6bcec

Browse files
authored
Merge pull request github#7017 from github/nickrolfe/extractor_options
Ruby: expose TRAP compression option
2 parents 3481652 + 9cf2acf commit 4a6bcec

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

ruby/codeql-extractor.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,21 @@ 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:
21+
title: Options pertaining to TRAP.
22+
type: object
23+
properties:
24+
compression:
25+
title: Controls compression for the TRAP files written by the extractor.
26+
description: >
27+
This option is only intended for use in debugging the extractor. Accepted
28+
values are 'gzip' (the default, to write gzip-compressed TRAP) and 'none'
29+
(to write uncompressed TRAP).
30+
type: string
31+
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)