1 #include <tools/ccanlint/ccanlint.h>
2 #include <ccan/foreach/foreach.h>
12 #include <ccan/str/str.h>
14 static void check_license_file_compat(struct manifest *m,
15 unsigned int *timeleft,
18 struct list_head *list;
20 /* FIXME: Ignore unknown licenses for now. */
21 if (m->license == LICENSE_UNKNOWN) {
23 score->score = score->total = 0;
27 foreach_ptr(list, &m->c_files, &m->h_files) {
30 list_for_each(list, f, list) {
33 /* Check they don't have boilerplate for incompatible
35 for (l = 0; l < LICENSE_UNKNOWN; l++) {
36 if (!find_boilerplate(f, l))
38 if (license_compatible[m->license][l])
40 score_file_error(score, f, 0,
41 "Found boilerplate for license '%s' which is incompatible with '%s'",
43 licenses[m->license].name);
49 if (list_empty(&score->per_file_errors)) {
51 score->score = score->total;
55 struct ccanlint license_file_compat = {
56 .key = "license_file_compat",
57 .name = "Source files don't contain incompatible licenses",
58 .check = check_license_file_compat,
59 .needs = "license_exists"
61 REGISTER_TEST(license_file_compat);