1
1
use crate :: { process_foundry, process_hardhat, virtual_foundry} ;
2
2
use aderyn_core:: {
3
3
context:: workspace_context:: WorkspaceContext ,
4
- detect:: detector:: IssueDetector ,
4
+ detect:: detector:: { get_all_issue_detectors , IssueDetector } ,
5
5
fscloc,
6
6
report:: { json_printer:: JsonPrinter , markdown_printer:: MarkdownReportPrinter } ,
7
- run_with_printer , run_with_printer_and_given_detectors ,
7
+ run ,
8
8
} ;
9
9
use std:: { fs:: read_dir, path:: PathBuf } ;
10
10
@@ -26,44 +26,7 @@ enum Framework {
26
26
}
27
27
28
28
pub fn drive ( args : Args ) {
29
- let output = args. output . clone ( ) ;
30
- let cx_wrapper = make_context ( & args) ;
31
- let root_rel_path = PathBuf :: from ( & args. root ) ;
32
- let context = & cx_wrapper. context ;
33
-
34
- if args. output . ends_with ( ".json" ) {
35
- // Load the workspace context into the run function, which runs the detectors
36
- run_with_printer (
37
- context,
38
- output,
39
- JsonPrinter ,
40
- root_rel_path,
41
- args. no_snippets ,
42
- args. stdout ,
43
- )
44
- . unwrap_or_else ( |err| {
45
- // Exit with a non-zero exit code
46
- eprintln ! ( "Error running aderyn" ) ;
47
- eprintln ! ( "{:?}" , err) ;
48
- std:: process:: exit ( 1 ) ;
49
- } ) ;
50
- } else {
51
- // Load the workspace context into the run function, which runs the detectors
52
- run_with_printer (
53
- context,
54
- output,
55
- MarkdownReportPrinter ,
56
- root_rel_path,
57
- args. no_snippets ,
58
- args. stdout ,
59
- )
60
- . unwrap_or_else ( |err| {
61
- // Exit with a non-zero exit code
62
- eprintln ! ( "Error running aderyn" ) ;
63
- eprintln ! ( "{:?}" , err) ;
64
- std:: process:: exit ( 1 ) ;
65
- } ) ;
66
- }
29
+ drive_with ( args, get_all_issue_detectors ( ) ) ;
67
30
}
68
31
69
32
pub fn drive_with ( args : Args , detectors : Vec < Box < dyn IssueDetector > > ) {
@@ -74,7 +37,7 @@ pub fn drive_with(args: Args, detectors: Vec<Box<dyn IssueDetector>>) {
74
37
75
38
if args. output . ends_with ( ".json" ) {
76
39
// Load the workspace context into the run function, which runs the detectors
77
- run_with_printer_and_given_detectors (
40
+ run (
78
41
context,
79
42
output,
80
43
JsonPrinter ,
@@ -91,7 +54,7 @@ pub fn drive_with(args: Args, detectors: Vec<Box<dyn IssueDetector>>) {
91
54
} ) ;
92
55
} else {
93
56
// Load the workspace context into the run function, which runs the detectors
94
- run_with_printer_and_given_detectors (
57
+ run (
95
58
context,
96
59
output,
97
60
MarkdownReportPrinter ,
0 commit comments