Menu

Htmlreport checkboxes are broken with MISRA plugin

2022-03-25
2022-08-31
  • Cilyan Olowen

    Cilyan Olowen - 2022-03-25

    My issue is the in the HTML pages produced by cppcheck-htmlreport, the scripts to filter the issues are broken.
    I was using cppcheck 2.2 and I thought it was because the version was too old, but now that I've update to cppcheck 2.7 I see the issue is the same.

    The problem is reported by Firefox and Chrome in the same way:

    index.html:54 Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Document': '.misra-c2012-11.4' is not a valid selector.

    As you can see, I am using the MISRA plugin and the error tags contain a dot. When htmlreport produces its output, it uses this tag as CSS classes and it is illegal to use a dot there. As such, the javascript doesn't succeed to select properly the issues to filter.

     
  • Robert Zickler

    Robert Zickler - 2022-08-31

    I can confirm.

    I used the following as a makeshift solution on the html output for the MISRA C rules:

    sed -i 's/misra-c2012-\([[:digit:]]\+\)./misra-c2012-\1_/g' your_html_folder_name/*
    

    It will replace e. g. 'misra-c2012-8.9' with 'misra-c2012-8_9'. In fact, the '9' in this case will not even be touched. Just the point before.

    But, there is definitely a fix needed for this. I think there could be other characters that will produce the same error. I encountered it with colon (:), too.

     

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.