Menu

htmlreport - Statistics: missing severities

2019-10-28
2019-10-30
  • Lionel Gimbert

    Lionel Gimbert - 2019-10-28

    Hello,

    (I don't have a Trac account so I couln't create a ticket directly there).

    If I generate an html report, the statistics page stop at the last severity with a non zero count.

    I think there is an error in the code below (htmlreport/cppcheck-htmlreport line 669)

            for sev in SEVERITIES:
                _sum = 0
                stats_templist = {}
    
                # if the we have an style warning but we are checking for
                # portability, we have to skip it to prevent KeyError
                try:
                    for filename in stats_countlist:
                        try:  # also bail out if we have a file with no sev-results
                            _sum += stats_countlist[filename][sev]
                            stats_templist[filename] = (int)(stats_countlist[filename][sev])  # file : amount,
                        except KeyError:
                            continue
                    # don't print "0 style" etc, if no style warnings were found
                    if (_sum == 0):
                        break
                except KeyError:
                    continue
                stats_file.write("<p>Top 10 files for " + sev + " severity, total findings: " + str(_sum) + "</br>\n")
    

    Where

                    if (_sum == 0):
                        break
    

    breaks from the loop

            for sev in SEVERITIES:
    

    instead of continuing to the next severity.

    I changed the break for a continue and it did works fine.

     
  • versat

    versat - 2019-10-30

    Yes, that looks wrong.
    Thanks for reporting this.
    I try to bring back htmlreport testing in travis and fix this issue.

     

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.