diff options
author | Josh Mcguigan <[email protected]> | 2020-03-21 15:04:28 +0000 |
---|---|---|
committer | Josh Mcguigan <[email protected]> | 2020-03-21 16:39:45 +0000 |
commit | 90c66470f9d87fd61a9d80b6f29e53e85a0a340e (patch) | |
tree | f70d3fb1cac9b15ca595876211b0325e0d021fc5 /xtask/tests/tidy-tests | |
parent | 5e827bd948ea206328b126345ab8e909978b3b9b (diff) |
gen_assists_docs skip hidden files
Diffstat (limited to 'xtask/tests/tidy-tests')
-rw-r--r-- | xtask/tests/tidy-tests/main.rs | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/xtask/tests/tidy-tests/main.rs b/xtask/tests/tidy-tests/main.rs index 5ae86c87c..80911a68e 100644 --- a/xtask/tests/tidy-tests/main.rs +++ b/xtask/tests/tidy-tests/main.rs | |||
@@ -5,13 +5,12 @@ use std::{ | |||
5 | path::{Path, PathBuf}, | 5 | path::{Path, PathBuf}, |
6 | }; | 6 | }; |
7 | 7 | ||
8 | use walkdir::{DirEntry, WalkDir}; | 8 | use xtask::{not_bash::fs2, project_root, rust_files}; |
9 | use xtask::{not_bash::fs2, project_root}; | ||
10 | 9 | ||
11 | #[test] | 10 | #[test] |
12 | fn rust_files_are_tidy() { | 11 | fn rust_files_are_tidy() { |
13 | let mut tidy_docs = TidyDocs::default(); | 12 | let mut tidy_docs = TidyDocs::default(); |
14 | for path in rust_files() { | 13 | for path in rust_files(&project_root().join("crates")) { |
15 | let text = fs2::read_to_string(&path).unwrap(); | 14 | let text = fs2::read_to_string(&path).unwrap(); |
16 | check_todo(&path, &text); | 15 | check_todo(&path, &text); |
17 | check_trailing_ws(&path, &text); | 16 | check_trailing_ws(&path, &text); |
@@ -142,19 +141,3 @@ fn is_exclude_dir(p: &Path, dirs_to_exclude: &[&str]) -> bool { | |||
142 | 141 | ||
143 | false | 142 | false |
144 | } | 143 | } |
145 | |||
146 | fn rust_files() -> impl Iterator<Item = PathBuf> { | ||
147 | let crates = project_root().join("crates"); | ||
148 | let iter = WalkDir::new(crates); | ||
149 | return iter | ||
150 | .into_iter() | ||
151 | .filter_entry(|e| !is_hidden(e)) | ||
152 | .map(|e| e.unwrap()) | ||
153 | .filter(|e| !e.file_type().is_dir()) | ||
154 | .map(|e| e.into_path()) | ||
155 | .filter(|path| path.extension().map(|it| it == "rs").unwrap_or(false)); | ||
156 | |||
157 | fn is_hidden(entry: &DirEntry) -> bool { | ||
158 | entry.file_name().to_str().map(|s| s.starts_with('.')).unwrap_or(false) | ||
159 | } | ||
160 | } | ||