def test_lizard_analyze(self, auto_read): actuals = list(lz.analyze_files([__file__], exts=lz.get_extensions([]))) self.assertEqual(len(actuals), 1) actual = actuals[0] self.assertEqual(4, actual.nloc) self.assertEqual(2.0, actual.average_cyclomatic_complexity)
def runLizard(filenameList): duplicates = DuplicateDetector() cpre = lizardcpre() nd = lizardnd() ns = lizardns() io = lizardio() extensions = lizard.get_extensions([duplicates, cpre, ns, nd, io]) outList = list(lizard.analyze_files(filenameList, exts=extensions)) dupCodeSnips = list( duplicates.get_duplicates(min_duplicate_tokens=MIN_DUP_TOKENS)) dupInfo = { 'duplicates': [dupInfoToDict(d) for d in dupCodeSnips], 'duplicateRate': duplicates.saved_duplicate_rate, 'uniqueRate': duplicates.saved_unique_rate } return {'fileList': outList, 'dupInfo': dupInfo}
def detect(self, source_files, auto_read): auto_read.side_effect = lambda filename: source_files[filename] extensions = get_extensions([self.detector]) list(analyze_files(source_files.keys(), exts=extensions)) return list(self.detector.get_duplicates(30))
def detect(self, source_files, auto_read): auto_read.side_effect = lambda filename: source_files[filename] extensions = get_extensions([self.detector]) list(analyze_files(sorted(source_files.keys()), exts=extensions)) return list(self.detector.get_duplicates(30))