aboutsummaryrefslogtreecommitdiff
path: root/xtask
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-08 23:11:52 +0100
committerGitHub <[email protected]>2020-07-08 23:11:52 +0100
commita61c8481571f8d8e6e08df9024d8dad5efc883de (patch)
tree0b873401a6c76260c30f34a4de583294aa9cdcc6 /xtask
parent39182dbc733aa85f210f880fe364ea7d7ec47181 (diff)
parentabbb539f973ee4558f6ea7922794887962128987 (diff)
Merge #5273
5273: Refactor hover tests r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'xtask')
-rw-r--r--xtask/tests/tidy.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs
index f99935170..fcfad609d 100644
--- a/xtask/tests/tidy.rs
+++ b/xtask/tests/tidy.rs
@@ -50,18 +50,19 @@ fn rust_files_are_tidy() {
50} 50}
51 51
52fn check_todo(path: &Path, text: &str) { 52fn check_todo(path: &Path, text: &str) {
53 let whitelist = &[ 53 let need_todo = &[
54 // This file itself is whitelisted since this test itself contains matches. 54 // This file itself obviously needs to use todo (<- like this!).
55 "tests/cli.rs", 55 "tests/cli.rs",
56 // Some of our assists generate `todo!()` so those files are whitelisted. 56 // Some of our assists generate `todo!()`.
57 "tests/generated.rs", 57 "tests/generated.rs",
58 "handlers/add_missing_impl_members.rs", 58 "handlers/add_missing_impl_members.rs",
59 "handlers/add_turbo_fish.rs", 59 "handlers/add_turbo_fish.rs",
60 "handlers/generate_function.rs", 60 "handlers/generate_function.rs",
61 // To support generating `todo!()` in assists, we have `expr_todo()` in ast::make. 61 // To support generating `todo!()` in assists, we have `expr_todo()` in
62 // `ast::make`.
62 "ast/make.rs", 63 "ast/make.rs",
63 ]; 64 ];
64 if whitelist.iter().any(|p| path.ends_with(p)) { 65 if need_todo.iter().any(|p| path.ends_with(p)) {
65 return; 66 return;
66 } 67 }
67 if text.contains("TODO") || text.contains("TOOD") || text.contains("todo!") { 68 if text.contains("TODO") || text.contains("TOOD") || text.contains("todo!") {
@@ -139,7 +140,7 @@ impl TidyDocs {
139 ) 140 )
140 } 141 }
141 142
142 let whitelist = [ 143 let poorly_documented = [
143 "ra_hir", 144 "ra_hir",
144 "ra_hir_expand", 145 "ra_hir_expand",
145 "ra_ide", 146 "ra_ide",
@@ -153,9 +154,9 @@ impl TidyDocs {
153 ]; 154 ];
154 155
155 let mut has_fixmes = 156 let mut has_fixmes =
156 whitelist.iter().map(|it| (*it, false)).collect::<HashMap<&str, bool>>(); 157 poorly_documented.iter().map(|it| (*it, false)).collect::<HashMap<&str, bool>>();
157 'outer: for path in self.contains_fixme { 158 'outer: for path in self.contains_fixme {
158 for krate in whitelist.iter() { 159 for krate in poorly_documented.iter() {
159 if path.components().any(|it| it.as_os_str() == *krate) { 160 if path.components().any(|it| it.as_os_str() == *krate) {
160 has_fixmes.insert(krate, true); 161 has_fixmes.insert(krate, true);
161 continue 'outer; 162 continue 'outer;
@@ -166,7 +167,7 @@ impl TidyDocs {
166 167
167 for (krate, has_fixme) in has_fixmes.iter() { 168 for (krate, has_fixme) in has_fixmes.iter() {
168 if !has_fixme { 169 if !has_fixme {
169 panic!("crate {} is fully documented, remove it from the white list", krate) 170 panic!("crate {} is fully documented :tada:, remove it from the list of poorly documented crates", krate)
170 } 171 }
171 } 172 }
172 } 173 }