コード例 #1
0
 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)
コード例 #2
0
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}
コード例 #3
0
 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))
コード例 #4
0
ファイル: testDuplicate.py プロジェクト: terryyin/lizard
 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))