1 #include <tools/ccanlint/ccanlint.h>
2 #include <tools/tools.h>
4 #include <ccan/talloc/talloc.h>
5 #include <ccan/str/str.h>
7 /* Summary line is form '<identifier> - ' (spaces for 'struct foo -') */
8 /* slightly modified from doc_extract-core.c */
9 static unsigned int is_summary_line(const char *line)
13 id_len = strspn(line, IDENT_CHARS" *");
16 if (strspn(line, " ") == id_len)
18 if (!strstarts(line + id_len-1, " - "))
23 static void check_info_summary_single_line(struct manifest *m,
25 unsigned int *timeleft,
29 get_ccan_line_info(m->info_file);
31 for (i = 0; i < m->info_file->num_lines; ++i) {
32 if (is_summary_line(m->info_file->lines[i])) {
33 if (strspn(m->info_file->lines[i+1], " *") == strlen(m->info_file->lines[i+1])) {
34 /* valid summary line */
39 /* invalid summary line - line following summary line should be empty */
42 score->error = "invalid summary line - not on a single line:";
43 score_file_error(score, m->info_file, i+1, "summary is not on a single line");
51 struct ccanlint info_summary_single_line = {
52 .key = "info_summary_single_line",
53 .name = "Module has a single line summary in _info",
54 .check = check_info_summary_single_line,
55 .needs = "info_exists"
58 REGISTER_TEST(info_summary_single_line);