Skip to content

Commit

Permalink
appease rustfmt
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Crossley <[email protected]>
  • Loading branch information
jcrossley3 committed Mar 5, 2024
1 parent 02e9b5e commit 5c3fd1c
Show file tree
Hide file tree
Showing 22 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion backend/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion backend/api/src/system/advisory/advisory_vulnerability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion backend/api/src/system/advisory/csaf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
2 changes: 1 addition & 1 deletion backend/api/src/system/advisory/fixed_package_version.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions backend/api/src/system/advisory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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> {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions backend/api/src/system/cpe22.rs
Original file line number Diff line number Diff line change
@@ -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<C: Into<Cpe22>>(
Expand Down
2 changes: 1 addition & 1 deletion backend/api/src/system/error.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions backend/api/src/system/package/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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> {
Expand Down
6 changes: 3 additions & 3 deletions backend/api/src/system/package/package_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ 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,
};
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)]
Expand Down
2 changes: 1 addition & 1 deletion backend/api/src/system/package/package_version_range.rs
Original file line number Diff line number Diff line change
@@ -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(
Expand Down
6 changes: 3 additions & 3 deletions backend/api/src/system/package/qualified_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions backend/api/src/system/sbom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions backend/api/src/system/sbom/spdx.rs
Original file line number Diff line number Diff line change
@@ -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<R: Read>(&self, sbom_data: R) -> Result<(), anyhow::Error> {
Expand Down Expand Up @@ -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> {
Expand Down
6 changes: 3 additions & 3 deletions backend/api/src/system/vulnerability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions backend/importer/src/csaf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ 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;
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;
Expand Down
4 changes: 2 additions & 2 deletions backend/importer/src/sbom/mod.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down
2 changes: 1 addition & 1 deletion backend/importer/src/sbom/process.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use async_trait::async_trait;
use trustify_api::{db::Transactional, system::InnerSystem};
use sbom_walker::{
retrieve::RetrievedSbom,
validation::{ValidatedSbom, ValidatedVisitor, ValidationContext, ValidationError},
Sbom,
};
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 {
Expand Down
6 changes: 3 additions & 3 deletions backend/server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<Arc<InnerSystem>, anyhow::Error> {
InnerSystem::bootstrap("postgres", "eggs", "localhost", None, name)
Expand Down
2 changes: 1 addition & 1 deletion backend/server/src/server/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion backend/server/src/server/read/package.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down

0 comments on commit 5c3fd1c

Please sign in to comment.