Boost logo

Boost :

From: John Femiani (JOHN.FEMIANI_at_[hidden])
Date: 2007-10-10 04:04:14


> -----Original Message-----
> From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]]
> On Behalf Of Maciej Sobczak
> Sent: Wednesday, October 10, 2007 12:31 AM
> To: boost_at_[hidden]
> Subject: Re: [boost] Vera++
><snip>
>
> > and any transforms that could be used to fix the rule
> > afterwards.
>
> It's not that simple. The rules are just scripts and the set of
scripts
> can be different on each installation. Same for transforms.
> In general, rules have no idea about transforms and their meaning, so
> they cannot recommend anything.
> On the other hand, some recommendations can be included in the
> documentation of each rule - at least those which are provided
together
> with the tool.
>
> To be frank, I'm not a big fan of automatic correction of code. This
> concept assumes that the *intended* form can be automatically deduced.
> At the same time I assume that any violation is actually a question
mark
> about the original intentions and that it can be reliably resolved
only
> by human (I don't trust the code which was "fixed" without me being
> involved).
>
> These two assumptions are (philosophically) incompatible.
> <snip>
> --
> Maciej Sobczak * www.msobczak.com * www.inspirel.com

I was not trying to suggest automatically correcting the problems; I was
only suggesting that when the rules are crafted it would be useful if
the names of any relevant transforms were listed after the message so I
would know what to do.

For example you could have a --verbose option that gives hints, so
instead of just

aligned_storage.hpp:160: trailing whitespace

you could say:

aligned_storage.hpp:160: [L001] trailing whitespace
        -fix1: vera++ -transform trim_right aligned_storage.hpp
        -fix2: vera++ -transform som_other_transform
aligned_storage.hpp

Actually the reason I suggested that was because I got the message about
tabs and could not find a transform to fix it, even though I expected
there to be one. I assume that you just haven't gotten around to that
one yet :)

Also I have used eclipse in the past for Java programming and that IDE
does an incredible job at suggesting corrections and applying them. The
IDE puts an icon next to a line if there is a syntax error or if there
is a code analysis rule (like a vera++ rule) that is broken at the line.
When you right click on the icon you can choose from a list of possible
actions to fix the problem.

I do not know of a c++ editor or IDE with this feature but I think that
if Vera++ can provide a consistent syntax for listing suggestions then
authors of editors could write plug-ins for it (or maybe I am just
dreaming).

Actually the Java tool lets you put special comments in to instruct the
analyzer to ignore messages on the next statement. For your program it
could be something like:

//@ignore_rule L001

That makes sure the analyzer doesn't flag it as a warning and it lets
any other reader know that you deliberately chose to break convention
for some reason.

I'm just putting that out there. :-)

-- John


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk