Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
juli1 committed Jan 31, 2025
1 parent 874aa58 commit 05da1bb
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions crates/bins/src/bin/datadog-static-analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,30 +322,27 @@ fn main() -> Result<()> {
// Get the max file size from the configuration or default to the default constant.
max_file_size_kb = conf.max_file_size_kb.unwrap_or(DEFAULT_MAX_FILE_SIZE_KB);
ignore_generated_files = conf.ignore_generated_files.unwrap_or(true);
} else {
if static_analysis_enabled {
// if there is no config file, we take the default rules from our APIs.
if rules_file.is_none() {
println!("WARNING: no configuration file detected, getting the default rules from the Datadog API");
println!("Check the following resources to configure your rules:");
println!(
} else if static_analysis_enabled {
// if there is no config file, we take the default rules from our APIs.
if rules_file.is_none() {
println!("WARNING: no configuration file detected, getting the default rules from the Datadog API");
println!("Check the following resources to configure your rules:");
println!(
" - Datadog documentation: https://docs.datadoghq.com/code_analysis/static_analysis"
);
println!(" - Static analyzer repository on GitHub: https://github.com/DataDog/datadog-static-analyzer");
let rulesets_from_api = get_all_default_rulesets(use_staging, use_debug)
.expect("cannot get default rules");
println!(" - Static analyzer repository on GitHub: https://github.com/DataDog/datadog-static-analyzer");
let rulesets_from_api =
get_all_default_rulesets(use_staging, use_debug).expect("cannot get default rules");

rules.extend(rulesets_from_api.into_iter().flat_map(|v| v.rules.clone()));
} else {
let rulesets_from_file =
get_rulesets_from_file(rules_file.clone().unwrap().as_str());
rules.extend(
rulesets_from_file
.context("cannot read ruleset from file")?
.into_iter()
.flat_map(|v| v.rules),
);
}
rules.extend(rulesets_from_api.into_iter().flat_map(|v| v.rules.clone()));
} else {
let rulesets_from_file = get_rulesets_from_file(rules_file.clone().unwrap().as_str());
rules.extend(
rulesets_from_file
.context("cannot read ruleset from file")?
.into_iter()
.flat_map(|v| v.rules),
);
}
}

Expand Down

0 comments on commit 05da1bb

Please sign in to comment.