Skip to content

Commit 19ba2f0

Browse files
authored
fix: correctly handle case when heads from cache not equal heads from works. (#243)
1 parent 8e19316 commit 19ba2f0

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
UTIL_VERSION := 0.5.29
1+
UTIL_VERSION := 0.5.30
22
UTIL_NAME := codeplag
33
PWD := $(shell pwd)
44

src/codeplag/algorithms/featurebased.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def get_children_indexes(
9494
count_of_nodes (int): count of elements in the tree.
9595
9696
Complexity:
97-
O(len(tree))
97+
O(n)
9898
"""
9999
indexes = []
100100
count_of_children = 0
@@ -118,9 +118,7 @@ def find_max_index(array: np.ndarray) -> np.ndarray:
118118
array (np.ndarray): matrix of compliance (np.ndarray object).
119119
120120
Complexity:
121-
rows = array.shape[0]
122-
columns = array.shape[1]
123-
O(rows * columns)
121+
O(n^2)
124122
125123
"""
126124
maximum = 0

src/codeplag/handlers/check.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,15 @@ def _do_step(
320320
metrics = None
321321
if self.reporter is not None:
322322
metrics = self.reporter.get_result(work1, work2)
323+
if isinstance(metrics, FullCompareInfo) and (
324+
metrics.first_heads != work1.head_nodes or metrics.second_heads != work2.head_nodes
325+
):
326+
logger.warning(
327+
"Invalid data for the '%s' and '%s' found in cache.",
328+
work1.filepath,
329+
work2.filepath,
330+
)
331+
metrics = None
323332
if metrics is None:
324333
future = self._create_future_compare(executor, work1, work2)
325334
future.id = len(processing) # type: ignore

0 commit comments

Comments
 (0)