Skip to content

Commit a64f165

Browse files
committed
fix(lint): deep formatting sweep in apps/backend and core
1 parent f512a89 commit a64f165

5 files changed

Lines changed: 39 additions & 44 deletions

File tree

apps/backend/src/app/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
mod rate_limit;
12
mod scan;
23
mod state;
3-
mod rate_limit;
44

55
pub use rate_limit::{RateLimitError, RateLimiter};
66
pub use scan::{ScanError, ScanService};

apps/backend/src/app/scan.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ use std::path::Path;
33
use std::time::Instant;
44
use thiserror::Error;
55
use verifyos_cli::core::engine::Engine;
6-
use verifyos_cli::profiles::{available_rule_ids, normalize_rule_id, register_rules, RuleSelection, ScanProfile};
6+
use verifyos_cli::profiles::{
7+
available_rule_ids, normalize_rule_id, register_rules, RuleSelection, ScanProfile,
8+
};
79
use verifyos_cli::report::{apply_baseline, build_report, BaselineSummary, ReportData};
810

911
#[derive(Debug, Error)]
@@ -45,9 +47,9 @@ impl ScanService {
4547
"scan completed in {duration}ms",
4648
duration = started.elapsed().as_millis()
4749
)],
48-
baseline: outcome
49-
.baseline
50-
.map(|summary| BaselineInfo { suppressed: summary.suppressed }),
50+
baseline: outcome.baseline.map(|summary| BaselineInfo {
51+
suppressed: summary.suppressed,
52+
}),
5153
})
5254
}
5355

@@ -73,11 +75,15 @@ impl ScanService {
7375
}
7476

7577
let bundle_path = bundle_path.as_ref();
76-
let run = engine.run(bundle_path)
78+
let run = engine
79+
.run(bundle_path)
7780
.map_err(|err| ScanError::ScanFailed(err.to_string()))?;
7881

7982
let mut report = build_report(run.results, run.total_duration_ms, run.cache_stats);
80-
let baseline = request.baseline.as_ref().map(|baseline| apply_baseline(&mut report, baseline));
83+
let baseline = request
84+
.baseline
85+
.as_ref()
86+
.map(|baseline| apply_baseline(&mut report, baseline));
8187
Ok(ScanOutcome { report, baseline })
8288
}
8389
}
@@ -120,11 +126,7 @@ fn build_rule_selection(
120126
})
121127
}
122128

123-
124-
125-
fn load_xcode_project(
126-
path: &Path,
127-
) -> Option<verifyos_cli::parsers::xcode_parser::XcodeProject> {
129+
fn load_xcode_project(path: &Path) -> Option<verifyos_cli::parsers::xcode_parser::XcodeProject> {
128130
let extension = path.extension().and_then(|ext| ext.to_str()).unwrap_or("");
129131
if extension.eq_ignore_ascii_case("xcworkspace") {
130132
match verifyos_cli::parsers::xcworkspace_parser::Xcworkspace::from_path(path) {

apps/backend/src/app/state.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ pub struct AppState {
88

99
impl AppState {
1010
pub fn new(scan: ScanService, rate_limit: RateLimiter) -> Self {
11-
Self {
12-
scan,
13-
rate_limit,
14-
}
11+
Self { scan, rate_limit }
1512
}
1613
}

apps/backend/src/infra/http/handlers.rs

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,10 @@ pub async fn scan_bundle(
191191

192192
info!("running scan for uploaded bundle");
193193
let _keep_project_dir_alive = project_dir;
194-
match state.scan.run_scan(request, bundle.path(), project_path.as_deref()) {
194+
match state
195+
.scan
196+
.run_scan(request, bundle.path(), project_path.as_deref())
197+
{
195198
Ok(result) => match format {
196199
ScanOutputFormat::Json => (StatusCode::OK, Json(result)).into_response(),
197200
ScanOutputFormat::Sarif => match render_sarif(&result.report) {
@@ -361,11 +364,10 @@ pub async fn handoff_bundle(
361364

362365
info!("building agent handoff bundle");
363366
let baseline = request.baseline.clone();
364-
let outcome =
365-
match state
366-
.scan
367-
.run_scan_report(request, bundle.path(), project_path.as_deref())
368-
{
367+
let outcome = match state
368+
.scan
369+
.run_scan_report(request, bundle.path(), project_path.as_deref())
370+
{
369371
Ok(outcome) => outcome,
370372
Err(err) => return (StatusCode::BAD_REQUEST, Json(error_body(err))).into_response(),
371373
};
@@ -403,25 +405,19 @@ pub async fn handoff_bundle(
403405
) {
404406
return to_error(err).into_response();
405407
}
406-
if let Err(err) = verifyos_cli::agent_io::write_fix_prompt_file(
407-
&layout.fix_prompt_path,
408-
&pack,
409-
&hints,
410-
) {
408+
if let Err(err) =
409+
verifyos_cli::agent_io::write_fix_prompt_file(&layout.fix_prompt_path, &pack, &hints)
410+
{
411411
return to_error(err).into_response();
412412
}
413-
if let Err(err) = verifyos_cli::agent_io::write_pr_brief_file(
414-
&layout.pr_brief_path,
415-
&pack,
416-
&hints,
417-
) {
413+
if let Err(err) =
414+
verifyos_cli::agent_io::write_pr_brief_file(&layout.pr_brief_path, &pack, &hints)
415+
{
418416
return to_error(err).into_response();
419417
}
420-
if let Err(err) = verifyos_cli::agent_io::write_pr_comment_file(
421-
&layout.pr_comment_path,
422-
&pack,
423-
&hints,
424-
) {
418+
if let Err(err) =
419+
verifyos_cli::agent_io::write_pr_comment_file(&layout.pr_comment_path, &pack, &hints)
420+
{
425421
return to_error(err).into_response();
426422
}
427423
if let Err(err) =
@@ -556,16 +552,16 @@ fn write_repair_plan(
556552
layout: &verifyos_cli::agent_assets::AgentAssetLayout,
557553
hints: &verifyos_cli::agents::CommandHints,
558554
) -> Result<(), Box<dyn std::error::Error>> {
559-
let policy = verifyos_cli::agent_assets::RepairPolicy::new(
560-
std::collections::HashSet::new(),
561-
true,
562-
true,
563-
);
555+
let policy =
556+
verifyos_cli::agent_assets::RepairPolicy::new(std::collections::HashSet::new(), true, true);
564557
let plan = verifyos_cli::agent_assets::build_repair_plan(layout, &policy);
565558
let mut out = String::new();
566559
out.push_str("# verifyOS Repair Plan\n\n## Context\n\n");
567560
if let Some(app_path) = hints.app_path.as_deref() {
568-
out.push_str(&format!("- Source: `fresh-scan`\n- Scan artifact: `{}`\n", app_path));
561+
out.push_str(&format!(
562+
"- Source: `fresh-scan`\n- Scan artifact: `{}`\n",
563+
app_path
564+
));
569565
} else {
570566
out.push_str("- Source: `fresh-scan`\n");
571567
}

apps/backend/src/infra/http/router.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::app::AppState;
2-
use crate::infra::http::handlers::{health, handoff_bundle, scan_bundle};
2+
use crate::infra::http::handlers::{handoff_bundle, health, scan_bundle};
33
use axum::routing::{get, post};
44
use axum::Router;
55
use tower_http::cors::CorsLayer;

0 commit comments

Comments
 (0)