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,
18 unsigned int *timeleft,
22 struct doc_section *d;
24 list_for_each(&m->h_files, f, list) {
25 list_for_each(get_ccan_file_docs(f), d, list) {
29 if (!streq(d->type, "example"))
33 score_file_error(score, f, d->srcline+1,
34 "Function name not found in summary line");
37 for (i = 0; i < d->num_lines; i++) {
38 if (strstr(d->lines[i], d->function))
43 score_file_error(score, f, d->srcline+1,
44 "Example for %s doesn't"
45 " mention it", d->function);
51 score->score = score->total;
57 struct ccanlint examples_relevant = {
58 .key = "examples_relevant",
59 .name = "Example: sections demonstrate appropriate function",
60 .check = examples_relevant_check,
61 .needs = "examples_exist"
64 REGISTER_TEST(examples_relevant);