Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b5f83a9

Browse files
authoredJul 27, 2023
Rollup merge of rust-lang#114133 - workingjubilee:revert-add-tidy-check-issue-12345, r=jackh726
Revert "add tidy check that forbids issue ui test filenames" This reverts commit 13e2abf. Reverting because an MCP was requested and it turned out there was a lack of a consensus on what to do in this area.
2 parents 9b7b993 + 686b3de commit b5f83a9

File tree

2 files changed

+6
-4329
lines changed

2 files changed

+6
-4329
lines changed
 

‎src/tools/tidy/src/issues.txt

Lines changed: 0 additions & 4282 deletions
This file was deleted.

‎src/tools/tidy/src/ui_tests.rs

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
//! - there are no stray `.stderr` files
44
55
use ignore::Walk;
6-
use lazy_static::lazy_static;
7-
use regex::Regex;
8-
use std::collections::{HashMap, HashSet};
6+
use std::collections::HashMap;
97
use std::ffi::OsStr;
108
use std::fs;
119
use std::path::{Path, PathBuf};
@@ -90,12 +88,6 @@ fn check_entries(tests_path: &Path, bad: &mut bool) {
9088

9189
pub fn check(path: &Path, bad: &mut bool) {
9290
check_entries(&path, bad);
93-
94-
// the list of files in ui tests that are allowed to start with `issue-XXXX`
95-
let mut allowed_issue_filenames: HashSet<String> = HashSet::from(
96-
include!("issues.txt").map(|path| path.replace("/", std::path::MAIN_SEPARATOR_STR)),
97-
);
98-
9991
let (ui, ui_fulldeps) = (path.join("ui"), path.join("ui-fulldeps"));
10092
let paths = [ui.as_path(), ui_fulldeps.as_path()];
10193
crate::walk::walk_no_read(&paths, |_, _| false, &mut |entry| {
@@ -108,11 +100,6 @@ pub fn check(path: &Path, bad: &mut bool) {
108100
{
109101
tidy_error!(bad, "file {} has unexpected extension {}", file_path.display(), ext);
110102
}
111-
112-
// NB: We do not use file_stem() as some file names have multiple `.`s and we
113-
// must strip all of them.
114-
let testname =
115-
file_path.file_name().unwrap().to_str().unwrap().split_once('.').unwrap().0;
116103
if ext == "stderr" || ext == "stdout" {
117104
// Test output filenames have one of the formats:
118105
// ```
@@ -124,7 +111,11 @@ pub fn check(path: &Path, bad: &mut bool) {
124111
//
125112
// For now, just make sure that there is a corresponding
126113
// `$testname.rs` file.
127-
114+
//
115+
// NB: We do not use file_stem() as some file names have multiple `.`s and we
116+
// must strip all of them.
117+
let testname =
118+
file_path.file_name().unwrap().to_str().unwrap().split_once('.').unwrap().0;
128119
if !file_path.with_file_name(testname).with_extension("rs").exists()
129120
&& !testname.contains("ignore-tidy")
130121
{
@@ -137,38 +128,6 @@ pub fn check(path: &Path, bad: &mut bool) {
137128
}
138129
}
139130
}
140-
141-
if ext == "rs" {
142-
lazy_static! {
143-
static ref ISSUE_NAME_REGEX: Regex =
144-
Regex::new(r"^issues?[-_]?\d{3,}").unwrap();
145-
}
146-
147-
if ISSUE_NAME_REGEX.is_match(testname) {
148-
// these paths are always relative to the passed `path` and always UTF8
149-
let stripped_path = file_path.strip_prefix(path).unwrap().to_str().unwrap();
150-
if !allowed_issue_filenames.remove(stripped_path) {
151-
tidy_error!(
152-
bad,
153-
"UI test `{}` should use a name that describes the test and link the issue in a comment instead.",
154-
file_path.display(),
155-
);
156-
}
157-
}
158-
}
159131
}
160132
});
161-
162-
// if an excluded file is renamed, it must be removed from this list
163-
if allowed_issue_filenames.len() > 0 {
164-
for file_name in allowed_issue_filenames {
165-
let mut p = PathBuf::from(path);
166-
p.push(file_name);
167-
tidy_error!(
168-
bad,
169-
"file `{}` no longer exists and should be removed from the exclusions in `src/tools/tidy/src/issues.txt`",
170-
p.display()
171-
);
172-
}
173-
}
174133
}

0 commit comments

Comments
 (0)
Please sign in to comment.