@@ -50,21 +50,30 @@ impl KrateSource {
50
50
let ungz_tar = flate2:: read:: GzDecoder :: new ( dl) ;
51
51
// extract the tar archive
52
52
let mut archiv = tar:: Archive :: new ( ungz_tar) ;
53
- let extract_path = extract_dir. join ( format ! ( "{}-{}/" , self . name , self . version ) ) ;
53
+ let extract_path = extract_dir. clone ( ) ;
54
54
archiv. unpack ( & extract_path) . expect ( "Failed to extract!" ) ;
55
55
// extracted
56
-
56
+ dbg ! ( & extract_path ) ;
57
57
Krate {
58
58
version : self . version . clone ( ) ,
59
59
name : self . name . clone ( ) ,
60
- path : extract_path ,
60
+ path : extract_dir . join ( format ! ( "{}-{}/" , self . name , self . version ) )
61
61
}
62
62
}
63
63
}
64
64
65
65
impl Krate {
66
- fn run_clippy_lints ( & self ) -> String {
67
- todo ! ( ) ;
66
+ fn run_clippy_lints ( & self , cargo_clippy_path : & PathBuf ) -> String {
67
+ let cargo_clippy_path = std:: fs:: canonicalize ( cargo_clippy_path) . unwrap ( ) ;
68
+ let project_root = & self . path ;
69
+ dbg ! ( & cargo_clippy_path) ;
70
+ dbg ! ( & project_root) ;
71
+
72
+ let output = std:: process:: Command :: new ( cargo_clippy_path) . current_dir ( project_root) . output ( ) ;
73
+ dbg ! ( & output) ;
74
+ let output = String :: from_utf8_lossy ( & output. unwrap ( ) . stderr ) . into_owned ( ) ;
75
+ dbg ! ( & output) ;
76
+ output
68
77
}
69
78
}
70
79
@@ -81,7 +90,7 @@ pub fn run() {
81
90
let clippy_driver_path: PathBuf = PathBuf :: from ( "target/debug/clippy-driver" ) ;
82
91
83
92
// crates we want to check:
84
- let krates: Vec < KrateSource > = vec ! [ KrateSource :: new( "cargo " , "0.49.0 " ) , KrateSource :: new( "regex " , "1.4.2" ) ] ;
93
+ let krates: Vec < KrateSource > = vec ! [ KrateSource :: new( "regex " , "1.4.2 " ) , KrateSource :: new( "cargo " , "0.49.0" ) , ] ;
85
94
86
95
println ! ( "Compiling clippy..." ) ;
87
96
build_clippy ( ) ;
@@ -97,12 +106,12 @@ pub fn run() {
97
106
clippy_driver_path. is_file( ) ,
98
107
"target/debug/clippy-driver binary not found! {}" ,
99
108
clippy_driver_path. display( )
100
- ) ;
109
+ ) ;
101
110
102
111
// download and extract the crates, then run clippy on them and collect clippys warnings
103
112
let _clippy_lint_results: Vec < String > = krates
104
113
. into_iter ( )
105
114
. map ( |krate| krate. download_and_extract ( ) )
106
- . map ( |krate| krate. run_clippy_lints ( ) )
115
+ . map ( |krate| krate. run_clippy_lints ( & cargo_clippy_path ) )
107
116
. collect :: < Vec < String > > ( ) ;
108
117
}
0 commit comments