From 5c3fd1cb1bc4c86cf54404f0851a7e03e30ab79b Mon Sep 17 00:00:00 2001 From: Jim Crossley Date: Tue, 5 Mar 2024 13:06:29 -0500 Subject: [PATCH] appease rustfmt Signed-off-by: Jim Crossley --- backend/api/src/lib.rs | 2 +- .../src/system/advisory/advisory_vulnerability.rs | 2 +- .../advisory/affected_package_version_range.rs | 2 +- backend/api/src/system/advisory/csaf/mod.rs | 2 +- .../api/src/system/advisory/fixed_package_version.rs | 2 +- backend/api/src/system/advisory/mod.rs | 8 ++++---- .../system/advisory/not_affected_package_version.rs | 2 +- backend/api/src/system/cpe22.rs | 6 +++--- backend/api/src/system/error.rs | 2 +- backend/api/src/system/package/mod.rs | 8 ++++---- backend/api/src/system/package/package_version.rs | 6 +++--- .../api/src/system/package/package_version_range.rs | 2 +- backend/api/src/system/package/qualified_package.rs | 6 +++--- backend/api/src/system/sbom/mod.rs | 12 ++++++------ backend/api/src/system/sbom/spdx.rs | 4 ++-- backend/api/src/system/vulnerability.rs | 6 +++--- backend/importer/src/csaf/mod.rs | 8 ++++---- backend/importer/src/sbom/mod.rs | 4 ++-- backend/importer/src/sbom/process.rs | 2 +- backend/server/src/lib.rs | 6 +++--- backend/server/src/server/mod.rs | 2 +- backend/server/src/server/read/package.rs | 2 +- 22 files changed, 48 insertions(+), 48 deletions(-) diff --git a/backend/api/src/lib.rs b/backend/api/src/lib.rs index ef397d94d..830f131d8 100644 --- a/backend/api/src/lib.rs +++ b/backend/api/src/lib.rs @@ -6,8 +6,8 @@ use std::fmt::{Debug, Display, Formatter}; use std::hash::{Hash, Hasher}; use std::str::FromStr; -use trustify_common::purl::Purl; use packageurl::PackageUrl; +use trustify_common::purl::Purl; pub mod system; diff --git a/backend/api/src/system/advisory/advisory_vulnerability.rs b/backend/api/src/system/advisory/advisory_vulnerability.rs index bbb0bd36f..ff843f9a6 100644 --- a/backend/api/src/system/advisory/advisory_vulnerability.rs +++ b/backend/api/src/system/advisory/advisory_vulnerability.rs @@ -4,9 +4,9 @@ use crate::system::advisory::fixed_package_version::FixedPackageVersionContext; use crate::system::advisory::not_affected_package_version::NotAffectedPackageVersionContext; use crate::system::advisory::AdvisoryContext; use crate::system::error::Error; +use sea_orm::{ActiveModelTrait, ColumnTrait, EntityTrait, QueryFilter, Set}; use trustify_common::purl::Purl; use trustify_entity as entity; -use sea_orm::{ActiveModelTrait, ColumnTrait, EntityTrait, QueryFilter, Set}; #[derive(Clone, Debug)] pub struct AdvisoryVulnerabilityContext { diff --git a/backend/api/src/system/advisory/affected_package_version_range.rs b/backend/api/src/system/advisory/affected_package_version_range.rs index af9716a15..428ebabf7 100644 --- a/backend/api/src/system/advisory/affected_package_version_range.rs +++ b/backend/api/src/system/advisory/affected_package_version_range.rs @@ -1,8 +1,8 @@ use crate::system::advisory::advisory_vulnerability::AdvisoryVulnerabilityContext; use crate::system::advisory::AdvisoryContext; +use std::fmt::{Debug, Formatter}; use trustify_entity::affected_package_version_range; use trustify_entity::affected_package_version_range::Model; -use std::fmt::{Debug, Formatter}; #[derive(Clone)] pub struct AffectedPackageVersionRangeContext { diff --git a/backend/api/src/system/advisory/csaf/mod.rs b/backend/api/src/system/advisory/csaf/mod.rs index c67a50325..d1401f47e 100644 --- a/backend/api/src/system/advisory/csaf/mod.rs +++ b/backend/api/src/system/advisory/csaf/mod.rs @@ -5,8 +5,8 @@ use crate::system::advisory::csaf::util::resolve_purls; use crate::system::advisory::AdvisoryContext; use crate::system::error::Error; use csaf::{document::Category, Csaf}; -use trustify_common::purl::Purl; use sea_orm::TransactionTrait; +use trustify_common::purl::Purl; impl AdvisoryContext { pub async fn ingest_csaf(&self, csaf: Csaf) -> Result<(), anyhow::Error> { diff --git a/backend/api/src/system/advisory/fixed_package_version.rs b/backend/api/src/system/advisory/fixed_package_version.rs index 1e532590e..76f44fc11 100644 --- a/backend/api/src/system/advisory/fixed_package_version.rs +++ b/backend/api/src/system/advisory/fixed_package_version.rs @@ -1,7 +1,7 @@ use crate::system::advisory::advisory_vulnerability::AdvisoryVulnerabilityContext; use crate::system::advisory::AdvisoryContext; -use trustify_entity::fixed_package_version; use std::fmt::{Debug, Formatter}; +use trustify_entity::fixed_package_version; #[derive(Clone)] pub struct FixedPackageVersionContext { diff --git a/backend/api/src/system/advisory/mod.rs b/backend/api/src/system/advisory/mod.rs index b80aa8b6c..e8345410a 100644 --- a/backend/api/src/system/advisory/mod.rs +++ b/backend/api/src/system/advisory/mod.rs @@ -6,9 +6,6 @@ use crate::system::error::Error; use crate::system::InnerSystem; use affected_package_version_range::AffectedPackageVersionRangeContext; use fixed_package_version::FixedPackageVersionContext; -use trustify_common::advisory::{AdvisoryVulnerabilityAssertions, Assertion}; -use trustify_common::purl::Purl; -use trustify_entity as entity; use migration::m0000032_create_advisory_vulnerability::AdvisoryVulnerability; use not_affected_package_version::NotAffectedPackageVersionContext; use sea_orm::ActiveValue::Set; @@ -17,6 +14,9 @@ use sea_orm::{ColumnTrait, QuerySelect, RelationTrait}; use sea_query::{Condition, JoinType}; use std::collections::HashMap; use std::fmt::{Debug, Formatter}; +use trustify_common::advisory::{AdvisoryVulnerabilityAssertions, Assertion}; +use trustify_common::purl::Purl; +use trustify_entity as entity; pub mod advisory_vulnerability; @@ -418,8 +418,8 @@ impl AdvisoryContext { mod test { use crate::db::Transactional; use crate::system::InnerSystem; - use trustify_common::advisory::Assertion; use std::collections::HashSet; + use trustify_common::advisory::Assertion; #[tokio::test] async fn ingest_advisories() -> Result<(), anyhow::Error> { diff --git a/backend/api/src/system/advisory/not_affected_package_version.rs b/backend/api/src/system/advisory/not_affected_package_version.rs index 3b81ea456..6d550e4af 100644 --- a/backend/api/src/system/advisory/not_affected_package_version.rs +++ b/backend/api/src/system/advisory/not_affected_package_version.rs @@ -1,7 +1,7 @@ use crate::system::advisory::advisory_vulnerability::AdvisoryVulnerabilityContext; use crate::system::advisory::AdvisoryContext; -use trustify_entity::not_affected_package_version; use std::fmt::{Debug, Formatter}; +use trustify_entity::not_affected_package_version; #[derive(Clone)] pub struct NotAffectedPackageVersionContext { diff --git a/backend/api/src/system/cpe22.rs b/backend/api/src/system/cpe22.rs index 8a7bfa84e..c5334851b 100644 --- a/backend/api/src/system/cpe22.rs +++ b/backend/api/src/system/cpe22.rs @@ -1,12 +1,12 @@ use crate::db::Transactional; use crate::system::error::Error; use crate::system::InnerSystem; -use trustify_common::cpe22::Component::Value; -use trustify_common::cpe22::{Component, Cpe22, Cpe22Type}; -use trustify_entity as entity; use sea_orm::{ActiveModelTrait, ColumnTrait, EntityTrait, NotSet, QueryFilter, Set}; use sea_query::SelectStatement; use std::fmt::{Debug, Formatter}; +use trustify_common::cpe22::Component::Value; +use trustify_common::cpe22::{Component, Cpe22, Cpe22Type}; +use trustify_entity as entity; impl InnerSystem { pub async fn get_cpe22>( diff --git a/backend/api/src/system/error.rs b/backend/api/src/system/error.rs index bee82c808..370cc3e98 100644 --- a/backend/api/src/system/error.rs +++ b/backend/api/src/system/error.rs @@ -1,5 +1,5 @@ -use trustify_common::purl::PurlErr; use sea_orm::DbErr; +use trustify_common::purl::PurlErr; #[derive(Debug, thiserror::Error)] pub enum Error { diff --git a/backend/api/src/system/package/mod.rs b/backend/api/src/system/package/mod.rs index 418336a88..51cf5f536 100644 --- a/backend/api/src/system/package/mod.rs +++ b/backend/api/src/system/package/mod.rs @@ -1,8 +1,5 @@ //! Support for packages. -use trustify_common::package::{Assertion, Claimant, PackageVulnerabilityAssertions}; -use trustify_common::purl::{Purl, PurlErr}; -use trustify_entity as entity; use package_version::PackageVersionContext; use package_version_range::PackageVersionRangeContext; use qualified_package::QualifiedPackageContext; @@ -13,6 +10,9 @@ use sea_orm::{ use sea_orm::{RelationTrait, TransactionTrait}; use sea_query::{JoinType, SelectStatement, UnionType}; use std::fmt::{Debug, Formatter}; +use trustify_common::package::{Assertion, Claimant, PackageVulnerabilityAssertions}; +use trustify_common::purl::{Purl, PurlErr}; +use trustify_entity as entity; use crate::db::{Paginated, PaginatedResults, Transactional}; use crate::system::advisory::AdvisoryContext; @@ -640,8 +640,8 @@ mod tests { use crate::db::{Paginated, Transactional}; use crate::system::error::Error; use crate::system::InnerSystem; - use trustify_common::purl::Purl; use sea_orm::{TransactionError, TransactionTrait}; + use trustify_common::purl::Purl; #[tokio::test] async fn ingest_packages() -> Result<(), anyhow::Error> { diff --git a/backend/api/src/system/package/package_version.rs b/backend/api/src/system/package/package_version.rs index 7f2214b48..5d829e7f3 100644 --- a/backend/api/src/system/package/package_version.rs +++ b/backend/api/src/system/package/package_version.rs @@ -4,9 +4,6 @@ use crate::db::Transactional; use crate::system::error::Error; use crate::system::package::qualified_package::QualifiedPackageContext; use crate::system::package::PackageContext; -use trustify_common::package::{Assertion, Claimant, PackageVulnerabilityAssertions}; -use trustify_common::purl::Purl; -use trustify_entity as entity; use sea_orm::{ ActiveModelTrait, ColumnTrait, EntityTrait, FromQueryResult, PaginatorTrait, QueryFilter, QuerySelect, RelationTrait, Set, @@ -14,6 +11,9 @@ use sea_orm::{ use sea_query::JoinType; use std::collections::HashMap; use std::fmt::{Debug, Formatter}; +use trustify_common::package::{Assertion, Claimant, PackageVulnerabilityAssertions}; +use trustify_common::purl::Purl; +use trustify_entity as entity; /// Live context for a package version. #[derive(Clone)] diff --git a/backend/api/src/system/package/package_version_range.rs b/backend/api/src/system/package/package_version_range.rs index 8e8baaf43..e62cda7e8 100644 --- a/backend/api/src/system/package/package_version_range.rs +++ b/backend/api/src/system/package/package_version_range.rs @@ -1,8 +1,8 @@ //! Support for a *version range* of a package. use crate::system::package::PackageContext; -use trustify_entity as entity; use std::fmt::{Debug, Formatter}; +use trustify_entity as entity; impl From<(&PackageContext, entity::package_version_range::Model)> for PackageVersionRangeContext { fn from( diff --git a/backend/api/src/system/package/qualified_package.rs b/backend/api/src/system/package/qualified_package.rs index a659bbf25..c302e511e 100644 --- a/backend/api/src/system/package/qualified_package.rs +++ b/backend/api/src/system/package/qualified_package.rs @@ -4,14 +4,14 @@ use crate::db::Transactional; use crate::system::error::Error; use crate::system::package::package_version::PackageVersionContext; use crate::system::sbom::SbomContext; -use trustify_common::package::{Assertion, PackageVulnerabilityAssertions}; -use trustify_common::purl::Purl; -use trustify_entity as entity; use sea_orm::{ColumnTrait, EntityTrait, QueryFilter, QuerySelect, RelationTrait}; use sea_query::JoinType; use std::collections::HashMap; use std::fmt::{Debug, Formatter}; use std::hash::{Hash, Hasher}; +use trustify_common::package::{Assertion, PackageVulnerabilityAssertions}; +use trustify_common::purl::Purl; +use trustify_entity as entity; #[derive(Clone)] pub struct QualifiedPackageContext { diff --git a/backend/api/src/system/sbom/mod.rs b/backend/api/src/system/sbom/mod.rs index aa86ac0f2..ac3d73c0a 100644 --- a/backend/api/src/system/sbom/mod.rs +++ b/backend/api/src/system/sbom/mod.rs @@ -6,12 +6,6 @@ use crate::system::package::package_version::PackageVersionContext; use crate::system::package::qualified_package::QualifiedPackageContext; use crate::system::package::PackageContext; use crate::system::InnerSystem; -use trustify_common::cpe22::Cpe22; -use trustify_common::package::PackageVulnerabilityAssertions; -use trustify_common::purl::Purl; -use trustify_common::sbom::SbomLocator; -use trustify_entity as entity; -use trustify_entity::relationship::Relationship; use sea_orm::{ ActiveModelTrait, ColumnTrait, ConnectionTrait, DbErr, EntityTrait, FromQueryResult, ModelTrait, QueryFilter, QueryResult, QuerySelect, QueryTrait, RelationTrait, Select, Set, @@ -25,6 +19,12 @@ use std::collections::hash_set::Union; use std::collections::{HashMap, HashSet}; use std::fmt::{Debug, Formatter}; use std::ops::Deref; +use trustify_common::cpe22::Cpe22; +use trustify_common::package::PackageVulnerabilityAssertions; +use trustify_common::purl::Purl; +use trustify_common::sbom::SbomLocator; +use trustify_entity as entity; +use trustify_entity::relationship::Relationship; use super::error::Error; diff --git a/backend/api/src/system/sbom/spdx.rs b/backend/api/src/system/sbom/spdx.rs index ee7ebbdcf..490591292 100644 --- a/backend/api/src/system/sbom/spdx.rs +++ b/backend/api/src/system/sbom/spdx.rs @@ -1,11 +1,11 @@ use crate::db::Transactional; use crate::system::error::Error; use crate::system::sbom::SbomContext; -use trustify_entity::relationship::Relationship; use sea_orm::TransactionTrait; use serde_json::Value; use spdx_rs::models::{RelationshipType, SPDX}; use std::io::{Read, Seek}; +use trustify_entity::relationship::Relationship; impl SbomContext { pub async fn ingest_spdx_data(&self, sbom_data: R) -> Result<(), anyhow::Error> { @@ -172,12 +172,12 @@ fn fix_license(mut json: Value) -> (Value, bool) { mod tests { use crate::db::Transactional; use crate::system::InnerSystem; - use trustify_entity::relationship::Relationship; use spdx_rs::models::SPDX; use std::fs::File; use std::path::PathBuf; use std::str::FromStr; use std::time::Instant; + use trustify_entity::relationship::Relationship; #[tokio::test] async fn parse_spdx_quarkus() -> Result<(), anyhow::Error> { diff --git a/backend/api/src/system/vulnerability.rs b/backend/api/src/system/vulnerability.rs index 6aba54eda..acd741623 100644 --- a/backend/api/src/system/vulnerability.rs +++ b/backend/api/src/system/vulnerability.rs @@ -4,15 +4,15 @@ use crate::db::Transactional; use crate::system::advisory::AdvisoryContext; use crate::system::error::Error; use crate::system::InnerSystem; -use trustify_common::package::PackageVulnerabilityAssertions; -use trustify_entity::vulnerability::Model; -use trustify_entity::{advisory, advisory_vulnerability, vulnerability}; use sea_orm::ActiveValue::Set; use sea_orm::{ ActiveModelTrait, ColumnTrait, EntityTrait, QueryFilter, QuerySelect, RelationTrait, }; use sea_query::JoinType; use std::fmt::{Debug, Formatter}; +use trustify_common::package::PackageVulnerabilityAssertions; +use trustify_entity::vulnerability::Model; +use trustify_entity::{advisory, advisory_vulnerability, vulnerability}; impl InnerSystem { pub async fn ingest_vulnerability( diff --git a/backend/importer/src/csaf/mod.rs b/backend/importer/src/csaf/mod.rs index 4c6a315a7..05de6da0a 100644 --- a/backend/importer/src/csaf/mod.rs +++ b/backend/importer/src/csaf/mod.rs @@ -5,10 +5,6 @@ use csaf_walker::retrieve::RetrievingVisitor; use csaf_walker::source::{DispatchSource, FileSource, HttpSource}; use csaf_walker::validation::{ValidatedAdvisory, ValidationError, ValidationVisitor}; use csaf_walker::walker::Walker; -use trustify_api::db::Transactional; -use trustify_api::system::InnerSystem; -use trustify_common::config::Database; -use trustify_common::purl::Purl; use packageurl::PackageUrl; use process::trace_product; use sha2::digest::Output; @@ -16,6 +12,10 @@ use sha2::{Digest, Sha256}; use std::process::ExitCode; use std::time::SystemTime; use time::{Date, Month, UtcOffset}; +use trustify_api::db::Transactional; +use trustify_api::system::InnerSystem; +use trustify_common::config::Database; +use trustify_common::purl::Purl; use url::Url; use walker_common::fetcher::Fetcher; use walker_common::utils::hex::Hex; diff --git a/backend/importer/src/sbom/mod.rs b/backend/importer/src/sbom/mod.rs index 5a8a68259..3a218c6f5 100644 --- a/backend/importer/src/sbom/mod.rs +++ b/backend/importer/src/sbom/mod.rs @@ -1,13 +1,13 @@ use std::process::ExitCode; -use trustify_api::system::InnerSystem; -use trustify_common::config::Database; use sbom_walker::{ retrieve::RetrievingVisitor, source::{DispatchSource, FileSource, HttpSource}, validation::ValidationVisitor, walker::Walker, }; +use trustify_api::system::InnerSystem; +use trustify_common::config::Database; use url::Url; use walker_common::{fetcher::Fetcher, validate::ValidationOptions}; diff --git a/backend/importer/src/sbom/process.rs b/backend/importer/src/sbom/process.rs index 4b970ca64..23fb5db21 100644 --- a/backend/importer/src/sbom/process.rs +++ b/backend/importer/src/sbom/process.rs @@ -1,5 +1,4 @@ use async_trait::async_trait; -use trustify_api::{db::Transactional, system::InnerSystem}; use sbom_walker::{ retrieve::RetrievedSbom, validation::{ValidatedSbom, ValidatedVisitor, ValidationContext, ValidationError}, @@ -7,6 +6,7 @@ use sbom_walker::{ }; use sha2::digest::Output; use sha2::{Digest, Sha256}; +use trustify_api::{db::Transactional, system::InnerSystem}; use walker_common::{compression::decompress_opt, utils::hex::Hex}; pub struct ProcessVisitor { diff --git a/backend/server/src/lib.rs b/backend/server/src/lib.rs index 0f1e0f551..089b4647a 100644 --- a/backend/server/src/lib.rs +++ b/backend/server/src/lib.rs @@ -4,10 +4,10 @@ use crate::server::read; use crate::server::Error::System; use actix_web::middleware::Logger; use actix_web::{web, App, HttpServer}; -use trustify_api::system::InnerSystem; -use trustify_common::config::Database; use std::process::ExitCode; use std::sync::Arc; +use trustify_api::system::InnerSystem; +use trustify_common::config::Database; pub mod server; @@ -70,8 +70,8 @@ pub fn configure(config: &mut web::ServiceConfig) { #[cfg(test)] mod test_util { - use trustify_api::system::InnerSystem; use std::sync::Arc; + use trustify_api::system::InnerSystem; pub async fn bootstrap_system(name: &str) -> Result, anyhow::Error> { InnerSystem::bootstrap("postgres", "eggs", "localhost", None, name) diff --git a/backend/server/src/server/mod.rs b/backend/server/src/server/mod.rs index 353dfabbb..78cfe9232 100644 --- a/backend/server/src/server/mod.rs +++ b/backend/server/src/server/mod.rs @@ -1,8 +1,8 @@ use actix_web::body::BoxBody; use actix_web::{HttpResponse, ResponseError}; -use trustify_api::system; use std::borrow::Cow; use std::fmt::{Debug, Display}; +use trustify_api::system; pub mod read; pub mod write; diff --git a/backend/server/src/server/read/package.rs b/backend/server/src/server/read/package.rs index f3c0901ba..4bb332e96 100644 --- a/backend/server/src/server/read/package.rs +++ b/backend/server/src/server/read/package.rs @@ -1,7 +1,7 @@ use actix_web::{get, web, HttpResponse, Responder}; -use trustify_api::db::Transactional; use serde::{Deserialize, Serialize}; use std::str::FromStr; +use trustify_api::db::Transactional; use trustify_common::purl::Purl;