def createCCCCSubpage(xml): projectSummaryData = parseProjectSummary(xml) proceduralSummaryData = parseProceduralSummary(xml) ooSummaryData = parseOOSummary(xml) structuralSummaryData = parseStructuralSummary(xml) text = md.h2("Explanations") text += """ > The following code metrics are reported: > > * NOM **number of modules** - the number of non-trivial modules identified by the analyzer > * LOC **lines of code** - the number of non-blank, non-comment lines of code > * COM **lines of comments** - the number of lines of comment > * MVG **McCabe's cyclomatic complexibility number** [wikipedia](https://de.wikipedia.org/wiki/McCabe-Metrik) > * LC **lines of code per lines of comment** > * MC **McCabe's cyclomatic complexibility per lines of comment** > * REJ **rejected lines of code** which the analyzer refused to process > * WMC **weighted methods per class** weight=1, represents the number of methods per class > * DIT **depth of inheritance tree** length of longest path of inheritance ending in this module > * NOC **number of children** number of children which inherit directly from this module > * CBD **coupling between objects** number of modules which are coupled directly to this module (either client or supplier) > * FI **fan-in** number of modules passing information into this module > * FO **fan-out** number of modules into which this module passes information > > For more details, please refer to the CCCC documentation (and output HTML files) """ text += projectSummary(projectSummaryData, False) text += proceduralSummary(proceduralSummaryData) text += ooSummary(ooSummaryData) text += structuralSummary(structuralSummaryData) md.createPage("Code Metrics", "ccccreport", text) return projectSummaryData
def createCoverageSourceFile_pureMD(title, sub): text = "" text += "***full path:*** " + sub["fullpath"] text += "\n\n" text += "***source code:*** " text += "\n\n" text += "~~~~~\n" try: with open(sub["fullpath"], "r") as f: lines = f.readlines() text += formatLine_pureMD("line", "branch", "hits", "code") for idx, line in enumerate(lines): counter = sub["DA"][ idx + 1] if "DA" in sub and idx + 1 in sub["DA"] else " " branchData = sub["BRDA"][ idx + 1] if "BRDA" in sub and idx + 1 in sub["BRDA"] else "" while len(branchData) > 6: text += formatLine_pureMD(idx + 1, branchData[:6], "", "") branchData = branchData[6:] text += formatLine_pureMD(idx + 1, branchData, counter, line) except Exception as e: text = "exception occoured creating page:" text += str(e) text += "~~~~~\n\n" md.createPage(title, title, text)
def createSubpage(f): text = md.h2("Overview") text += createWizardDonut(f["name"] + " - Overview", f["success"], f["fail"]) for testName in f["tests"]: text += md.h2("Test Result - " + testName) text += "\n" text += "~~~~~{.txt}\n" text += f["tests"][testName] text += "~~~~~\n\n" md.createPage(f["title"], f["title"], text)
def createSubpage(f, subpage): log, error, warning, success = parseResults(f) text = md.h2(subpage) text += createDetailDonut(subpage, error, warning, success) text += md.h2("Complete Log") text += "\n" text += "~~~~~{.txt}" text += log text += "~~~~~" md.createPage(subpage, subpage, text) return error, warning, success
def createSubpage(project, title): text = "" subpages = [] results, total = importCoverage(project) lhit, ltot, fhit, ftot, bhit, btot = getCoverage(total) projectData = [["folder", "lines", "functions", "branches"]] projectData += [[ folder, folderSum(results[folder], "L"), folderSum(results[folder], "FN"), folderSum(results[folder], "BR") ] for folder in results] text += md.h2("Overview") text += createCoverageDonut("lines", lhit, ltot) text += createCoverageDonut("functions", fhit, ftot) text += createCoverageDonut("branches", bhit, btot) text += md.table(projectData) for folder in results: resultFolder = results[folder] sourceData = [["file", "lines", "functions", "branches"]] for f in resultFolder: lhit, ltot, fhit, ftot, bhit, btot = getCoverage(resultFolder[f]) sourceData += [[ md.ilink(f, "Coverage of " + f), formatPercent(lhit, ltot), formatPercent(fhit, ftot), formatPercent(bhit, btot) ]] text += md.h2(folder) text += md.table(sourceData) for f in resultFolder: createCoverageSourceFile_pureMD("Coverage of " + f, resultFolder[f]) subpages.append(md.slink("Coverage of " + f)) md.createPage(title, title, text) return subpages, total
except Exception as e: text += md.h2( "{} - Exception Occoured".format( module.__name__ )) text += "\n\n~~~~~\n" text += traceback.format_exc() text += "\n~~~~~\n" traceback.print_exc() return text, subpages text, subpages = runModule( unit, args.unit, text, subpages ) text, subpages = runModule( wizard, args.wizard, text, subpages ) text, subpages = runModule( lcov, args.lcov, text, subpages ) text, subpages = runModule( cppcheck, args.cppcheck, text, subpages ) text, subpages = runModule( valgrind, args.valgrind, text, subpages ) text, subpages = runModule( security, args.sec, text, subpages ) text, subpages = runModule( environment, args.env, text, subpages ) text, subpages = runModule( logs, args.log, text, subpages ) text, subpages = runModule( cccc, args.cccc, text, subpages ) #### create subpages section (cleaning up TOC) text += "\n\n" text += "**See also:**\n\n" text += md.slink( "testreportsub" ) subpagetext = "" for subpage in subpages: subpagetext += " * {}\n".format( subpage ) md.createPage( "Test Report - Subpages", "testreportsub", subpagetext ) md.createPage( "Test Report", "testreport", text )