1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
3 #include <ccan/talloc/talloc.h>
4 #include <ccan/str/str.h>
17 static void examples_relevant_check(struct manifest *m,
19 unsigned int *timeleft,
23 struct doc_section *d;
25 list_for_each(&m->h_files, f, list) {
26 list_for_each(get_ccan_file_docs(f), d, list) {
30 if (!streq(d->type, "example"))
33 for (i = 0; i < d->num_lines; i++) {
34 if (strstr(d->lines[i], d->function))
39 score_file_error(score, f, d->srcline+1,
40 "Example for %s doesn't"
41 " mention it", d->function);
47 score->score = score->total;
53 struct ccanlint examples_relevant = {
54 .key = "examples_relevant",
55 .name = "Example: sections demonstrate appropriate function",
56 .check = examples_relevant_check,
57 .needs = "examples_exist"
60 REGISTER_TEST(examples_relevant);