pylint/checkers/raw_metrics.py
def report_raw_stats(sect, stats, _):
    """calculate percentage of code / doc / comment / empty
    """
    total_lines = stats["total_lines"]
    if not total_lines:
        raise EmptyReportError()
    sect.description = "%s lines have been analyzed" % total_lines
    lines = ("type", "number", "%", "previous", "difference")
    for node_type in ("code", "docstring", "comment", "empty"):
        key = node_type + "_lines"
        total = stats[key]
        percent = float(total * 100) / total_lines
        lines += (node_type, str(total), "%.2f" % percent, "NC", "NC")
    sect.append(Table(children=lines, cols=5, rheaders=1))
def report_raw_stats(sect, stats, _):
    """calculate percentage of code / doc / comment / empty
    """
    total_lines = stats["total_lines"]
    if not total_lines:
        raise EmptyReportError()
    sect.description = "%s lines have been analyzed" % total_lines
    lines = ("type", "number", "%", "previous", "difference")
    for node_type in ("code", "docstring", "comment", "empty"):
        key = node_type + "_lines"
        total = stats[key]
        percent = float(total * 100) / total_lines
        lines += (node_type, str(total), "%.2f" % percent, "NC", "NC")
    sect.append(Table(children=lines, cols=5, rheaders=1))
def report_raw_stats ( sect , stats , _ ) : total_lines = stats [ "total_lines" ] if not total_lines : raise EmptyReportError ( ) sect . description = "%s lines have been analyzed" % total_lines lines = ( "type" , "number" , "%" , "previous" , "difference" ) for node_type in ( "code" , "docstring" , "comment" , "empty" ) : key = node_type + "_lines" total = stats [ key ] percent = float ( total * 100 ) / total_lines lines += ( node_type , str ( total ) , "%.2f" % percent , "NC" , "NC" ) sect . append ( Table ( children = lines , cols = 5 , rheaders = 1 ) )
calculate percentage of code / doc / comment / empty
calculate percentage of code / doc / comment / empty