Menu

xml-reports are missing notes

Epps
2023-08-28
2023-08-29
  • Epps

    Epps - 2023-08-28

    Hello, I noticed that we don't see all finds from CPPCHeck in our CI because all lines of the category "note" don't appear in the XML file.

    Is there a way to force all results to be written to the XML file?

     
  • Daniel Marjamäki

    I don't directly see how to reproduce it. What version do you use?

    The notes should be reported as <location> elements as below:

    Example code:

    void foo(int x) {
        a = 10/x;
        if (!x) {}
    }
    

    textual output:

    1.c:2:8: warning: Either the condition '!x' is redundant or there is division by zero at line 2. [zerodivcond]
     a = 10/x;
           ^
    1.c:3:6: note: Assuming that condition '!x' is not redundant
     if (!x) {}
         ^
    1.c:2:8: note: Division by zero
     a = 10/x;
           ^
    

    xml output:

    <?xml version="1.0" encoding="UTF-8"?>
    <results version="2">
        <cppcheck version="2.12 dev"/>
        <errors>
            <error id="zerodivcond" severity="warning" msg="Either the condition &apos;!x&apos; is redundant or there is division by zero at line 2." verbose="Either the condition &apos;!x&apos; is redundant or there is division by zero at line 2." cwe="369" file0="1.c">
                <location file="1.c" line="2" column="8" info="Division by zero"/>
                <location file="1.c" line="3" column="6" info="Assuming that condition &apos;!x&apos; is not redundant"/>
            </error>
        </errors>
    </results>
    
     
  • Epps

    Epps - 2023-08-29

    That's right, the note data is available as location.
    Sorry, I had misunderstood the XML struture.
    Thanks for looking over it and sorry again.

     

Log in to post a comment.