diff options
| author | kennytm <kennytm@gmail.com> | 2017-06-21 01:00:02 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2017-06-23 15:31:54 +0800 |
| commit | 9addd3ba657e0d37c3fa5296262474db91d26d8f (patch) | |
| tree | 44d5fd863a3b247f490960319ec4c717a05df04c | |
| parent | 2c8916581472f5f9892c306632bb2b3d8bc96bc4 (diff) | |
| download | rust-9addd3ba657e0d37c3fa5296262474db91d26d8f.tar.gz rust-9addd3ba657e0d37c3fa5296262474db91d26d8f.zip | |
Added a tidy check to disallow "```ignore" and "```rust,ignore".
| -rw-r--r-- | src/tools/tidy/src/style.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index f5f1abc4b12..b42beb37821 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -18,6 +18,7 @@ //! * No CR characters //! * No `TODO` or `XXX` directives //! * A valid license header is at the top +//! * No unexplained ` ```ignore ` or ` ```rust,ignore ` doc tests //! //! A number of these checks can be opted-out of with various directives like //! `// ignore-tidy-linelength`. @@ -38,6 +39,17 @@ http://www.apache.org/licenses/LICENSE-2.0> or the MIT license option. This file may not be copied, modified, or distributed except according to those terms."; +const UNEXPLAINED_IGNORE_DOCTEST_INFO: &str = r#"unexplained "```ignore" doctest; try one: + +* make the test actually pass, by adding necessary imports and declarations, or +* use "```text", if the code is not Rust code, or +* use "```compile_fail,Ennnn", if the code is expected to fail at compile time, or +* use "```should_panic", if the code is expected to fail at run time, or +* use "```no_run", if the code should type-check but not necessary linkable/runnable, or +* explain it like "```ignore (cannot-test-this-because-xxxx)", if the annotation cannot be avoided. + +"#; + /// Parser states for line_is_url. #[derive(PartialEq)] #[allow(non_camel_case_types)] @@ -138,6 +150,9 @@ pub fn check(path: &Path, bad: &mut bool) { err("XXX is deprecated; use FIXME") } } + if line.ends_with("```ignore") || line.ends_with("```rust,ignore") { + err(UNEXPLAINED_IGNORE_DOCTEST_INFO); + } } if !licenseck(file, &contents) { tidy_error!(bad, "{}: incorrect license", file.display()); |
