def test_aggregate(self): outFileName = "/Users/Tushar/Documents/Research/PuppetQuality/Puppet-lint_aggregator/testOut.csv" outFile = open(outFileName, 'w') outFile.write(CONSTS.HEADER) Aggregator.aggregate("/Users/Tushar/Documents/Research/PuppetQuality/Puppet-lint_aggregator/test1/", "test1", outFile) Aggregator.aggregate("/Users/Tushar/Documents/Research/PuppetQuality/Puppet-lint_aggregator/test2/", "test2", outFile) outFile.close() outReadFile = open(outFileName, 'r') self.assertGreater(len(outReadFile.read()), 0)
def test_aggregate(self): outFileName = "/Users/Tushar/Documents/Research/PuppetQuality/Puppet-lint_aggregator/testOut.csv" outFile = open(outFileName, 'w') outFile.write(CONSTS.HEADER) Aggregator.aggregate( "/Users/Tushar/Documents/Research/PuppetQuality/Puppet-lint_aggregator/test1/", "test1", outFile) Aggregator.aggregate( "/Users/Tushar/Documents/Research/PuppetQuality/Puppet-lint_aggregator/test2/", "test2", outFile) outFile.close() outReadFile = open(outFileName, 'r') self.assertGreater(len(outReadFile.read()), 0)
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.")