Skip to content

Commit 69b6833

Browse files
committed
Fixes #2039
1 parent 4b8d50c commit 69b6833

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sonar/util/project_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#
2020

2121
import math
22+
from sonar import logging as log
2223

2324

2425
def split_loc_filter(loc_filter: str) -> tuple[str, str]:
@@ -49,7 +50,8 @@ def split_loc_filter(loc_filter: str) -> tuple[str, str]:
4950
pass
5051
else:
5152
new_filters.append(f)
52-
loc_middle = int(math.exp((math.log2(loc_max) - math.log2(max(loc_min, 1))) / 2))
53+
loc_middle = int(2 ** ((math.log2(loc_max) + math.log2(max(loc_min, 1))) / 2))
54+
log.debug("LoC split: min=%d, middle=%d, max=%d", loc_min, loc_middle, loc_max)
5355
slice1 = __FILTER_AND.join(new_filters + [f"ncloc>={loc_min}", f"ncloc<={loc_middle}"])
5456
slice2 = __FILTER_AND.join(new_filters + [f"ncloc>{loc_middle}", f"ncloc<={loc_max}"])
5557
return slice1, slice2

0 commit comments

Comments
 (0)