@@ -32,7 +32,7 @@ class Cloc(Analyzer):
32
32
This class allows to call Cloc over a file, parses
33
33
the result of the analysis and returns it as a dict.
34
34
"""
35
- version = '0.2.0 '
35
+ version = '0.2.1 '
36
36
37
37
def __analyze_file (self , message ):
38
38
"""Add information about LOC, blank and commented lines using CLOC for a given file
@@ -52,11 +52,8 @@ def __analyze_file(self, message):
52
52
for line in message .strip ().split ("\n " ):
53
53
if flag :
54
54
if not line .startswith ("-----" ):
55
- digested = " " .join (line .split ())
56
- info_file = digested .split (" " )
57
- blank_lines = int (info_file [2 ])
58
- commented_lines = int (info_file [3 ])
59
- loc = int (info_file [4 ])
55
+ file_info = line .split ()[- 3 :]
56
+ blank_lines , commented_lines , loc = map (int , file_info )
60
57
results ["blanks" ] = blank_lines
61
58
results ["comments" ] = commented_lines
62
59
results ["loc" ] = loc
@@ -83,14 +80,12 @@ def __analyze_repository(self, message):
83
80
if line .lower ().startswith ("sum" ):
84
81
break
85
82
elif not line .startswith ("-----" ):
86
- digested = " " .join (line .split ())
87
- info_file = digested .split (" " )
88
- blank_lines = int (info_file [2 ])
89
- commented_lines = int (info_file [3 ])
90
- loc = int (info_file [4 ])
91
- language = info_file [0 ]
83
+ digested_split = line .split ()
84
+ langauge , files_info = digested_split [:- 4 ], digested_split [- 4 :]
85
+ language = " " .join (langauge )
86
+ total_files , blank_lines , commented_lines , loc = map (int , files_info )
92
87
language_result = {
93
- "total_files" : int ( info_file [ 1 ]) ,
88
+ "total_files" : total_files ,
94
89
"blanks" : blank_lines ,
95
90
"comments" : commented_lines ,
96
91
"loc" : loc
0 commit comments