Skip to content

Commit

Permalink
Merge pull request #166 from Achiefs/165-fix-codescan
Browse files Browse the repository at this point in the history
Fix codescan issues
  • Loading branch information
okynos authored Jul 12, 2024
2 parents 51789f2 + 8aafbf7 commit ab29209
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
12 changes: 4 additions & 8 deletions src/appconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,8 @@ impl AppConfig {
// ------------------------------------------------------------------------

pub fn get_labels(&self, index: usize, array: Array) -> Vec<String> {
match array[index]["labels"].clone().into_vec() {
Some(labels) => labels,
None => Vec::new()
}.to_vec().iter().map(|element| String::from(element.as_str().unwrap()) ).collect()
array[index]["labels"].clone().into_vec().unwrap_or_default()
.to_vec().iter().map(|element| String::from(element.as_str().unwrap()) ).collect()
}

// ------------------------------------------------------------------------
Expand Down Expand Up @@ -399,10 +397,8 @@ impl AppConfig {
// ------------------------------------------------------------------------

pub fn get_integrations(&self, index: usize, array: Array) -> Vec<Integration> {
let data = match array[index]["integrations"].clone().into_vec() {
Some(integrations) => integrations,
None => Vec::new()
};
let default = array[index]["integrations"].clone().into_vec();
let data = default.unwrap_or_default();
let mut integrations: Vec<Integration> = Vec::new();
data.iter().for_each(|info|
integrations.push(Integration::new(
Expand Down
6 changes: 3 additions & 3 deletions src/logreader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ pub fn extract_fields(data: Vec<HashMap<String, String>>) -> (SHashMap,

data.iter().for_each(|v| {
match v["type"].as_str() {
"SYSCALL" => syscall = v.clone(),
"SYSCALL" => syscall.clone_from(v),
"PATH" => paths.push(v.clone()),
"CWD" => cwd = v.clone(),
"PROCTITLE" => proctitle = v.clone(),
"CWD" => cwd.clone_from(v),
"PROCTITLE" => proctitle.clone_from(v),
_ => error!("Unidentified Audit field")
}
});
Expand Down

0 comments on commit ab29209

Please sign in to comment.