better language

This commit is contained in:
Aleksey Kladov 2020-07-08 22:47:50 +02:00
parent e8bb153b19
commit e4b4600752
2 changed files with 12 additions and 11 deletions

View file

@ -9,8 +9,8 @@ use paths::{RelPath, RelPathBuf};
/// ///
/// It describes the set of files inside some directory. /// It describes the set of files inside some directory.
/// ///
/// The current implementation is very limited, it allows white-listing file /// The current implementation is very limited, it allows including file globs
/// globs and black-listing directories. /// and recursively excluding directories.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct Include { pub(crate) struct Include {
include_files: GlobSet, include_files: GlobSet,

View file

@ -50,18 +50,19 @@ fn rust_files_are_tidy() {
} }
fn check_todo(path: &Path, text: &str) { fn check_todo(path: &Path, text: &str) {
let whitelist = &[ let need_todo = &[
// This file itself is whitelisted since this test itself contains matches. // This file itself obviously needs to use todo (<- like this!).
"tests/cli.rs", "tests/cli.rs",
// Some of our assists generate `todo!()` so those files are whitelisted. // Some of our assists generate `todo!()`.
"tests/generated.rs", "tests/generated.rs",
"handlers/add_missing_impl_members.rs", "handlers/add_missing_impl_members.rs",
"handlers/add_turbo_fish.rs", "handlers/add_turbo_fish.rs",
"handlers/generate_function.rs", "handlers/generate_function.rs",
// To support generating `todo!()` in assists, we have `expr_todo()` in ast::make. // To support generating `todo!()` in assists, we have `expr_todo()` in
// `ast::make`.
"ast/make.rs", "ast/make.rs",
]; ];
if whitelist.iter().any(|p| path.ends_with(p)) { if need_todo.iter().any(|p| path.ends_with(p)) {
return; return;
} }
if text.contains("TODO") || text.contains("TOOD") || text.contains("todo!") { if text.contains("TODO") || text.contains("TOOD") || text.contains("todo!") {
@ -139,7 +140,7 @@ impl TidyDocs {
) )
} }
let whitelist = [ let poorly_documented = [
"ra_hir", "ra_hir",
"ra_hir_expand", "ra_hir_expand",
"ra_ide", "ra_ide",
@ -153,9 +154,9 @@ impl TidyDocs {
]; ];
let mut has_fixmes = let mut has_fixmes =
whitelist.iter().map(|it| (*it, false)).collect::<HashMap<&str, bool>>(); poorly_documented.iter().map(|it| (*it, false)).collect::<HashMap<&str, bool>>();
'outer: for path in self.contains_fixme { 'outer: for path in self.contains_fixme {
for krate in whitelist.iter() { for krate in poorly_documented.iter() {
if path.components().any(|it| it.as_os_str() == *krate) { if path.components().any(|it| it.as_os_str() == *krate) {
has_fixmes.insert(krate, true); has_fixmes.insert(krate, true);
continue 'outer; continue 'outer;
@ -166,7 +167,7 @@ impl TidyDocs {
for (krate, has_fixme) in has_fixmes.iter() { for (krate, has_fixme) in has_fixmes.iter() {
if !has_fixme { if !has_fixme {
panic!("crate {} is fully documented, remove it from the white list", krate) panic!("crate {} is fully documented :tada:, remove it from the list of poorly documented crates", krate)
} }
} }
} }