aboutsummaryrefslogtreecommitdiff
path: root/xtask/tests/tidy.rs
diff options
context:
space:
mode:
Diffstat (limited to 'xtask/tests/tidy.rs')
-rw-r--r--xtask/tests/tidy.rs39
1 files changed, 28 insertions, 11 deletions
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs
index 2096a14a2..3b1408222 100644
--- a/xtask/tests/tidy.rs
+++ b/xtask/tests/tidy.rs
@@ -44,11 +44,26 @@ fn rust_files_are_tidy() {
44 let text = fs2::read_to_string(&path).unwrap(); 44 let text = fs2::read_to_string(&path).unwrap();
45 check_todo(&path, &text); 45 check_todo(&path, &text);
46 check_trailing_ws(&path, &text); 46 check_trailing_ws(&path, &text);
47 deny_clippy(&path, &text);
47 tidy_docs.visit(&path, &text); 48 tidy_docs.visit(&path, &text);
48 } 49 }
49 tidy_docs.finish(); 50 tidy_docs.finish();
50} 51}
51 52
53fn deny_clippy(path: &PathBuf, text: &String) {
54 if text.contains("[\u{61}llow(clippy") {
55 panic!(
56 "\n\nallowing lints is forbidden: {}.
57rust-analyzer intentionally doesn't check clippy on CI.
58You can allow lint globally via `xtask clippy`.
59See https://github.com/rust-lang/rust-clippy/issues/5537 for discussion.
60
61",
62 path.display()
63 )
64 }
65}
66
52#[test] 67#[test]
53fn check_licenses() { 68fn check_licenses() {
54 let expected = " 69 let expected = "
@@ -68,7 +83,7 @@ MIT/Apache-2.0
68MIT/Apache-2.0 AND BSD-2-Clause 83MIT/Apache-2.0 AND BSD-2-Clause
69Unlicense OR MIT 84Unlicense OR MIT
70Unlicense/MIT 85Unlicense/MIT
71Zlib 86Zlib OR Apache-2.0 OR MIT
72" 87"
73 .lines() 88 .lines()
74 .filter(|it| !it.is_empty()) 89 .filter(|it| !it.is_empty())
@@ -98,6 +113,8 @@ fn check_todo(path: &Path, text: &str) {
98 // To support generating `todo!()` in assists, we have `expr_todo()` in 113 // To support generating `todo!()` in assists, we have `expr_todo()` in
99 // `ast::make`. 114 // `ast::make`.
100 "ast/make.rs", 115 "ast/make.rs",
116 // The documentation in string literals may contain anything for its own purposes
117 "completion/generated_features.rs",
101 ]; 118 ];
102 if need_todo.iter().any(|p| path.ends_with(p)) { 119 if need_todo.iter().any(|p| path.ends_with(p)) {
103 return; 120 return;
@@ -178,16 +195,16 @@ impl TidyDocs {
178 } 195 }
179 196
180 let poorly_documented = [ 197 let poorly_documented = [
181 "ra_hir", 198 "hir",
182 "ra_hir_expand", 199 "hir_expand",
183 "ra_ide", 200 "ide",
184 "ra_mbe", 201 "mbe",
185 "ra_parser", 202 "parser",
186 "ra_prof", 203 "profile",
187 "ra_project_model", 204 "project_model",
188 "ra_syntax", 205 "syntax",
189 "ra_tt", 206 "tt",
190 "ra_hir_ty", 207 "hir_ty",
191 ]; 208 ];
192 209
193 let mut has_fixmes = 210 let mut has_fixmes =