fix(kvb-code-clean): a call in a ternary branch is no method definition

METHOD_AFTER let a return-type annotation run past the ternary's ': hidden,' into the next member's '(pattern) =>', so defaults.py read assignments in arrow bodies inside call arguments as parameter defaults (core penpot _shared.test.js lines 85, 94, 102). The annotation now holds no bare colon outside parentheses, so typed methods such as 'm(a = 1): (x: number) => void {' still count. Over 932 JS, TS and C# files in core and skills, 4 hits drop, all of this kind, and none appear.

🎯 Fix: 97 %
💥 Break: 2 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 95
🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 %

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-18 22:01:31 +00:00
1 parent 730851cecf
commit 88c232fd20
2 files changed
+22 -1

No files matched your search

+1 -1
View File
@@ -120,7 +120,7 @@ JINJA_DEFAULT = re.compile(r"\|\s*(?:default|d)\s*\(")
ENV_LOOKUP = re.compile(r"lookup\(\s*['\"]env['\"]")
FUNCTION_BEFORE = re.compile(r"\bfunction\b[\s*]*[\w$]*\s*(?:<[^<>()]*>)?\s*\Z")
METHOD_BEFORE = re.compile(r"(?<![\w$.])([\w$]+)\s*(?:<[^<>()]*>)?\s*\Z")
METHOD_AFTER = re.compile(r"\s*(?::[^;{}]*)?(?:\{|=>|where\b)")
METHOD_AFTER = re.compile(r"\s*(?::(?:[^;{}:()]|\([^()]*\))*)?(?:\{|=>|where\b)")
ARROW_AFTER = re.compile(r"\s*(?::[^=;{}()]*)?=>")
DECLARE = re.compile(r"\b(?:const|let|var)\s+([{\[])")
NULLISH = re.compile(r"\?\?=?")