import os import Aggregator from SmellDetector import Constants as CONSTS, Analyzer root = CONSTS.REPO_ROOT print("Initiating Analyzer...") totalRepos = len(os.listdir(root)) currentItem = 0 for item in os.listdir(root): currentFolder = os.path.join(root, item) #print("Anlyzing: " + currentFolder) if not os.path.isfile(currentFolder): Analyzer.analyze(currentFolder, item) currentItem += 1 print( str("{:.2f}".format(float(currentItem * 100) / float(totalRepos))) + "% analysis done.") print("Analyzer - Done.") print("Initiating metrics and smells aggregator...") aggregatedFile = open(root + "/" + CONSTS.AGGREGATOR_FILE, 'wt') aggregatedFile.write(CONSTS.CSV_HEADER) for item in os.listdir(root): currentFolder = os.path.join(root, item) if not os.path.isfile(currentFolder): Aggregator.aggregate(currentFolder, item, aggregatedFile) aggregatedFile.close() print("Metrics and smells aggregator - Done.")
import os import Aggregator from SmellDetector import Constants as CONSTS, Analyzer root = CONSTS.REPO_ROOT print("Initiating Analyzer...") totalRepos = len(os.listdir(root)) currentItem = 0 for item in os.listdir(root): currentFolder = os.path.join(root, item) #print("Anlyzing: " + currentFolder) if not os.path.isfile(currentFolder): Analyzer.analyze(currentFolder, item) currentItem += 1 print (str("{:.2f}".format(float(currentItem * 100)/float(totalRepos))) + "% analysis done.") print("Analyzer - Done.") print("Initiating metrics and smells aggregator...") aggregatedFile = open(root + "/" + CONSTS.AGGREGATOR_FILE, 'wt') aggregatedFile.write(CONSTS.CSV_HEADER) for item in os.listdir(root): currentFolder = os.path.join(root, item) if not os.path.isfile(currentFolder): Aggregator.aggregate(currentFolder, item, aggregatedFile) aggregatedFile.close() print("Metrics and smells aggregator - Done.")
] writer = csv.DictWriter(outputfile, fieldnames=csv_columns) writer.writeheader() for subdirs in os.listdir(projectFolder): #print(">>> subdirs: ", subdirs) if (subdirs != ".DS_Store") and ( subdirs != "AggregatedOutput.csv") and ( subdirs != "Puppeteer_output.txt"): files = os.path.join(projectFolder, subdirs) for item in os.listdir(files): currentFile = os.path.join(files, item) print("Analyzing: " + currentFile) if os.path.isfile(currentFile): resultsMetrics, CONSTS.smellsResults = Analyzer.analyze( projectFolder, currentFile) results = {} results["ecosystem"] = ecosystem results["project"] = project_name results["file"] = item results["commit"] = subdirs results["puppetFileCount"] = resultsMetrics[ currentFile][0] results["totalClasses"] = resultsMetrics[ currentFile][1] results["totalDefines"] = resultsMetrics[ currentFile][2] results["totalFiles"] = resultsMetrics[ currentFile][3] results["totalPackages"] = resultsMetrics[