"C has fairly weak typing:" from check_type/_info is not a new section heading!
Enforce that each word in multi-word sections must be caps.
"CCAN modules use /**-style comments for documentation: the\n"
"overall documentation belongs in the _info metafile.\n";
has_info_documentation.handle = create_info_template_doc;
- }
- else if (!description)
+ } else if (!description) {
score->error = "_info file has no module description.\n\n"
"The lines after the first summary line in the _info file\n"
"documentation should describe the purpose and use of the\n"
"overall package\n";
+ }
}
struct ccanlint has_info_documentation = {
char *err = get_trailing_whitespace(lines[i]);
if (err) {
score->error = "Trailing whitespace"
- "found";
+ " found";
score_file_error(score, f, i+1, err);
}
}
static bool is_section(const char *line, bool one_liner)
{
- unsigned int len;
+ unsigned int len = 0;
- if (!isupper(line[0]))
- return false;
- len = strspn(line, IDENT_CHARS" ");
- if (line[len] != ':')
- return false;
+ /* Any number of upper case words separated by spaces, ending in : */
+ for (;;) {
+ if (!isupper(line[len]))
+ return false;
+ len += strspn(line+len, IDENT_CHARS);
+ if (line[len] == ':')
+ break;
+
+ if (line[len] != ' ')
+ return false;
+ len++;
+ }
/* If it can be a one-liner, a space is sufficient.*/
if (one_liner)