Menu

htmlreport: parsing multiple XML files

2019-12-23
2020-09-24
  • Lionel Gimbert

    Lionel Gimbert - 2019-12-23

    A bit of context: I use cppcheck through cmake with the CMAKE_CXX_CPPCHECK variable. It cause cmake to call cppcheck for every file it compiles.
    The main advandage is that includes and defines send to the compiler are also sent to cppcheck.
    The drawback is that cppcheck is call for each file and not for the whole project so I get as many xml files as source files. (And of course warning such as unusedFunction are irrelevant).

    For now I "hacked" my way by merging all the xml files into a big one but it is not a very satisfyng solution. And it is far from perfect since issues from headers are duplicated as many times as the header is included.

    The evolutions I have in mind for the htmlreports would be:
    allow multiple "--file" parameters
    add a "--xml-dir"

    After the xml-parsing a duplicate removal will probably be needed.

    There will also be the behaviour of reading from stdin to be clarified: does sending multiple xml files to stdin allowed ("cat xml-report/* | htmlreports").
    With current version it reports junk when starting parsing the second file. (I also had to comment a option parser error complaining about the lack of "--file" option).

    Tell me if it's an evolution that might interest other people. Python is not my main programming language but I can try to have a go at this change.

     
  • Jose Luis

    Jose Luis - 2020-09-24

    Today I've experienced this situation and tested this options too.

    Finally, I've implemented the support for multiple xml files and I've also fixed the bug parsing the stdin.

    Now, You can parse one or several files or the standard input (with just ONE xml).

    I attach my proposed patch.

     
  • Daniel Marjamäki

    thanks! I wonder if you can open a github pull request instead that would be best for us.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.