瀏覽代碼

filtering files to avoid test and .md files

Welder Luz 4 年之前
父節點
當前提交
7ef884f45e
共有 1 個文件被更改,包括 9 次插入3 次删除
  1. 9 3
      code/szz/src/main/java/parser/GitParser.java

+ 9 - 3
code/szz/src/main/java/parser/GitParser.java

@@ -288,9 +288,11 @@ public class GitParser {
     for (Commit commit : commits) {
       List<FileAnnotationGraph> graphs = new LinkedList<>();
       for (Map.Entry<String, DiffEntry.ChangeType> file : commit.changeTypes.entrySet()) {
-        FileAnnotationGraph tracedCommits = traceFileChanges(file.getKey(), commit, this.depth);
-
-        graphs.add(tracedCommits);
+        String filePath = file.getKey();
+        if (checkFileType(filePath)) {
+          FileAnnotationGraph tracedCommits = traceFileChanges(filePath, commit, this.depth);
+          graphs.add(tracedCommits);
+        }
       }
 
       fileGraph.put(commit.getHashString(), graphs);
@@ -299,6 +301,10 @@ public class GitParser {
     return fileGraph;
   }
 
+  private boolean checkFileType(String filePath) {
+    return !filePath.contains("src/test/") && !filePath.endsWith(".md");
+  }
+
   /**
    * Wrapper method to catch a faulty value.
    *