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,
18 unsigned int *timeleft,
21 struct list_head *list;
23 /* FIXME: Ignore unknown licenses for now. */
24 if (m->license == LICENSE_UNKNOWN) {
26 score->score = score->total = 0;
30 foreach_ptr(list, &m->c_files, &m->h_files) {
33 list_for_each(list, f, list) {
36 /* Check they don't have boilerplate for incompatible
38 for (l = 0; l < LICENSE_UNKNOWN; l++) {
39 if (!find_boilerplate(f, l))
41 if (license_compatible[m->license][l])
43 score_file_error(score, f, 0,
44 "Found boilerplate for license '%s' which is incompatible with '%s'",
46 licenses[m->license].name);
52 if (list_empty(&score->per_file_errors)) {
54 score->score = score->total;
58 struct ccanlint license_file_compat = {
59 .key = "license_file_compat",
60 .name = "Source files don't contain incompatible licenses",
61 .check = check_license_file_compat,
62 .needs = "license_exists"
64 REGISTER_TEST(license_file_compat);