Repository navigation
Description
Summary
Plain class fields and local variables (e.g., Type identifier;) are misdetected as function stubs whenever they have a return-type-shaped prefix (alternative B in func_start regex) or a late modifier (alternative A). The regex's trailing lookahead ((?=[ \t\n]*(?:<[^>]*>[ \t\n]*)?(?:\(|=>|\{|;))) accepts a bare ; as sufficient evidence of a "stub declaration" — intended for genuinely prefixed bodyless function stubs like external void externalFunc(); — but never actually requires a (...) parameter list to have appeared. Any Type identifier; without parens matches.
Confirmed repro
Direct regex test (from activated venv with gitgalaxy installed):
>>> from gitgalaxy.standards.language_standards import LANGUAGE_DEFINITIONS
>>> rule = LANGUAGE_DEFINITIONS["dart"]["rules"]["func_start"]
>>> rule.search(" AnimationController? _backingCursorBlinkOpacityController;")
<re.Match object; ...> # captures group 2 = '_backingCursorBlinkOpacityController'
>>> rule.search(" SelectionChangedCause cause;")
<re.Match object; ...> # captures group 2 = 'cause' -- local var inside method body
>>> rule.search(" late List<Element> _children;")
<re.Match object; ...> # captures group 1 = '_children' -- 'late' modifierCorpus impact (confirmed via tests/tools/tree_sitter_accuracy_audit.py --lang dart):
language-crucible/data/dart/flutter/*.dartcorpus: ~68 of dart's 186 remainingfunc_startfalse positives match this exact shape- Both class-level fields (e.g.,
AnimationController? _backingCursorBlinkOpacityController;) and local variables inside method bodies (e.g.,late bool result;,Map<String, String>? debugTimelineArguments;) - After fixing dart func_start: 4 distinct false-positive shapes remain after #1477's ground-truth fix (const ctors, colon-init-no-body ctors, multi-line class headers, multi-line bare calls) #1479's ground-truth audit-tool gaps, this became visible as the 2nd-largest false-positive bucket
Fix direction
Alternatives A and B's trailing lookahead must require that an actual (...) parameter list appeared somewhere in the match — only accept a bare ; terminator if the match captured a (...) somewhere, never accept modifier+ name; / returnType name; with no parens at all.
Related issues
Related to #1479's investigation of dart false positives, but distinct root cause (requires parens validation, not keyword exclusion or multi-line handling).
Labels
bug, core-engine
File location
gitgalaxy/standards/language_standards.py line ~9322-9345 (dart func_start regex, alternatives A/B trailing lookahead)
Activity
chore: re-bless golden masters after main merge (round 3, combined with
fix(dart): exclude try/finally from func_start phantom-function match…