[codeface] Re: [PATCH 15/26] Fix feature analysis

  • From: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
  • To: <codeface@xxxxxxxxxxxxx>
  • Date: Thu, 24 Nov 2016 11:41:45 +0100



Am 13/10/2016 um 17:29 schrieb Claus Hunsen:

This patch fixes following error message: "UnboundLocalError: local
variable 'next_features' referenced before assignment".

The routine was working inside a Vagrant development VM, but not on our
Codeface stand-alone workstation.

Signed-off-by: Claus Hunsen <hunsen@xxxxxxxxxxxxxxxxx>
---
 codeface/cluster/cluster.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/codeface/cluster/cluster.py b/codeface/cluster/cluster.py
index f576455..a5844c4 100755
--- a/codeface/cluster/cluster.py
+++ b/codeface/cluster/cluster.py
@@ -333,6 +333,7 @@ def group_feature_lines(file_commit, file_state, 
cmt_list):
         next_line = lines[0]
         next_cmt_id = file_state[str(next_line)]
         curr_features = file_commit.findFeatureList(curr_line)
+        open_features = []
 
     for i in range(0, len(file_state) - 1):
         curr_line = lines[i]
@@ -362,10 +363,12 @@ def group_feature_lines(file_commit, file_state, 
cmt_list):
                                 curr_cmt_id, feature))
                 blk_start[feature] = next_line
                 blk_end[feature] = next_line
+                # collect features that are still open
+                open_features = next_features
 
     # boundary case for open code-blocks or a single line file_state.
     for feature in feature_blks:
-        if feature in next_features:  # Close all open feature blocks
+        if feature in open_features:  # Close all open feature blocks
             feature_blks[feature].append(
                 codeBlock.codeBlock(
                     blk_start[feature], blk_end[feature],

Can you please merge this commit with number 4 in the list? It
effectively eliminates the contribution of this commit. Thanks!

Acked-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>

Other related posts: