- Don't use list comprehension only for the side effects, instead use a normal for loop Signed-off-by: Mitchell Joblin <mitchell.joblin.ext@xxxxxxxxxxx> --- codeface/VCS.py | 7 +++---- codeface/cluster/cluster.py | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/codeface/VCS.py b/codeface/VCS.py index ed5566a..2c1d1d7 100644 --- a/codeface/VCS.py +++ b/codeface/VCS.py @@ -1063,10 +1063,9 @@ class gitVCS (VCS): # save the implementation for each function rmv_char = '[.{}();:\[\]]' - [file_commit.addFuncImplLine(lineNum, - re.sub(rmv_char, ' ',srcLine.strip())) - for lineNum, srcLine in enumerate(file_layout_src)] - + for line_num, src_line in enumerate(file_layout_src): + src_line_rmv = re.sub(rmv_char, ' ', src_line.strip()) + file_commit.addFuncImplLine(line_num, src_line_rmv) def cmtHash2CmtObj(self, cmtHash): ''' diff --git a/codeface/cluster/cluster.py b/codeface/cluster/cluster.py index 1536e54..350bcd6 100755 --- a/codeface/cluster/cluster.py +++ b/codeface/cluster/cluster.py @@ -1151,9 +1151,9 @@ def computeLogicalDepends(fileCommit_list, cmt_dict, start_date): # Compute the number of lines of code changed for each dependency. # We captured the function dependency on a line by line basis above # now we aggregate the lines that change one function - [func_depends_count[cmt_id].extend([(func_id, len(list(group))) \ - for func_id, group in itertools.groupby(sorted(depend_list))]) \ - for cmt_id, depend_list in func_depends.iteritems()] + for cmt_id, depend_list in func_depends.iteritems(): + for func_id, group in itertools.groupby(sorted(depend_list)): + func_depends_count[cmt_id].extend([(func_id, len(list(group)))]) return func_depends_count -- 2.1.0