# Number of warnings and advices
var warnings = new Counter[MPackage]
+ # Number of warnings per 1000 lines of code (w/kloc)
+ var warnings_per_kloc = new Counter[MPackage]
+
# Documentation score (between 0 and 100)
var documentation_score = new Counter[MPackage]
self.loc[mpackage] = loc
self.errors[mpackage] = errors
self.warnings[mpackage] = warnings
+ if loc > 0 then
+ self.warnings_per_kloc[mpackage] = warnings * 1000 / loc
+ end
var documentation_score = (100.0 * doc_score / entity_score).to_i
self.documentation_score[mpackage] = documentation_score
if errors > 0 then
res.add "<li>{errors} errors</li>\n"
end
- res.add "<li>{warnings[mpackage]} warnings</li>\n"
+ res.add "<li>{warnings[mpackage]} warnings ({warnings_per_kloc[mpackage]}/kloc)</li>\n"
res.add "<li>{documentation_score[mpackage]}% documented</li>\n"
res.add "</ul>\n"
res.add "<th data-field=\"score\" data-sortable=\"true\">score</th>\n"
res.add "<th data-field=\"errors\" data-sortable=\"true\">errors</th>\n"
res.add "<th data-field=\"warnings\" data-sortable=\"true\">warnings</th>\n"
+ res.add "<th data-field=\"warnings_per_kloc\" data-sortable=\"true\">w/kloc</th>\n"
res.add "<th data-field=\"doc\" data-sortable=\"true\">doc</th>\n"
res.add "</tr></thead>"
for p in mpackages do
res.add "<td>{score[p]}</td>"
res.add "<td>{errors[p]}</td>"
res.add "<td>{warnings[p]}</td>"
+ res.add "<td>{warnings_per_kloc[p]}</td>"
res.add "<td>{documentation_score[p]}</td>"
res.add "</tr>\n"
end