@@ -57,22 +57,26 @@ impl KrateSource {
57
57
Krate {
58
58
version : self . version . clone ( ) ,
59
59
name : self . name . clone ( ) ,
60
- path : extract_dir. join ( format ! ( "{}-{}/" , self . name, self . version) )
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 , cargo_clippy_path : & PathBuf ) -> String {
66
+ fn run_clippy_lints ( & self , cargo_clippy_path : & PathBuf ) -> String {
67
67
let cargo_clippy_path = std:: fs:: canonicalize ( cargo_clippy_path) . unwrap ( ) ;
68
68
let project_root = & self . path ;
69
69
dbg ! ( & cargo_clippy_path) ;
70
70
dbg ! ( & project_root) ;
71
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) ;
72
+ let output = std:: process:: Command :: new ( cargo_clippy_path)
73
+ . args ( & [ "--" , "--message-format=short" , "--" , "--cap-lints=warn" , ] )
74
+ . current_dir ( project_root)
75
+ . output ( ) ;
76
+ let output: String = String :: from_utf8_lossy ( & output. unwrap ( ) . stderr ) . lines ( ) . filter ( |line|line. contains ( ": warning: " ) ) . collect ( ) ;
77
+ // output.lines().for_each(|l| println!("{}", l));
78
+ //dbg!(&output);
79
+
76
80
output
77
81
}
78
82
}
@@ -90,7 +94,7 @@ pub fn run() {
90
94
let clippy_driver_path: PathBuf = PathBuf :: from ( "target/debug/clippy-driver" ) ;
91
95
92
96
// crates we want to check:
93
- let krates: Vec < KrateSource > = vec ! [ KrateSource :: new( "regex" , "1.4.2" ) , KrateSource :: new( "cargo" , "0.49.0" ) , ] ;
97
+ let krates: Vec < KrateSource > = vec ! [ KrateSource :: new( "regex" , "1.4.2" ) , KrateSource :: new( "cargo" , "0.49.0" ) ] ;
94
98
95
99
println ! ( "Compiling clippy..." ) ;
96
100
build_clippy ( ) ;
@@ -106,12 +110,13 @@ pub fn run() {
106
110
clippy_driver_path. is_file( ) ,
107
111
"target/debug/clippy-driver binary not found! {}" ,
108
112
clippy_driver_path. display( )
109
- ) ;
113
+ ) ;
110
114
111
115
// download and extract the crates, then run clippy on them and collect clippys warnings
112
- let _clippy_lint_results : Vec < String > = krates
116
+ let clippy_lint_results : Vec < String > = krates
113
117
. into_iter ( )
114
118
. map ( |krate| krate. download_and_extract ( ) )
115
119
. map ( |krate| krate. run_clippy_lints ( & cargo_clippy_path) )
116
120
. collect :: < Vec < String > > ( ) ;
121
+ dbg ! ( clippy_lint_results) ;
117
122
}
0 commit comments