def generate_csv_with_all_history(repositories, commits, filename, all_data):
    """Generate CSV file with all history data."""
    with open(filename, 'w') as fout:
        writer = csv.writer(fout)
        writer.writerow(get_csv_header(repositories))
        writer.writerow(get_date_row(repositories))

        for commit in commits:
            commit_date = history_generator.get_commit_date(commit[1])
            row = get_repodata_row_for_commit(commit_date, repositories, all_data)
            writer.writerow(row)
def read_code_coverage_history(hist_repo, commits, repo_to_measure):
    """Read code coverage history for the selected repository."""
    git_utils.checkout(hist_repo, "master")
    hist_repo = git_utils.update_repository_name(hist_repo)
    filename = get_filename_with_coverage(hist_repo, repo_to_measure)

    code_coverage_history = []

    # checkout to every commit and read the code coverage statistic
    for commit in commits:
        commit_hash = commit[0]
        commit_date = history_generator.get_commit_date(commit[1])
        git_utils.checkout(hist_repo, commit_hash)
        summary = read_summary(filename)
        if summary is not None:
            summary["date"] = commit_date
            code_coverage_history.append(summary)

    return code_coverage_history
def generate_graph_with_all_history(repositories, commits, filename, title, all_data,
                                    starting_date):
    """Generate graph with the whole history of common issues/dead code for all repositories."""
    history = []
    ignore_old_commits = True

    for commit in commits:
        commit_date = history_generator.get_commit_date(commit[1])
        if commit_date == starting_date:
            ignore_old_commits = False

        if not ignore_old_commits:
            total, issues, correct = summary_for_commit(commit_date, repositories, all_data)
            history.append({"date": commit_date,
                            "total_files": total,
                            "files_with_issues": issues})

    history_generator.draw_graph(title, filename, history,
                                 plot_common_series_to_graph)
예제 #4
0
def read_code_coverage_history(hist_repo, commits, repo_to_measure):
    """Read code coverage history for the selected repository."""
    git_utils.checkout(hist_repo, "master")
    hist_repo = git_utils.update_repository_name(hist_repo)
    filename = get_filename_with_coverage(hist_repo, repo_to_measure)

    code_coverage_history = []

    # checkout to every commit and read the code coverage statistic
    for commit in commits:
        commit_hash = commit[0]
        commit_date = history_generator.get_commit_date(commit[1])
        git_utils.checkout(hist_repo, commit_hash)
        summary = read_summary(filename)
        if summary is not None:
            summary["date"] = commit_date
            code_coverage_history.append(summary)

    return code_coverage_history
def read_history(hist_repo, commits, repo_to_measure, summary_postfix, summary_pattern,
                 checks_passed_prefix, checks_passed_pattern,
                 get_filename_function):
    """Read dead code history for the selected repository."""
    git_utils.checkout(hist_repo, "master")
    hist_repo = git_utils.update_repository_name(hist_repo)
    filename = get_filename_function(hist_repo, repo_to_measure)

    history = []

    # checkout to every commit and read the code coverage statistic
    for commit in commits:
        commit_hash = commit[0]
        commit_date = history_generator.get_commit_date(commit[1])
        git_utils.checkout(hist_repo, commit_hash)
        summary = read_summary(filename, summary_postfix, summary_pattern, checks_passed_prefix,
                               checks_passed_pattern)
        if summary is not None:
            summary["date"] = commit_date
            history.append(summary)

    return history
def read_history(hist_repo, commits, repo_to_measure, summary_postfix, summary_pattern,
                 checks_passed_prefix, checks_passed_pattern,
                 get_filename_function):
    """Read dead code history for the selected repository."""
    git_utils.checkout(hist_repo, "master")
    hist_repo = git_utils.update_repository_name(hist_repo)
    filename = get_filename_function(hist_repo, repo_to_measure)

    history = []

    # checkout to every commit and read the code coverage statistic
    for commit in commits:
        commit_hash = commit[0]
        commit_date = history_generator.get_commit_date(commit[1])
        git_utils.checkout(hist_repo, commit_hash)
        summary = read_summary(filename, summary_postfix, summary_pattern, checks_passed_prefix,
                               checks_passed_pattern)
        if summary is not None:
            summary["date"] = commit_date
            history.append(summary)

    return history