[libvirt] [PATCH] build: exclude more files from all the syntax checks
jim at meyering.net
Fri Oct 6 17:07:06 UTC 2017
On Fri, Oct 6, 2017 at 7:47 AM, Eric Blake <eblake at redhat.com> wrote:
> On 10/05/2017 06:07 AM, Pino Toscano wrote:
>> The majority of the syntax check is taylored for C sources, so some of
>> the checks already cause false positives for non-C sources (and thus
>> there are exclusion regexps in place).
>> Instead, just exclude more non-C files from all the checks:
>> - pot files: they are templates for po files (already excluded), and
>> they are automatically generated from sources
>> - pl files: Perl sources, which have own APIs, style, etc; they are
>> helper scripts, not "real" sources
>> - spec/spec.in files: RPM packaging files
>> - js/woff/html.in files: files for web pages
>> - diff/patch files: patches
>> - stp files: SystemTap scripts
>> - syms files: linker symbols files
>> - conf files: generic configuration files
>> - data/cpuinfo files: procinfo/cpuinfo files
> There are still some useful syntax checks for performing on ALL files
> (for example, prohibit_doubled_word). So I'm not quite sure that
> blindly exempting these files from all possible checks makes sense.
> Maybe it's worth teaching upstream gnulib syntax-check to make it easier
> to auto-exclude non-C files from checks that ARE specific to the C
> language, without weakening the global checks that are good on all
> files. Maybe even something as simple as adding some sort of language=
> tag to feed to $(_sc_search_regexp (if not specified, run on all files,
> but if specified as C, the syntax-check is specific to C-like files, so
> it limits to .h, .c. .y).
> I'm adding the gnulib list to get feedback on the idea; maybe Jim
> Meyering has an opinion as one of the original syntax-check authors.
Is there some reason not to use a directive like this in a rule
applying exclusively to version-controlled C-like files?
I looked at libvirt's cfg.mk, and if you add that line to the
sc_prohibit_sprintf rule, you can then remove the lines that exempt
files with unrelated suffixes from that rule:
exclude_file_name_regexp--sc_prohibit_sprintf = \
Another rule that can catch things in any non-binary file is
sc_prohibit_undesirable_word_seq, even if it's only for pet peeves
like detecting "can not".
>> # Files that should never cause syntax check failures.
>> VC_LIST_ALWAYS_EXCLUDE_REGEX = \
>> - (^(docs/(news(-[0-9]*)?\.html\.in|.*\.patch))|\.(po|fig|gif|ico|png))$$
>> + \.(po|fig|gif|ico|png|pot|pl|spec|spec\.in|js|woff|diff|patch|html\.in|stp|syms|conf|data|cpuinfo)$$
More information about the libvir-list