1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/str/str.h>
16 static void examples_relevant_check(struct manifest *m,
17 unsigned int *timeleft,
21 struct doc_section *d;
23 list_for_each(&m->h_files, f, list) {
24 list_for_each(get_ccan_file_docs(f), d, list) {
28 if (!streq(d->type, "example"))
32 score_file_error(score, f, d->srcline+1,
33 "Function name not found in summary line");
36 for (i = 0; i < d->num_lines; i++) {
37 if (strstr(d->lines[i], d->function))
42 score_file_error(score, f, d->srcline+1,
43 "Example for %s doesn't"
44 " mention it", d->function);
50 score->score = score->total;
56 struct ccanlint examples_relevant = {
57 .key = "examples_relevant",
58 .name = "Example: sections demonstrate appropriate function",
59 .check = examples_relevant_check,
60 .needs = "examples_exist"
63 REGISTER_TEST(examples_relevant);