Unmemoized recursive function calls itself twice
Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 8 points from that category, once per scan, no matter how many places it turns up.
What it detects
A named function calls itself two or more times within a single line of its own body (the classic return fib(n-1) + fib(n-2) shape), with no memo/cache in sight. Without memoization this branches exponentially. Heuristic: a "memo"/"cache" keyword anywhere in the function body is treated as evidence it is already handled and suppresses the finding.
Why it matters
A function that calls itself two or more times within a single line of its own body (the classic return fib(n-1) + fib(n-2) shape) branches into two recursive calls at every level, so the total number of calls grows exponentially with the input size. Past a fairly small input this becomes seconds or minutes of pure recomputation of values that were already computed. This detector treats any "memo"/"cache" keyword anywhere in the function body as evidence memoization already exists, so a hit here usually means it genuinely does not.
How to fix it
Add memoization: cache each computed result keyed by its input (a plain object/Map keyed by the argument, or a small wrapper function) and return the cached value instead of recursing again when it is already known. For simple cases, converting to an iterative/bottom-up implementation avoids the recursion (and its call-stack cost) entirely.
The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing
Does your repo trip this check?
Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.
Scan your repo