Skip to content

Commit c3dd82d

Browse files
committed
Mark reachable beta-domain guards to satisfy the static analyzer
1 parent 3cb667c commit c3dd82d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

je_auto_control/utils/stats/stats.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,12 @@ def _betacf(a: float, b: float, x: float) -> float:
8787

8888

8989
def _betai(a: float, b: float, x: float) -> float:
90-
if x <= 0:
90+
# x is a domain ratio in [0, 1]; both boundaries are reachable (e.g. x == 1
91+
# when the t-statistic is 0). NOSONAR: the analyzer mis-models these as
92+
# constant, but they are genuine, exercised guards.
93+
if x <= 0: # NOSONAR python:S2583 reason: reachable beta-domain lower bound
9194
return 0.0
92-
if x >= 1:
95+
if x >= 1: # NOSONAR python:S2583 reason: reachable beta-domain upper bound
9396
return 1.0
9497
front = math.exp(math.lgamma(a + b) - math.lgamma(a) - math.lgamma(b)
9598
+ a * math.log(x) + b * math.log(1 - x))

0 commit comments

Comments
 (0)