[Cdash] Adding support for "Krazy" code checker to cdash ?

Alexander Neundorf neundorf at kde.org
Sun Mar 28 16:57:29 UTC 2010


Hi,

in KDE we have a tool called "krazy" which does some checks on our code 
(http://techbase.kde.org/Development/Tutorials/Code_Checking). The results 
can currently be seen at 
http://www.englishbreakfastnetwork.org/krazy/index.php?component=kde-4.x 

It would be nice if krazy could be used also together with cdash, i.e. so that 
the problems reported by krazy appear the same way as e.g. compiler warnings.

So, I've got two questions:

1) how would I integrate krazy-checks into a nightly build ?
My nightly-script basically does:

ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}")
ctest_start(Nightly)
ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}" )
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE ret)
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE ret)
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" )
ctest_submit()

Where would krazy come into play ?
krazy can be executed like this: $ krazy2all <dir>
and then it will check all files it finds in the directory <dir> and below.
Where/how would I add this call into the nightly-script ?



2) What is necessary so that cdash can recognize the reported errors in krazy 
output ?
The output currently supports multiple formats:

-------------8<-------------------------8<-----------------------8<--------

==>For File Type c++<==
1. Check for TRUE and FALSE macros [captruefalse]... 1 issue found
        ./src/board.cpp: using TRUE line#707 (1)
        The TRUE and FALSE macros are obsolete and should be replaced with
        true and false (all lower case) respectively.

2. Check for methods that return 'const' refs in public classes [constref]... 
Ok!

3. Check for an acceptable copyright [copyright]... Ok!

4. Check for cpp macros and usage [cpp]... Ok!

5. Check for code that should be considered crashy. [crashy]... Ok!

6. Check single-char QString operations for efficiency [doublequote_chars]... 
Ok!

7. Check for unwanted doxygen tags in major versions [doxytags]... Ok!

8. Check public classes with private members or d-pointer issues [dpointer]... 
Ok!

9. Check for QString compares to "" [emptystrcompare]... Ok!

10. Check that file ends with a newline [endswithnewline]... 1 issue found
        ./src/board.cpp: line# 714 (1)
        Files that do not end with a newline character can cause problems.
        Please add a newline character to the end of the file.

11. Check for C++ ctors that should be declared 'explicit' [explicit]... Ok!


-------------8<-------------------------8<-----------------------8<--------

Or, alternatively, the following:  

src/board.cpp:707:using TRUE, TRUE and FALSE macros
src/board.cpp: 714:that file ends with a newline

-------------8<-------------------------8<-----------------------8<--------

or, XML (shortened):

  <check desc="Check that file ends with a newline [endswithnewline]...">
     <file name="src/board.cpp">
       <issues>
          <line>714</line>
        </issues>
     </file>
      <explanation>Files that do not end with a newline character can cause 
problems. Please add a newline character to the end of the file.
      </explanation>
   </check>


Maybe the second format might be already usable for cdash ?


Alex



More information about the CDash mailing list