Skip to content

Commit 00da887

Browse files
authored
Merge branch 'main' into tausbn/yeast-tree-schema
2 parents a9329b0 + dd031f5 commit 00da887

230 files changed

Lines changed: 5019 additions & 1997 deletions

File tree

Some content is hidden

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

‎AGENTS.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Repository instructions
2+
3+
When writing commit messages, follow the requirements in the [Commit message conventions section of CONTRIBUTING.md](CONTRIBUTING.md#commit-message-conventions).

‎CONTRIBUTING.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ Note that the CodeQL for Visual Studio Code documentation has been migrated to h
1010

1111
Any nontrivial user-visible change to a query pack or library pack should have a change note. For details on how to add a change note for your change, see [this guide](docs/change-notes.md).
1212

13+
## Commit message conventions
14+
15+
Follow these requirements when writing commit messages:
16+
17+
- Use `<Area>: <action>`, for example `Python: Fix captured variable liveness`. Areas include `C++`, `JS`, `Rust`, `Shared`, etc. Omit the prefix when it adds little context.
18+
- Use a short, imperative summary: "Add", "Fix", "Remove", "Update", or "Simplify", followed by the specific change.
19+
- Use area prefixes rather than Conventional Commits prefixes such as `feat:` and `fix:`.
20+
1321
## Submitting a new experimental query
1422

1523
If you have an idea for a query that you would like to share with other CodeQL users, please open a pull request to add it to this repository. New queries start out in a `<language>/ql/src/experimental` directory, to which they can be merged when they meet the following requirements.

‎Cargo.lock‎

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

‎Cargo.toml‎

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,57 @@ exclude = [
3030
"rust/ql/integration-tests",
3131
]
3232

33+
[workspace.lints.rust]
34+
redundant_imports = "warn"
35+
3336
[workspace.lints.clippy]
3437
all = { level = "warn", priority = -1 }
35-
explicit_iter_loop = "warn"
36-
manual_let_else = "warn"
38+
pedantic = { level = "warn", priority = -1 }
39+
40+
# Allowlist of pedantic rules that we've observed to be of questionable value
41+
missing_errors_doc = "allow"
42+
missing_panics_doc = "allow"
43+
must_use_candidate = "allow"
44+
implicit_hasher = "allow"
45+
if_not_else = "allow"
46+
# This lint has a lot of results in generated code.
47+
unnecessary_wraps = "allow"
48+
# Spelling out the full method name can often be tedious.
49+
# E.g., `|v| v.as_slice()` vs `vec::Vec::as_slice`
50+
redundant_closure_for_method_calls = "allow"
51+
# The next three are only false positives and questionable results
52+
cast_possible_truncation = "allow"
53+
cast_possible_wrap = "allow"
54+
cast_sign_loss = "allow"
55+
# False positives
56+
struct_excessive_bools = "allow"
57+
# False positives for things like "matches" and "matched"
58+
similar_names = "allow"
59+
match_same_arms = "allow"
60+
struct_field_names = "allow"
61+
62+
# Additional lints from the `restriction` and `nursery` group
63+
as_pointer_underscore = "warn"
64+
clone_on_ref_ptr = "warn"
65+
collection_is_never_read = "warn"
66+
deref_by_slicing = "warn"
67+
derive_partial_eq_without_eq = "warn"
68+
disallowed_script_idents = "warn"
69+
empty_drop = "warn"
70+
empty_enum_variants_with_brackets = "warn"
71+
empty_structs_with_brackets = "warn"
72+
fn_to_numeric_cast_any = "warn"
73+
if_then_some_else_none = "warn"
74+
needless_pass_by_ref_mut = "warn"
75+
or_fun_call = "warn"
76+
redundant_clone = "warn"
77+
redundant_type_annotations = "warn"
78+
renamed_function_params = "warn"
79+
semicolon_inside_block = "warn"
80+
undocumented_unsafe_blocks = "warn"
81+
unnecessary_safety_comment = "warn"
82+
unnecessary_safety_doc = "warn"
83+
unnecessary_struct_initialization = "warn"
84+
unneeded_field_pattern = "warn"
85+
unused_result_ok = "warn"
86+
too_long_first_doc_paragraph = "warn"

‎MODULE.bazel‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ use_repo(
142142
"vendor_rs__globset-0.4.18",
143143
"vendor_rs__itertools-0.14.0",
144144
"vendor_rs__itertools-0.15.0",
145-
"vendor_rs__lazy_static-1.5.1",
146145
"vendor_rs__mustache-0.9.0",
147146
"vendor_rs__num-traits-0.2.19",
148147
"vendor_rs__num_cpus-1.17.0",
@@ -348,7 +347,7 @@ use_repo(
348347
)
349348

350349
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
351-
go_sdk.download(version = "1.27.3")
350+
go_sdk.download(version = "1.27.4")
352351

353352
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
354353
go_deps.from_file(go_mod = "//go/extractor:go.mod")

‎clippy.toml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Names that do not need to be backtick quoted within documentation comments.
2+
doc-valid-idents = ["CodeQL", ".."]

‎cpp/extractor/bmn/src/compiler.rs‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ fn find_posix(
303303
let (command_path, command_version) = get_compiler_version(kind, name)?;
304304
let (commandpp_path, commandpp_version) = get_compiler_version(kind, namepp)?;
305305

306-
let mimic_c_flags = vec![OsString::from("--mimic"), command_path.clone()];
307-
let mimic_cpp_flags = vec![OsString::from("--mimic"), commandpp_path.clone()];
306+
let mimic_c_flags = vec![OsString::from("--mimic"), command_path];
307+
let mimic_cpp_flags = vec![OsString::from("--mimic"), commandpp_path];
308308

309309
let default_compiler_include_checker = CompilerDefaultIncludes::from(telemetry, name, namepp);
310310

@@ -518,28 +518,38 @@ fn get_compiler_override(
518518
&clang_c_compiler,
519519
&clang_cpp_compiler,
520520
)
521-
.ok_or(anyhow!(
522-
"Could not find clang compilers: {clang_c_compiler:?}, {clang_cpp_compiler:?}"
523-
))
521+
.ok_or_else(|| {
522+
anyhow!(
523+
"Could not find clang compilers: {}, {}",
524+
clang_c_compiler.display(),
525+
clang_cpp_compiler.display()
526+
)
527+
})
524528
} else if override_instruction == "gnu" {
525529
// These can be just a command name, e.g. "gcc-18", or a full path, e.g.
526530
// "/usr/bin/gcc-18"
527531
let gnu_c_compiler =
528532
environment::get_required_os(environment::CODEQL_EXTRACTOR_CPP_BMN_COMPILER_GNU_C)?;
529533
let gnu_cpp_compiler =
530534
environment::get_required_os(environment::CODEQL_EXTRACTOR_CPP_BMN_COMPILER_GNU_CPP)?;
531-
find_posix(telemetry, Compiler::Gnu, &gnu_c_compiler, &gnu_cpp_compiler).ok_or(anyhow!(
532-
"Could not find gnu compilers: {gnu_c_compiler:?}, {gnu_cpp_compiler:?}"
533-
))
535+
find_posix(telemetry, Compiler::Gnu, &gnu_c_compiler, &gnu_cpp_compiler).ok_or_else(|| {
536+
anyhow!(
537+
"Could not find gnu compilers: {}, {}",
538+
gnu_c_compiler.display(),
539+
gnu_cpp_compiler.display()
540+
)
541+
})
534542
} else if override_instruction == "msvc" {
535543
// These can be just a command name, e.g. "cl", or a full path, e.g.
536544
// "c:\msvc\cl.exe"
537545
let msvc_compiler =
538546
environment::get_required_os(environment::CODEQL_EXTRACTOR_CPP_BMN_COMPILER_MSVC)?;
539-
use_cl(&msvc_compiler).ok_or(anyhow!("Could not find msvc compiler: {msvc_compiler:?}"))
547+
use_cl(&msvc_compiler)
548+
.ok_or_else(|| anyhow!("Could not find msvc compiler: {}", msvc_compiler.display()))
540549
} else {
541550
Err(anyhow!(
542-
"Unsupported compiler override instruction: {override_instruction:?}"
551+
"Unsupported compiler override instruction: {}",
552+
override_instruction.display()
543553
))
544554
}
545555
}

‎cpp/extractor/bmn/src/dependency_installation.rs‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn run_command(command: &mut Command) -> anyhow::Result<()> {
4545
} else {
4646
OsString::from("Failed to read output")
4747
};
48-
Err(anyhow!("\"{command_name}\" failed: {error:?}"))
48+
Err(anyhow!("\"{command_name}\" failed: {}", error.display()))
4949
}
5050
Err(e) => Err(anyhow!("Error waiting for process \"{command_name}\": {e}")),
5151
}
@@ -86,7 +86,7 @@ fn install_package(package_name: &str) -> anyhow::Result<()> {
8686
}
8787

8888
/// Struct to manage package installation state
89-
struct PackageInstaller {}
89+
struct PackageInstaller;
9090

9191
impl PackageInstaller {
9292
/// Create a new `PackageInstaller` and perform an initial `apt-get update`
@@ -95,11 +95,15 @@ impl PackageInstaller {
9595
bail!("'sudo apt-get' not available.");
9696
}
9797
apt_update()?;
98-
Ok(Self {})
98+
Ok(Self)
9999
}
100100

101101
/// Ensure the given package is installed
102-
#[allow(clippy::unused_self)]
102+
#[allow(
103+
clippy::unused_self,
104+
clippy::needless_pass_by_ref_mut,
105+
reason = "Package installation mutates system state, so require exclusive access."
106+
)]
103107
fn install_package(&mut self, package_name: &str) -> anyhow::Result<()> {
104108
install_package(package_name)
105109
}

‎cpp/extractor/bmn/src/directory_tree.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ mod tests {
171171
mod from_path {
172172
use super::*;
173173
use crate::test_utils::get_resource;
174-
use std::collections::HashSet;
175-
use std::ffi::OsString;
176174

177175
fn check_files(tree: &DirectoryTree, file_name: &str, expected: &[PathBuf]) {
178176
let files = tree

‎cpp/extractor/bmn/src/extraction_command_runner.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,7 @@ mod tests {
383383
use super::*;
384384
use crate::project_definitions::Language;
385385
use all_asserts::{assert_false, assert_true};
386-
use std::ffi::OsString;
387386
use std::path::PathBuf;
388-
use std::time::Duration;
389387

390388
fn make_command(
391389
args: &[&str],
@@ -407,7 +405,6 @@ mod tests {
407405

408406
#[allow(clippy::unnecessary_wraps)]
409407
fn fake_status(exit_code: i32) -> io::Result<ExitStatus> {
410-
use std::process::ExitStatus;
411408
#[cfg(unix)]
412409
{
413410
use std::os::unix::process::ExitStatusExt;

0 commit comments

Comments
 (0)