-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip documentation files without ``` when running markdown tests. #42437
Conversation
This should reduce the 'running 0 tests' noise in builds, and is a good heuristic for us to use.
Why not? :) |
It should be safe to go ahead. But there is no harm to check also Edit removed irrelevant info. |
I'm not sure I follow -- those presumably wouldn't be present in markdown files? Are they indications of code blocks? It doesn't feel to me like they are, but I could be wrong. |
Looks reasonable to me! My only worry is, as you commented above, not catching indented blocks or those separated by That being said if our style is to only use backticks (which I think it is) then this looks good to me. |
Yeah, I want @steveklabnik to comment to make sure that we're good with just backticks, but after that I think we'll be good to go. I initially wanted to put this sort of functionality into rustdoc directly (calling it with multiple files which it'd process separately but print together in one list) but that seemed more complicated and I decided to wait on that at least until the next rustdoc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not opposed to this idea, but it also doesn't fully cover all the cases yet.
let mut file = t!(File::open(markdown)); | ||
let mut contents = String::new(); | ||
t!(file.read_to_string(&mut contents)); | ||
if !contents.contains("```") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't the only way there are code blocks though; for example, four spaces is also considered a code block
Yeah, it is; if everyone else is okay with just checking backticks, then I won't let the perfect be the enemy of the good 😄 |
I could add something like \n followed by 4 spaces, but I feel like that heuristic wouldn't work too well due to indentation. I'm open to adding it if we want to though. |
@steveklabnik the failure mode here will be that if you write a doc example or a doc block without three ticks in a markdown file then it won't get tested (in just rust-lang/rust during @Mark-Simulacrum this is primarily done to cut down on all the output generated, right? Do you know how many files end up having 0 tests? |
I believe 417 files would be skipped with this check.
|
I think virtually everything uses the triple ticks, so it should be fine. Gonna bookmark this comment for someday when this randomly bites us, though 😆 |
Heh ok! Let's get that sweet sweet thousands-of-less-lines-of-output from travis then! @bors: r+ |
📌 Commit dd1d75e has been approved by |
Skip documentation files without ``` when running markdown tests. This should reduce the 'running 0 tests' noise in builds, and I believe this is a good heuristic for us to use. cc @rust-lang/docs -- do we use the indented format for code blocks anywhere? Will we? If so, we shouldn't do this. r? @alexcrichton
☀️ Test successful - status-appveyor, status-travis |
…crichton Skip printing for skipped doc tests. Followup to rust-lang#42437 to further reduce noise. r? @alexcrichton
Test src/doc once more This was accidentally broken in #42437 since we filtered too early to recurse into sub-directories. In theory, @bors p=10 r? @alexcrichton
This should reduce the 'running 0 tests' noise in builds, and I believe this is a good heuristic for us to use.
cc @rust-lang/docs -- do we use the indented format for code blocks anywhere? Will we? If so, we shouldn't do this.
r? @alexcrichton