From: Rusty Russell Date: Wed, 10 Nov 2010 11:38:15 +0000 (+1030) Subject: ccanlint: typo fix and fix errant description parsing. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=ad3f309e3c13d6b88864aab146895c9df9bc6e5b;hp=8566131a68d4e0e5e10a5179bd50e18106ac646d ccanlint: typo fix and fix errant description parsing. "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. --- diff --git a/tools/ccanlint/tests/has_info_documentation.c b/tools/ccanlint/tests/has_info_documentation.c index 6ecbf842..ee89df9f 100644 --- a/tools/ccanlint/tests/has_info_documentation.c +++ b/tools/ccanlint/tests/has_info_documentation.c @@ -82,12 +82,12 @@ static void check_has_info_documentation(struct manifest *m, "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 = { diff --git a/tools/ccanlint/tests/trailing_whitespace.c b/tools/ccanlint/tests/trailing_whitespace.c index 2d344435..ea8b5787 100644 --- a/tools/ccanlint/tests/trailing_whitespace.c +++ b/tools/ccanlint/tests/trailing_whitespace.c @@ -37,7 +37,7 @@ static void check_trailing_whitespace(struct manifest *m, char *err = get_trailing_whitespace(lines[i]); if (err) { score->error = "Trailing whitespace" - "found"; + " found"; score_file_error(score, f, i+1, err); } } diff --git a/tools/doc_extract-core.c b/tools/doc_extract-core.c index 583328a1..2862eedc 100644 --- a/tools/doc_extract-core.c +++ b/tools/doc_extract-core.c @@ -52,13 +52,20 @@ static bool is_blank(const char *line) 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)