1 #include <tools/ccanlint/ccanlint.h>
2 #include <ccan/foreach/foreach.h>
12 #include <ccan/talloc/talloc.h>
13 #include <ccan/str/str.h>
14 #include <ccan/str_talloc/str_talloc.h>
16 static void check_license_file_compat(struct manifest *m,
17 unsigned int *timeleft,
20 struct list_head *list;
22 /* FIXME: Ignore unknown licenses for now. */
23 if (m->license == LICENSE_UNKNOWN) {
25 score->score = score->total = 0;
29 foreach_ptr(list, &m->c_files, &m->h_files) {
32 list_for_each(list, f, list) {
35 /* Check they don't have boilerplate for incompatible
37 for (l = 0; l < LICENSE_UNKNOWN; l++) {
38 if (!find_boilerplate(f, l))
40 if (license_compatible[m->license][l])
42 score_file_error(score, f, 0,
43 "Found boilerplate for license '%s' which is incompatible with '%s'",
45 licenses[m->license].name);
51 if (list_empty(&score->per_file_errors)) {
53 score->score = score->total;
57 struct ccanlint license_file_compat = {
58 .key = "license_file_compat",
59 .name = "Source files don't contain incompatible licenses",
60 .check = check_license_file_compat,
61 .needs = "license_exists"
63 REGISTER_TEST(license_file_compat);