lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] How to work around an annoying coding rules test false positiv


From: Vadim Zeitlin
Subject: Re: [lmi] How to work around an annoying coding rules test false positive?
Date: Mon, 17 Jun 2019 21:38:54 +0200

On Mon, 17 Jun 2019 19:29:17 +0000 Greg Chicares <address@hidden> wrote:

GC> On 2019-06-16 16:08, Vadim Zeitlin wrote:
GC> > 
GC> >  The md5sum-related PR adds a new unit test which checks that computing 
MD5
GC> > sums products the expected output, which is defined like this:
GC> > 
GC> >   std::string const md5sums_text =
GC> >   R"(#
GC> >   00112233445566778899aabbccddeeff  test1
GC> >   ffeeddccbbaa99887766554433221100 *test2
GC> >   )"
GC> >       ;
GC> > 
GC> >  Unfortunately this results in the following warning when running "make
GC> > check_concinnity":
GC> > 
GC> > File 'md5sum_test.cpp' should fuse '*' with type: 
'ffeeddccbbaa99887766554433221100 *2test'.
GC> 
GC> In 'test_coding_rules.cpp', there's a crude but effective workaround:
GC> 
GC> bool check_reserved_name_exception(std::string const& s)
GC> {
GC>     static std::set<std::string> const z
GC>     // Taboo, and therefore uglified here.
GC>         {"D""__""W""IN32""__"
GC>         ,"_""W""IN32"
GC>         ,"__""W""IN32""__"
GC> 
GC> Would the same sort of uglification work in this case?

 Not directly because this wouldn't work inside a C++11 raw string used
above. And it's really nice to use raw strings for multiline string
literals, so I'd rather prefer my workaround with adding dummy extensions
than switching to normal strings.

GC> >  The real solution would be to not check the contents of strings, 
including
GC> > the raw string literals, but this would require major changes to the
GC> > test_coding_rules.cpp code.
GC> 
GC> That would be a major undertaking. A local workaround seems best for now.

 Understood, but the example of check_reserved_name_exception() above (that
I either didn't know or forgot about) shows that the current checks are
even more annoying than I thought. It would be nice to at least allow some
way to disable the spurious check failures, e.g. maybe recognize some
special "// LMI-CODE-STYLE: ignore" comments on the lines that we don't
want to check...

 Regards,
VZ

Attachment: pgpfRRQKRGoC1.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]