Skip to content
Snippets Groups Projects
Verified Commit b3bb4170 authored by Geoffrey Arthaud's avatar Geoffrey Arthaud
Browse files

Fix clippy warnings

parent b4ab07aa
No related branches found
No related tags found
1 merge request!1Feat/job token
---
DEBUG: 'true'
TEST_OPTIONS: '--help'
\ No newline at end of file
...@@ -120,11 +120,7 @@ impl ReportJob for ContainerAnalysisJob { ...@@ -120,11 +120,7 @@ impl ReportJob for ContainerAnalysisJob {
gitlab::api::paged(endpoint, Pagination::All).query(&self.gitlab); gitlab::api::paged(endpoint, Pagination::All).query(&self.gitlab);
match query { match query {
Err(e) => self.into_report( Err(e) => self.into_report(
vec![ReportStatus::ERROR(format!( vec![ReportStatus::ERROR(format!("{} {}", fl!("error"), e))],
"{} {}",
fl!("error"),
e.to_string()
))],
vec![], vec![],
), ),
Ok(containers) => { Ok(containers) => {
......
...@@ -99,11 +99,9 @@ impl ReportJob for PackageAnalysisJob { ...@@ -99,11 +99,9 @@ impl ReportJob for PackageAnalysisJob {
let query: Result<Vec<GitlabPackage>, _> = let query: Result<Vec<GitlabPackage>, _> =
gitlab::api::paged(endpoint, Pagination::All).query(&self.gitlab); gitlab::api::paged(endpoint, Pagination::All).query(&self.gitlab);
match query { match query {
Err(e) => self.default_report(ReportStatus::ERROR(format!( Err(e) => {
"{} {}", self.default_report(ReportStatus::ERROR(format!("{} {}", fl!("error"), e)))
fl!("error"), }
e.to_string()
))),
Ok(mut packages) => { Ok(mut packages) => {
packages.sort_by(|a, b| b.created_at.partial_cmp(&a.created_at).unwrap()); packages.sort_by(|a, b| b.created_at.partial_cmp(&a.created_at).unwrap());
let mut savable_bytes = 0; let mut savable_bytes = 0;
......
...@@ -32,7 +32,7 @@ impl Reportable for PipelineAnalysisReport { ...@@ -32,7 +32,7 @@ impl Reportable for PipelineAnalysisReport {
} }
impl PipelineAnalysisJob { impl PipelineAnalysisJob {
fn to_report( fn into_report(
self, self,
report_status: Vec<ReportStatus>, report_status: Vec<ReportStatus>,
pipelines: Vec<GitlabPipeline>, pipelines: Vec<GitlabPipeline>,
...@@ -54,7 +54,7 @@ impl ReportJob for PipelineAnalysisJob { ...@@ -54,7 +54,7 @@ impl ReportJob for PipelineAnalysisJob {
pending_msg: fl!("pipeline-analysing"), pending_msg: fl!("pipeline-analysing"),
job: std::thread::spawn(move || { job: std::thread::spawn(move || {
if !self.project.jobs_enabled { if !self.project.jobs_enabled {
return self.to_report(vec![ReportStatus::NA(fl!("no-cicd"))], vec![]); return self.into_report(vec![ReportStatus::NA(fl!("no-cicd"))], vec![]);
} }
let endpoint = gitlab::api::projects::pipelines::Pipelines::builder() let endpoint = gitlab::api::projects::pipelines::Pipelines::builder()
...@@ -64,19 +64,15 @@ impl ReportJob for PipelineAnalysisJob { ...@@ -64,19 +64,15 @@ impl ReportJob for PipelineAnalysisJob {
let query: Result<Vec<GitlabPipeline>, _> = let query: Result<Vec<GitlabPipeline>, _> =
gitlab::api::paged(endpoint, Pagination::All).query(&self.gitlab); gitlab::api::paged(endpoint, Pagination::All).query(&self.gitlab);
match query { match query {
Err(e) => self.to_report( Err(e) => self.into_report(
vec![ReportStatus::ERROR(format!( vec![ReportStatus::ERROR(format!("{} {}", fl!("error"), e))],
"{} {}",
fl!("error"),
e.to_string()
))],
vec![], vec![],
), ),
Ok(mut pipelines) => { Ok(mut pipelines) => {
let days = self.days; let days = self.days;
let ref_date = Local::now() - Duration::days(days as i64); let ref_date = Local::now() - Duration::days(days as i64);
pipelines.sort_by(|a, b| a.created_at.partial_cmp(&b.created_at).unwrap()); pipelines.sort_by(|a, b| a.created_at.partial_cmp(&b.created_at).unwrap());
self.to_report( self.into_report(
vec![ReportStatus::NA(fl!( vec![ReportStatus::NA(fl!(
"pipeline-report", "pipeline-report",
total_pipelines = pipelines.len(), total_pipelines = pipelines.len(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment