Skip to content

Commit 6879a65

Browse files
committed
Add reports for frequently changed files
1 parent 504a709 commit 6879a65

File tree

4 files changed

+331
-18
lines changed

4 files changed

+331
-18
lines changed

cypher/GitLog/List_pairwise_changed_files.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RETURN firstFileName
1414
,firstFile.extension AS firstFileExtension
1515
,secondFile.extension AS secondFileExtension
1616
,firstFile.extension + '↔' + secondFile.extension AS fileExtensionPair
17-
,toInteger(pairwiseChange.updateCommitCount) AS updateCommitCount
17+
,pairwiseChange.updateCommitCount AS updateCommitCount
1818
,pairwiseChange.updateCommitMinConfidence AS updateCommitMinConfidence
1919
,pairwiseChange.updateCommitSupport AS updateCommitSupport
2020
,pairwiseChange.updateCommitLift AS updateCommitLift
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Get the top 4 file extensions that where changed together most often and list top 20 pair that were changed together for each of the top file extension pair by their highest commit lift (>1: changes more often than by random chance). Requires Add_CHANGED_TOGETHER_WITH_relationships_to_git_files.cypher to run first.
2+
3+
MATCH (firstFile:Git:File)-[pairwiseChange:CHANGED_TOGETHER_WITH]-(secondFile:Git:File)
4+
WHERE firstFile.extension < secondFile.extension
5+
OR (firstFile.extension = secondFile.extension AND elementId(firstFile) < elementId(secondFile))
6+
WITH firstFile.extension + '↔' + secondFile.extension AS fileExtensionPair
7+
,count(DISTINCT pairwiseChange) AS pairCount
8+
ORDER BY pairCount DESC
9+
WITH collect(fileExtensionPair)[0..4] AS top4FileExtensionPairs
10+
UNWIND top4FileExtensionPairs AS fileExtensionPair
11+
CALL {
12+
WITH fileExtensionPair
13+
MATCH (firstFile:Git:File)-[pairwiseChange:CHANGED_TOGETHER_WITH]-(secondFile:Git:File)
14+
WHERE elementId(firstFile) < elementId(secondFile)
15+
AND firstFile.extension + '↔' + secondFile.extension = fileExtensionPair
16+
WITH *
17+
,coalesce(firstFile.relativePath, firstFile.fileName) AS firstFileName
18+
,coalesce(secondFile.relativePath, secondFile.fileName) AS secondFileName
19+
RETURN firstFile.name AS firstFileNameShort
20+
,secondFile.name AS secondFileNameShort
21+
,firstFileName
22+
,secondFileName
23+
,pairwiseChange[$selected_pair_metric] AS selectedMetric
24+
,pairwiseChange.updateCommitLift AS updateCommitLift
25+
,pairwiseChange.updateCommitCount AS updateCommitCount
26+
,pairwiseChange.updateCommitMinConfidence AS updateCommitMinConfidence
27+
,pairwiseChange.updateCommitSupport AS updateCommitSupport
28+
,pairwiseChange.updateCommitJaccardSimilarity AS updateCommitJaccardSimilarity
29+
ORDER BY selectedMetric DESC, firstFileName ASC, secondFileName ASC
30+
LIMIT 20
31+
}
32+
RETURN fileExtensionPair
33+
,firstFileNameShort
34+
,secondFileNameShort
35+
,updateCommitCount
36+
,updateCommitMinConfidence
37+
,updateCommitLift
38+
,updateCommitJaccardSimilarity
39+
,updateCommitSupport
40+
,firstFileName
41+
,secondFileName

0 commit comments

Comments
 (0)