-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Description
Description of the false positive
When there is an if-let statement, and multiple conditions exist in the conditional check (either AND or OR as operators), CodeQL flags the original variable as unused if it is used in subsequent conditional statements.
Code samples or links to source code
There are many dismissed false positives linked to this merged PR: tarolling/seiri#57
A small example would be:
for result in builder.build() {
match result {
Ok(entry) => {
if let Some(file_type) = entry.file_type()
&& file_type.is_file()
{
paths.push(entry.path().to_path_buf());
}
}
Err(msg) => eprintln!("Error reading entry: {msg}"),
}
}Here, file_type was flagged as a false positive, even though it is used in the following boolean statement file_type.is_file().
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackNo fields configured for issues without a type.