Skip to content

Commit 49143e0

Browse files
author
Alexander Regueiro
committed
Added check for copyright notices.
1 parent 88336ea commit 49143e0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/tools/tidy/src/style.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ pub fn check(path: &Path, bad: &mut bool) {
111111
let skip_tab = contents.contains("ignore-tidy-tab");
112112
let skip_length = contents.contains("ignore-tidy-linelength");
113113
let skip_end_whitespace = contents.contains("ignore-tidy-end-whitespace");
114+
let skip_copyright = contents.contains("ignore-tidy-copyright");
114115
let mut trailing_new_lines = 0;
115116
for (i, line) in contents.split('\n').enumerate() {
116117
let mut err = |msg: &str| {
@@ -120,13 +121,13 @@ pub fn check(path: &Path, bad: &mut bool) {
120121
&& !long_line_is_ok(line) {
121122
err(&format!("line longer than {} chars", COLS));
122123
}
123-
if line.contains('\t') && !skip_tab {
124+
if !skip_tab && line.contains('\t') {
124125
err("tab character");
125126
}
126127
if !skip_end_whitespace && (line.ends_with(' ') || line.ends_with('\t')) {
127128
err("trailing whitespace");
128129
}
129-
if line.contains('\r') && !skip_cr {
130+
if !skip_cr && line.contains('\r') {
130131
err("CR character");
131132
}
132133
if filename != "style.rs" {
@@ -137,6 +138,13 @@ pub fn check(path: &Path, bad: &mut bool) {
137138
err("XXX is deprecated; use FIXME")
138139
}
139140
}
141+
if !skip_copyright && (line.starts_with("// Copyright") ||
142+
line.starts_with("# Copyright") ||
143+
line.starts_with("Copyright"))
144+
&& (line.contains("Rust Developers") ||
145+
line.contains("Rust Project Developers")) {
146+
err("copyright notices attributed to the Rust Project Developers are deprecated");
147+
}
140148
if line.ends_with("```ignore") || line.ends_with("```rust,ignore") {
141149
err(UNEXPLAINED_IGNORE_DOCTEST_INFO);
142150
}

0 commit comments

Comments
 (0)