Skip to content

Commit

Permalink
Added a tidy check to disallow "ignore" and "rust,ignore".
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytm committed Jun 23, 2017
1 parent 2c89165 commit 9addd3b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/tools/tidy/src/style.rs
Expand Up @@ -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`.
Expand All @@ -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)]
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 9addd3b

Please sign in to comment.