[codeface] [PATCH 10/12] Fix for LinkType.file.

  • From: Matthias Dittrich <matthi.d@xxxxxxxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx
  • Date: Wed, 19 Nov 2014 21:40:29 +0100

When link_type is file we have no funcId entries and we default back to 
File_Level.

Signed-off-by: Matthias Dittrich <matthi.d@xxxxxxxxx>
---
 codeface/fileCommit.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/codeface/fileCommit.py b/codeface/fileCommit.py
index 6474669..3d01e3c 100644
--- a/codeface/fileCommit.py
+++ b/codeface/fileCommit.py
@@ -138,7 +138,10 @@ class FileCommit:
         return self.revCmts
 
     def getFuncImpl(self,id):
-        return self.functionImpl[id]
+        if id in self.functionImpl:
+            return self.functionImpl[id]
+        else:
+            return []
 
     def setFunctionLines(self, functionIds):
         self.functionIds.update(functionIds)
@@ -164,8 +167,10 @@ class FileCommit:
                 func_id = self.functionIds[line_num]
         else:
             i = bisect.bisect_right(self.functionLineNums, line_num)
-            func_line = self.functionLineNums[i-1]
-            func_id = self.functionIds[func_line]
+            if i in self.functionLineNums:
+                func_line = self.functionLineNums[i-1]
+                if func_line in self.functionIds: # on 'file' tagging we have 
no entries
+                    func_id = self.functionIds[func_line]
         return func_id
 
     def getLineCmtId(self, line_num):
-- 
1.8.5.5


Other related posts:

  • » [codeface] [PATCH 10/12] Fix for LinkType.file. - Matthias Dittrich