Esempio n. 1
0
def ooSummary(data):
    text = md.h2("Object Oriented Design Summary")
    tableData = [["module", "WMC", "DIT", "NOC", "CBD"]]
    for module in data:
        tableData.append([module[value] for value in ooFeatures])
    text += md.table(tableData)
    return text
Esempio n. 2
0
def structuralSummary(data):
    text = md.h2("Structural Summary")
    tableData = [["module", "FI", "FO"]]
    for module in data:
        tableData.append([module[value] for value in structuralFeatures])
    text += md.table(tableData)
    return text
Esempio n. 3
0
def proceduralSummary(data):
    text = md.h2("Procedural Summary")
    tableData = [["module", "LOC", "COM", "MVG", "LC", "MC"]]
    for module in data:
        tableData.append([module[value] for value in proceduralFeatures])
    text += md.table(tableData)
    return text
Esempio n. 4
0
def main(coverage):
    text = ""
    subpages = []
    lhit_global, ltot_global = 0, 0

    overallData = [["project", "lines", "functions", "branches"]]
    for project in coverage:
        title = "Test Results - Coverage - " + project
        subsubpages, subresult = createSubpage(project, title)
        lhit, ltot, fhit, ftot, bhit, btot = getCoverage(subresult)
        lhit_global += lhit
        ltot_global += ltot
        overallData += [[
            md.ilink(project, title),
            formatPercent(lhit, ltot),
            formatPercent(fhit, ftot),
            formatPercent(bhit, btot)
        ]]
        subpages += [md.slink(title)]
        subpages += subsubpages

    text += md.h2("Test Report - Coverage Analysis")
    text += createCoverageDonut(project + " - lines", lhit_global, ltot_global)
    text += md.table(overallData)
    return text, subpages
Esempio n. 5
0
def main(wizardFiles):
    title = "Test Report - Wizard"
    overviewData = [["flag", "feature", "success", "failures"]]
    subpages = []
    success = 0
    fail = 0
    for filename in wizardFiles:
        with open(filename, "r") as f:
            featureStates = parseFeatures(
                f
            )  # [ { name, success, fail, tests : { testname: testtext, ... } }, ... ]
            for f in featureStates:
                f["title"] = "{} - {}".format(title, f["name"])
                createSubpage(f)
                success += f["success"]
                fail += f["fail"]
                overviewData += [[
                    md.gr(f["fail"]),
                    md.ilink(f["name"], f["title"]), f["success"], f["fail"]
                ]]
                subpages += [md.slink(f["title"])]

    text = md.h2(title)
    text += createWizardDonut(title + " - Overview", success, fail)
    text += md.table(overviewData)
    return text, subpages
Esempio n. 6
0
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
Esempio n. 7
0
def projectSummary(data, explanation=True):
    text = md.h2("Code Metrics - CCCC - Project Summary")
    text += "> code counters / metrics calculated using CCCC\n"
    if explanation:
        text += "> for explanations, please refer to the detailed report on the "
        text += md.ilink("CCCC report", "ccccreport")
        text += " subpage\n\n"
    tableData = [["metric", "value"]]
    for feature in projectSummaryFeatures:
        tableData.append([feature.replace("_", " "), data[feature]])
    text += md.table(tableData)
    return text
Esempio n. 8
0
def main(filenames):
    data = [["flag", "component", "success", "warning", "errors"]]
    subpages = []

    errors = 0
    total = 0
    for f in filenames:
        with open(f, "r") as securityFile:
            f = f.replace(".", "_")
            subpage = "Security Result - {}".format(f)
            error, warning, success = createSubpage(securityFile, subpage)
            errors += 1 if error + warning > 0 else 0
            total += 1

            data.append([
                md.gr(error),
                md.ilink(subpage, subpage), success, warning, error
            ])
            subpages.append(slink(subpage))

    result = md.h2("Security Checks")
    result += createOverviewDonut("Modules", errors, total)
    result += md.table(data)
    return result, subpages