From 66b6a433c6243b8be72bbd04a40d0a38cedb11b4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 3 Jul 2020 18:15:03 +0200 Subject: Unify naming of generating assists --- xtask/tests/tidy.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xtask/tests/tidy.rs') diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index d38ac7f17..f99935170 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs @@ -56,8 +56,8 @@ fn check_todo(path: &Path, text: &str) { // Some of our assists generate `todo!()` so those files are whitelisted. "tests/generated.rs", "handlers/add_missing_impl_members.rs", - "handlers/add_function.rs", "handlers/add_turbo_fish.rs", + "handlers/generate_function.rs", // To support generating `todo!()` in assists, we have `expr_todo()` in ast::make. "ast/make.rs", ]; -- cgit v1.2.3 From e4b4600752d3c7102f01d074c25b4798b75c2bed Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 8 Jul 2020 22:47:50 +0200 Subject: better language --- xtask/tests/tidy.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'xtask/tests/tidy.rs') 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() { } fn check_todo(path: &Path, text: &str) { - let whitelist = &[ - // This file itself is whitelisted since this test itself contains matches. + let need_todo = &[ + // This file itself obviously needs to use todo (<- like this!). "tests/cli.rs", - // Some of our assists generate `todo!()` so those files are whitelisted. + // Some of our assists generate `todo!()`. "tests/generated.rs", "handlers/add_missing_impl_members.rs", "handlers/add_turbo_fish.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", ]; - if whitelist.iter().any(|p| path.ends_with(p)) { + if need_todo.iter().any(|p| path.ends_with(p)) { return; } 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_expand", "ra_ide", @@ -153,9 +154,9 @@ impl TidyDocs { ]; let mut has_fixmes = - whitelist.iter().map(|it| (*it, false)).collect::>(); + poorly_documented.iter().map(|it| (*it, false)).collect::>(); '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) { has_fixmes.insert(krate, true); continue 'outer; @@ -166,7 +167,7 @@ impl TidyDocs { for (krate, has_fixme) in has_fixmes.iter() { 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) } } } -- cgit v1.2.3 From 239a6012eb97e4ec74ad975266436d6eb4ec9bec Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 14 Jul 2020 17:14:00 +0200 Subject: Check licenses --- xtask/tests/tidy.rs | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'xtask/tests/tidy.rs') diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index fcfad609d..72088e414 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs @@ -5,7 +5,7 @@ use std::{ use xtask::{ codegen::{self, Mode}, - not_bash::fs2, + not_bash::{fs2, run}, project_root, run_rustfmt, rust_files, }; @@ -49,6 +49,45 @@ fn rust_files_are_tidy() { tidy_docs.finish(); } +#[test] +fn check_licenses() { + let expected = " +0BSD OR MIT OR Apache-2.0 +Apache-2.0 +Apache-2.0 / MIT +Apache-2.0 OR BSL-1.0 +Apache-2.0 OR MIT +Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT +Apache-2.0/MIT +BSD-2-Clause +BSD-3-Clause +CC0-1.0 +ISC +MIT +MIT / Apache-2.0 +MIT OR Apache-2.0 +MIT/Apache-2.0 +MIT/Apache-2.0 AND BSD-2-Clause +Unlicense OR MIT +Unlicense/MIT +Zlib +" + .lines() + .filter(|it| !it.is_empty()) + .collect::>(); + + let meta = run!("cargo metadata --format-version 1"; echo = false).unwrap(); + let mut licenses = meta + .split(|c| c == ',' || c == '{' || c == '}') + .filter(|it| it.contains(r#""license""#)) + .map(|it| it.trim()) + .map(|it| it[r#""license":"#.len()..].trim_matches('"')) + .collect::>(); + licenses.sort(); + licenses.dedup(); + assert_eq!(licenses, expected); +} + fn check_todo(path: &Path, text: &str) { let need_todo = &[ // This file itself obviously needs to use todo (<- like this!). -- cgit v1.2.3 From 46ac9ff5e3cf070584d8167150655d091d47e3c2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 18 Jul 2020 16:40:10 +0200 Subject: Simplify exclusion logic --- xtask/tests/tidy.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'xtask/tests/tidy.rs') diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index 72088e414..ca14e8ac1 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs @@ -54,7 +54,6 @@ fn check_licenses() { let expected = " 0BSD OR MIT OR Apache-2.0 Apache-2.0 -Apache-2.0 / MIT Apache-2.0 OR BSL-1.0 Apache-2.0 OR MIT Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT -- cgit v1.2.3 From 4f7a3fba59269a2b37b78655a10778ba5af796bd Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 23 Jul 2020 12:59:18 +0200 Subject: Replace superslice with API on path to stabilization --- xtask/tests/tidy.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'xtask/tests/tidy.rs') diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index ca14e8ac1..adadffc53 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs @@ -53,7 +53,6 @@ fn rust_files_are_tidy() { fn check_licenses() { let expected = " 0BSD OR MIT OR Apache-2.0 -Apache-2.0 Apache-2.0 OR BSL-1.0 Apache-2.0 OR MIT Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT -- cgit v1.2.3 From ba585309ec9ba6102038cd16c3fff107dfc1f56c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 29 Jul 2020 19:49:10 +0200 Subject: Replace rand with oorandom --- xtask/tests/tidy.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'xtask/tests/tidy.rs') diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index adadffc53..d65a2acbc 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs @@ -55,7 +55,6 @@ fn check_licenses() { 0BSD OR MIT OR Apache-2.0 Apache-2.0 OR BSL-1.0 Apache-2.0 OR MIT -Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT Apache-2.0/MIT BSD-2-Clause BSD-3-Clause -- cgit v1.2.3