def calculate_complexity_over_range(file_name, revision_range):
	start_rev, end_rev = revision_range
	revs = git_interactions.read_revs_for(file_name, start_rev, end_rev)
	complexity_by_rev = []
	for rev in revs:
		historic_version = git_interactions.read_version_matching(file_name, rev)
		complexity_by_line = complexity_calculations.calculate_complexity_in(historic_version)
		complexity_by_rev.append(as_stats(rev, complexity_by_line))
	return complexity_by_rev
Esempio n. 2
0
def calculate_complexity_over_range(file_name, revision_range):
	start_rev, end_rev = revision_range
	revs = git_interactions.read_revs_for(file_name, start_rev, end_rev)
	complexity_by_rev = []
	for rev in revs:
		historic_version = git_interactions.read_version_matching(file_name, rev)
		complexity_by_line = complexity_calculations.calculate_complexity_in(historic_version)
		complexity_by_rev.append(as_stats(rev, complexity_by_line))
	return complexity_by_rev
def run(args):
    with open(args.file, "r") as file_to_calc:
        complexity_by_line = complexity_calculations.calculate_complexity_in(
            file_to_calc.read())
        stats = desc_stats.DescriptiveStats(args.file, complexity_by_line)
        as_csv(stats)
def run_file(filename, writer):
    with open(filename, "r") as file_to_calc:
        complexity_by_line = complexity_calculations.calculate_complexity_in(
            file_to_calc.read())
        stats = desc_stats.DescriptiveStats(filename, complexity_by_line)
        writer.print_stats(filename, stats)