33use std:: path:: PathBuf ;
44use std:: process:: Stdio ;
55
6+ use aksh_gha_parser:: { expand_jobs, parse_workflow} ;
67use anyhow:: { bail, Context } ;
78use clap:: { Parser , Subcommand } ;
8- use aksh_gha_parser:: { expand_jobs, parse_workflow} ;
99use tokio:: process:: Command ;
1010use walkdir:: WalkDir ;
1111
@@ -153,11 +153,7 @@ fn looks_like_workflow(text: &str) -> bool {
153153 } )
154154}
155155
156- async fn compare_command (
157- upstream : String ,
158- aksh : String ,
159- args : Vec < String > ,
160- ) -> anyhow:: Result < ( ) > {
156+ async fn compare_command ( upstream : String , aksh : String , args : Vec < String > ) -> anyhow:: Result < ( ) > {
161157 let upstream_output = Command :: new ( & upstream)
162158 . args ( & args)
163159 . stdout ( Stdio :: piped ( ) )
@@ -202,7 +198,12 @@ async fn golden_compare(fixtures: PathBuf) -> anyhow::Result<()> {
202198 for entry in WalkDir :: new ( & fixtures)
203199 . into_iter ( )
204200 . filter_map ( Result :: ok)
205- . filter ( |e| e. file_type ( ) . is_file ( ) && e. path ( ) . extension ( ) . is_some_and ( |ext| ext == "yml" || ext == "yaml" ) )
201+ . filter ( |e| {
202+ e. file_type ( ) . is_file ( )
203+ && e. path ( )
204+ . extension ( )
205+ . is_some_and ( |ext| ext == "yml" || ext == "yaml" )
206+ } )
206207 {
207208 let yaml_path = entry. path ( ) ;
208209 let json_path = yaml_path. with_extension ( "json" ) ;
@@ -284,7 +285,10 @@ async fn replay_wire(fixtures: PathBuf) -> anyhow::Result<()> {
284285 eprintln ! ( ) ;
285286 eprintln ! ( "To replay wire traffic:" ) ;
286287 eprintln ! ( " 1. Record traffic with 'aksh-conformance record'" ) ;
287- eprintln ! ( " 2. Run 'aksh-conformance replay --fixtures {}'" , fixtures. display( ) ) ;
288+ eprintln ! (
289+ " 2. Run 'aksh-conformance replay --fixtures {}'" ,
290+ fixtures. display( )
291+ ) ;
288292 eprintln ! ( " 3. Each captured request/response is validated against our DTOs" ) ;
289293 Ok ( ( ) )
290294}
@@ -310,9 +314,8 @@ fn fuzz_parser(iterations: usize) -> anyhow::Result<()> {
310314 let yaml = generate_random_yaml ( hash) ;
311315
312316 // Parse should never panic
313- let result = std:: panic:: catch_unwind ( std:: panic:: AssertUnwindSafe ( || {
314- parse_workflow ( & yaml)
315- } ) ) ;
317+ let result =
318+ std:: panic:: catch_unwind ( std:: panic:: AssertUnwindSafe ( || parse_workflow ( & yaml) ) ) ;
316319
317320 match result {
318321 Ok ( _) => passed += 1 ,
@@ -334,7 +337,9 @@ fn fuzz_parser(iterations: usize) -> anyhow::Result<()> {
334337fn generate_random_yaml ( seed : u64 ) -> String {
335338 let mut s = seed;
336339 let mut next = || -> u64 {
337- s = s. wrapping_mul ( 6364136223846793005 ) . wrapping_add ( 1442695040888963407 ) ;
340+ s = s
341+ . wrapping_mul ( 6364136223846793005 )
342+ . wrapping_add ( 1442695040888963407 ) ;
338343 s
339344 } ;
340345
@@ -352,7 +357,8 @@ fn generate_random_yaml(seed: u64) -> String {
352357 } ;
353358 let step_count = ( next ( ) % 5 ) + 1 ;
354359
355- let mut yaml = format ! ( "name: {name}\n on: {event}\n jobs:\n build:\n runs-on: [{label}]\n steps:\n " ) ;
360+ let mut yaml =
361+ format ! ( "name: {name}\n on: {event}\n jobs:\n build:\n runs-on: [{label}]\n steps:\n " ) ;
356362 for _ in 0 ..step_count {
357363 let cmd = match next ( ) % 3 {
358364 0 => "echo hello" ,
0 commit comments