[OPEN-ILS-DEV] Integrating automated code analysis tools into
regular practice?
Scott McKellar
mck9 at swbell.net
Fri Nov 23 15:14:58 EST 2007
--- Dan Scott <denials at gmail.com> wrote:
<snip>
> I just ran PMD (a code copy & paste detector from
> http://pmd.sourceforge.net/) against OpenSRF trunk and it found some
> large chunks of duplicated code that we could probably refactor into
> a
> single shared block of code - rationale being that duplicated code is
> eventually likely to have a bug fixed in one place but missed in the
> other. The output is attached.
I looked very briefly at the reported code duplications.
Most of the duplication is between two different version of the
JSON-handling code. Not surprisingly, these two versions have a
lot in common. I don't know what Bill plans to do with the older
version.
I had planned to wade into the newer JSON code, applying my usual
fetishes about const-correctness, static functions, and the like.
However if we're going to abstract out the commonalities between the
new JSON code and the old JSON code, I should hold off on my efforts
so that I can do it just once.
The other duplications are in the patch directory. I've never looked
at this directory before but it appears to contain patched versions
of jabberd code. In the case of nad.c I suspect (but have not
verified) that the duplication occurs because of conditional
compilation -- two similar blocks of code chosen through #ifdefs.
Anyway I don't think we want to mess with jabberd code if we don't
have to.
Scott McKellar
http://home.swbell.net/mck9/ct/
More information about the Open-ils-dev
mailing list