当前位置: 首页>>代码示例>>Python>>正文


Python LongBow.scorePrinter方法代码示例

本文整理汇总了Python中LongBow.scorePrinter方法的典型用法代码示例。如果您正苦于以下问题:Python LongBow.scorePrinter方法的具体用法?Python LongBow.scorePrinter怎么用?Python LongBow.scorePrinter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LongBow的用法示例。


在下文中一共展示了LongBow.scorePrinter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: textFunctionResult

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def textFunctionResult(file, function, maxFileNameLength, maxFunctionNameLength):
	score = computeComplexityScore(function.cyclomatic_complexity)
	format = "%-" + str(maxFileNameLength) + "s %-" + str(maxFunctionNameLength) + "s %6d %2d %6.2f"
	string = format % (file.filename, function.name, function.start_line, function.cyclomatic_complexity, score)

	LongBow.scorePrinter([90, 80], score, string)
	return function.cyclomatic_complexity
开发者ID:isolis,项目名称:LongBow,代码行数:9,代码来源:longbow-complexity-report.py

示例2: textFileVocabulary

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def textFileVocabulary(file, maxFileNameLength, printFormat=""):
	score = computeVocabularyScore(file.average_CCN)
	if printFormat == "":
		printFormat = "%-" + str(maxFileNameLength) + "s %6.2f %6.2f"
	string =  printFormat % (file.filename, file.average_token, score)
	LongBow.scorePrinter([90, 80], score, string)
	return
开发者ID:isolis,项目名称:LongBow,代码行数:9,代码来源:VocabularyReport.py

示例3: textSummary

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def textSummary(args, filesAndTests, gCovResults, prefix=""):

    summary = GCov.computeSummary(filesAndTests, gCovResults)

    if not args.includeTestSources:
        summary = GCovSummary.removeTestSourceFiles(summary)

    if len(summary) == 0:
        return

    if args.explain:
        pp = pprint.PrettyPrinter(indent=2, width=150)
        pp.pprint(summary)

    maximumFileLength = max(map(lambda entry: len(entry), summary))

    format = "%s%-" + str(maximumFileLength) + "s %6s"
    print format % (prefix, "File Path", "Score")

    format = "%s%-" + str(maximumFileLength) + "s %6.2f"
    for testedFile in sorted(summary.keys()):
        string = format % (prefix, testedFile, summary[testedFile]["coverage"])
        if summary[testedFile]["direct"] == "indirect":
            ANSITerm.printColorized("magenta", string)
        else:
            LongBow.scorePrinter(eval(args.distribution), summary[testedFile]["coverage"], string)

    return
开发者ID:PARC,项目名称:LongBow,代码行数:30,代码来源:CoverageReport.py

示例4: csvSummary

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def csvSummary(distribution, documentation):
        formatString ="documentation,%s,%d,%d,%.2f%%"
        for entry in documentation:
            badLines = len(documentation[entry])
            totalLines =  LongBow.countLines(entry)
            score = float(totalLines - badLines) / float(totalLines) * 100.0
            LongBow.scorePrinter(distribution, score, formatString % (entry, totalLines, badLines, score))
        return
开发者ID:PARC,项目名称:LongBow,代码行数:10,代码来源:longbow-doxygen-report.py

示例5: textScore

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def textScore(distribution, report, maxFileNameLength, prefix=""):
    '''

    '''
    format = "%s%-*s %6d %6d %6.2f"
    string = format % (prefix, maxFileNameLength, report["fileName"], report["totalLines"], report["nonCompliantLines"], report["score"])
    LongBow.scorePrinter(distribution, report["score"], string)
    return
开发者ID:PARC,项目名称:LongBow,代码行数:10,代码来源:StyleReport.py

示例6: gradeAndPrint

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def gradeAndPrint(targets, problemsOnly=False, printPrefix=""):
    if len(targets) < 1:
        print "No Files To Grade"
        return

    distribution = [99, 90]
    maxFileNameLength = max(max(map(lambda target: len(target), targets)), len("File Name"))

    moduleConformanceSet = ModuleSetConformanceContainer()
    headers = getConformanceHeaders()
    pformat = '{prefix}{:<{maxFileNameLength}}'
    nformat = pformat
    for header in headers:
        nformat = nformat + '{:>15}'
    print nformat.format('File Name', *headers, prefix=printPrefix, maxFileNameLength=maxFileNameLength)


    for target in targets:
        module = Module(target)
        if module.isTestSourceName():
            continue
        fileNamePrefix = module.getModuleName()
        path = module.getModulePath()
        try:
            moduleConformance = computeModuleConformance(path, fileNamePrefix)
            if not moduleConformance.processModule():
                pass
            else:
                moduleConformanceSet.addConformanceContainer(moduleConformance)
                scores = moduleConformance.getScores()
                minScore = 100.0
                for key in scores:
                    score = scores[key]
                    if score < minScore:
                        minScore = score
                    scores[key] = '%3.1f'%score
                if problemsOnly and minScore == 100.0:
                    continue
                printVals=[]
                for hval in headers:
                    score = 'N/A'
                    if hval in scores:
                        score = scores[hval]
                    printVals.append(score)
                line = nformat.format(target, *printVals, prefix=printPrefix, maxFileNameLength=maxFileNameLength)
                LongBow.scorePrinter(distribution, minScore, line)
        except NoObjectFileException as e:
            eformat = pformat + "Could Not Grade: No .o file found for file"
            line =  eformat.format(target, prefix=printPrefix, maxFileNameLength=maxFileNameLength, msg=e)
            print LongBow.buildRed(line)
            pass
        except Exception as e:
            eformat = pformat + "Could Not Grade: {msg}"
            line =  eformat.format(target, prefix=printPrefix, maxFileNameLength=maxFileNameLength, msg=e)
            print LongBow.buildRed(line)
            pass
    moduleConformanceSet.analyzeConformance()
开发者ID:isolis,项目名称:LongBow,代码行数:59,代码来源:NameReport.py

示例7: csvAverage

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def csvAverage(args, filesAndTests, gcovResults):
    summary = GCov.computeSummary(filesAndTests, gcovResults)

    if not args.includeTestSources:
        summary = GCovSummary.removeTestSourceFiles(summary)

    score = GCovSummary.averageCoverage(summary)

    LongBow.scorePrinter(eval(args.distribution), score, "%.2f" % (score))
    return
开发者ID:PARC,项目名称:LongBow,代码行数:12,代码来源:CoverageReport.py

示例8: csvSummary

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def csvSummary(args, filesAndTests, gCovResults):
    summary = GCov.computeSummary(filesAndTests, gCovResults)

    if not args.includeTestSources:
        summary = GCovSummary.removeTestSourceFiles(summary)

    if len(summary) > 0:
        for testedFile in sorted(summary.keys()):
            outputString = "%s,%.2f" % (testedFile, summary[testedFile]["coverage"])
            LongBow.scorePrinter(eval(args.distribution), summary[testedFile]["coverage"], outputString)

    return
开发者ID:PARC,项目名称:LongBow,代码行数:14,代码来源:CoverageReport.py

示例9: textualSummary

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def textualSummary(distribution, documentation):
    maxWidth = 0
    for entry in documentation:
        if len(entry) > maxWidth:
            maxWidth = len(entry)

    formatString ="%-" + str(maxWidth) + "s %8d %8d   %.2f%%"
    for entry in documentation:
        badLines = len(documentation[entry])
        totalLines =  LongBow.countLines(entry)
        score = float(totalLines - badLines) / float(totalLines) * 100.0
        LongBow.scorePrinter(distribution, score, formatString % (entry, totalLines, badLines, score))
    return
开发者ID:PARC,项目名称:LongBow,代码行数:15,代码来源:longbow-doxygen-report.py

示例10: textualAverage

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def textualAverage(distribution, documentation, format):
    sum = 0.0

    for entry in documentation:
        badLines = len(documentation[entry])
        totalLines =  LongBow.countLines(entry)
        score = float(totalLines - badLines) / float(totalLines) * 100.0
        sum = sum + score

    if len(documentation) == 0:
        averageScore = 100.0
    else:
        averageScore = sum / float(len(documentation))

    LongBow.scorePrinter(distribution, averageScore, format % averageScore)
开发者ID:PARC,项目名称:LongBow,代码行数:17,代码来源:longbow-doxygen-report.py

示例11: gradeAndPrint

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def gradeAndPrint(targets, testDirs=[], problemsOnly=False, prefix=""):
    filesAndTests = getFilesAndTests(targets, testDirs)
    newGCovResults = map(lambda fileAndTestFile: GCov.getCoverage(fileAndTestFile[1]), filesAndTests)

    summarys = GCov.computeSummary(filesAndTests, newGCovResults)
    if len(summarys) < 1:
        print "%sNo GCov Results - Please be sure to run 'make check' first" % prefix
        return False
    summarys = GCovSummary.removeTestSourceFiles(summarys)

    paths = summarys.keys()
    if problemsOnly:
        paths = filter(lambda key: summarys[key]["coverage"] < 100, paths)

    distribution=[99,90]
    maximumFileLength = max(map(lambda entry: len(os.path.relpath(entry)), paths))
    format = "%s%-" + str(maximumFileLength) + "s %6s"
    print format % (prefix, "File Path", "Score")
    format = "%s%-" + str(maximumFileLength) + "s %6.2f"
    for path in sorted(paths):
        string = format % (prefix, os.path.relpath(path), summarys[path]["coverage"])
        LongBow.scorePrinter(distribution, summarys[path]["coverage"], string)

    return True
开发者ID:PARC,项目名称:LongBow,代码行数:26,代码来源:CoverageReport.py

示例12: csvFileComplexity

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def csvFileComplexity(file):
	score = computeComplexityScore(file.average_CCN)
	string = "complexity,%s,,,%.2f,%.2f" % (file.filename, file.average_CCN, score)
	LongBow.scorePrinter([90, 80], score, string)
	return
开发者ID:isolis,项目名称:LongBow,代码行数:7,代码来源:longbow-complexity-report.py

示例13: csvFunctionResult

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def csvFunctionResult(file, function):
	score = computeComplexityScore(function.cyclomatic_complexity)
	string = "complexity,%s,%s,%d,%d,%.2f" % (file.filename, function.name, function.start_line, function.cyclomatic_complexity, score)

	LongBow.scorePrinter([90, 80], score, string)
	return function.cyclomatic_complexity
开发者ID:isolis,项目名称:LongBow,代码行数:8,代码来源:longbow-complexity-report.py

示例14: textAverage

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def textAverage(distribution, complianceList):
    scores = map(lambda target: target.getScore(), complianceList)
    sum = reduce(lambda sum, score : sum + score, scores)
    value = float(sum) / float(len(complianceList))
    LongBow.scorePrinter(distribution, value, "%.2f" % (value))
    return
开发者ID:PARC,项目名称:LongBow,代码行数:8,代码来源:StyleReport.py

示例15: csvFileVocabulary

# 需要导入模块: import LongBow [as 别名]
# 或者: from LongBow import scorePrinter [as 别名]
def csvFileVocabulary(file):
	score = computeVocabularyScore(file.token_count)
	string = "vocabulary,%s,,,%.2f,%.2f" % (file.filename, file.average_token, score)
	LongBow.scorePrinter([90, 80], score, string)
	return
开发者ID:isolis,项目名称:LongBow,代码行数:7,代码来源:VocabularyReport.py


注:本文中的LongBow.scorePrinter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。