Exemple #1
0
    p.ignored_dirs = [
        '.git', '.settings', '.idea', '.classpath', 'bin', 'media/uploads',
        'media/serve', 'lib/debug_toolbar', 'static/tiny_mce',
        'static/js/tiny_mce', 'static/admin'
    ]

    params = {
        'width': 600,
        'height': 600,
        'pname': p.name,
        'data': '{}',
    }

    if plot_type == 'pie':
        hnd = LocCounter2()
        p.rescan_files(hnd)
        data = hnd.get_data()
        params['data'] = json.dumps(data)
        params['max_level'] = 6
        params[
            'initial_description'] = '{0} characters, {1} lines of code.'.format(
                data[1], data[2])
        html_template = 'pie_report.html'
    elif plot_type == 'tree':
        hnd = LocCounter()
        p.rescan_files(hnd)
        params['data'] = json.dumps(hnd.get_data())
        html_template = 'tree_report.html'
    else:
        print 'Error: Invalid output type.'
        sys.exit(1)
Exemple #2
0
    # configs
    PROJECTS_PATH = '/data/code/android'
    projects = [
        'github-android', 'linphone-android', 'vlc/vlc-android',
        'mytracks/MyTracks'
    ]
    exts = ['java', 'xml', 'c']

    for project_dir in projects:
        project_dir = os.path.join(PROJECTS_PATH, project_dir)
        print '========================='
        print ' Project Analysis Report '
        print '========================='
        print '  path:', project_dir
        p = Project(project_dir)
        p.rescan_files()
        print '  Total number of files:', len(p._files)
        print '  File type breakdown:'
        TR = len(p._files) / 10
        for ext in p.file_extensions:
            files = p.filter_files(extension=ext)
            ext_name = ext if ext else '""'
            loc = 0
            if ext in exts:
                for f in files:
                    loc += p.get_file(f).lines_count
            if loc or len(files) >= TR:
                print '   ', ext_name, '  \t', len(
                    files), ' \t', loc if loc else 'N/A'
        print ""
        ".idea",
        ".classpath",
        "bin",
        "media/uploads",
        "media/serve",
        "lib/debug_toolbar",
        "static/tiny_mce",
        "static/js/tiny_mce",
        "static/admin",
    ]

    params = {"width": 600, "height": 600, "pname": p.name, "data": "{}"}

    if plot_type == "pie":
        hnd = LocCounter2()
        p.rescan_files(hnd)
        data = hnd.get_data()
        params["data"] = json.dumps(data)
        params["max_level"] = 6
        params["initial_description"] = "{0} characters, {1} lines of code.".format(data[1], data[2])
        html_template = "pie_report.html"
    elif plot_type == "tree":
        hnd = LocCounter()
        p.rescan_files(hnd)
        params["data"] = json.dumps(hnd.get_data())
        html_template = "tree_report.html"
    else:
        print "Error: Invalid output type."
        sys.exit(1)

    with open(os.path.join(current_dir, "report_templates", html_template), "r") as f:
from inspector.models.base import Project

if __name__ == "__main__":
    # configs
    PROJECTS_PATH = "/data/code/android"
    projects = ["github-android", "linphone-android", "vlc/vlc-android", "mytracks/MyTracks"]
    exts = ["java", "xml", "c"]

    for project_dir in projects:
        project_dir = os.path.join(PROJECTS_PATH, project_dir)
        print "========================="
        print " Project Analysis Report "
        print "========================="
        print "  path:", project_dir
        p = Project(project_dir)
        p.rescan_files()
        print "  Total number of files:", len(p._files)
        print "  File type breakdown:"
        TR = len(p._files) / 10
        for ext in p.file_extensions:
            files = p.filter_files(extension=ext)
            ext_name = ext if ext else '""'
            loc = 0
            if ext in exts:
                for f in files:
                    loc += p.get_file(f).lines_count
            if loc or len(files) >= TR:
                print "   ", ext_name, "  \t", len(files), " \t", loc if loc else "N/A"
        print ""