Skip to content

Commit 66c81a0

Browse files
committed
tidy: Add check that license exceptions are actually used
1 parent ab1d244 commit 66c81a0

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

src/tools/tidy/src/deps.rs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const LICENSES: &[&str] = &[
3434
"MIT / Apache-2.0",
3535
"MIT AND (MIT OR Apache-2.0)",
3636
"MIT AND Apache-2.0 WITH LLVM-exception AND (MIT OR Apache-2.0)", // compiler-builtins
37-
"MIT OR Apache-2.0 OR LGPL-2.1-or-later", // r-efi, r-efi-alloc
37+
"MIT OR Apache-2.0 OR LGPL-2.1-or-later", // r-efi, r-efi-alloc; LGPL is not acceptable, but we use it under MIT OR Apache-2.0
3838
"MIT OR Apache-2.0 OR Zlib", // tinyvec_macros
3939
"MIT OR Apache-2.0",
4040
"MIT OR Zlib OR Apache-2.0", // miniz_oxide
@@ -174,13 +174,10 @@ const EXCEPTIONS: ExceptionList = &[
174174
("blake3", "CC0-1.0 OR Apache-2.0 OR Apache-2.0 WITH LLVM-exception"), // rustc
175175
("colored", "MPL-2.0"), // rustfmt
176176
("constant_time_eq", "CC0-1.0 OR MIT-0 OR Apache-2.0"), // rustc
177-
("dissimilar", "Apache-2.0"), // rustdoc, rustc_lexer (few tests) via expect-test, (dev deps)
178-
("fluent-langneg", "Apache-2.0"), // rustc (fluent translations)
179177
("foldhash", "Zlib"), // rustc
180178
("option-ext", "MPL-2.0"), // cargo-miri (via `directories`)
181179
("rustc_apfloat", "Apache-2.0 WITH LLVM-exception"), // rustc (license is the same as LLVM uses)
182180
("ryu", "Apache-2.0 OR BSL-1.0"), // BSL is not acceptble, but we use it under Apache-2.0 // cargo/... (because of serde)
183-
("self_cell", "Apache-2.0"), // rustc (fluent translations)
184181
("wasi-preview1-component-adapter-provider", "Apache-2.0 WITH LLVM-exception"), // rustc
185182
// tidy-alphabetical-end
186183
];
@@ -201,40 +198,29 @@ const EXCEPTIONS_CARGO: ExceptionList = &[
201198
("arrayref", "BSD-2-Clause"),
202199
("bitmaps", "MPL-2.0+"),
203200
("blake3", "CC0-1.0 OR Apache-2.0 OR Apache-2.0 WITH LLVM-exception"),
204-
("ciborium", "Apache-2.0"),
205-
("ciborium-io", "Apache-2.0"),
206-
("ciborium-ll", "Apache-2.0"),
207201
("constant_time_eq", "CC0-1.0 OR MIT-0 OR Apache-2.0"),
208202
("dunce", "CC0-1.0 OR MIT-0 OR Apache-2.0"),
209203
("encoding_rs", "(Apache-2.0 OR MIT) AND BSD-3-Clause"),
210204
("fiat-crypto", "MIT OR Apache-2.0 OR BSD-1-Clause"),
211205
("foldhash", "Zlib"),
212206
("im-rc", "MPL-2.0+"),
213207
("libz-rs-sys", "Zlib"),
214-
("normalize-line-endings", "Apache-2.0"),
215-
("openssl", "Apache-2.0"),
216208
("ring", "Apache-2.0 AND ISC"),
217209
("ryu", "Apache-2.0 OR BSL-1.0"), // BSL is not acceptble, but we use it under Apache-2.0
218-
("similar", "Apache-2.0"),
219210
("sized-chunks", "MPL-2.0+"),
220211
("subtle", "BSD-3-Clause"),
221-
("supports-hyperlinks", "Apache-2.0"),
222-
("unicode-bom", "Apache-2.0"),
223212
("zlib-rs", "Zlib"),
224213
// tidy-alphabetical-end
225214
];
226215

227216
const EXCEPTIONS_RUST_ANALYZER: ExceptionList = &[
228217
// tidy-alphabetical-start
229-
("dissimilar", "Apache-2.0"),
230218
("foldhash", "Zlib"),
231219
("notify", "CC0-1.0"),
232220
("option-ext", "MPL-2.0"),
233-
("pulldown-cmark-to-cmark", "Apache-2.0"),
234221
("rustc_apfloat", "Apache-2.0 WITH LLVM-exception"),
235222
("ryu", "Apache-2.0 OR BSL-1.0"), // BSL is not acceptble, but we use it under Apache-2.0
236-
("scip", "Apache-2.0"),
237-
// tidy-alphabetical-end
223+
// tidy-alphabetical-end
238224
];
239225

240226
const EXCEPTIONS_RUSTC_PERF: ExceptionList = &[
@@ -300,9 +286,7 @@ const EXCEPTIONS_BOOTSTRAP: ExceptionList = &[
300286
("ryu", "Apache-2.0 OR BSL-1.0"), // through serde. BSL is not acceptble, but we use it under Apache-2.0
301287
];
302288

303-
const EXCEPTIONS_UEFI_QEMU_TEST: ExceptionList = &[
304-
("r-efi", "MIT OR Apache-2.0 OR LGPL-2.1-or-later"), // LGPL is not acceptable, but we use it under MIT OR Apache-2.0
305-
];
289+
const EXCEPTIONS_UEFI_QEMU_TEST: ExceptionList = &[];
306290

307291
#[derive(Clone, Copy)]
308292
struct ListLocation {
@@ -867,6 +851,11 @@ fn check_license_exceptions(
867851
}
868852
}
869853
}
854+
if LICENSES.contains(license) {
855+
check.error(format!(
856+
"dependency exception `{name}` is not necessary. `{license}` is an allowed license"
857+
));
858+
}
870859
}
871860

872861
let exception_names: Vec<_> = exceptions.iter().map(|(name, _license)| *name).collect();

0 commit comments

Comments
 (0)