Fix create_script validator false-positive inside method bodies#1076
Conversation
The duplicate-method validator was still matching invocation-like text inside method bodies after the constructor-call fix in CoplayDev#1045. Tracking both the current brace depth and the direct member depth for the containing type keeps duplicate detection scoped to actual type members while preserving the existing lightweight parser. Constraint: The existing validator is regex-based and runs even without Roslyn available Rejected: Add more fake return-type keyword skips | that would miss local functions and keep the parser fragile Confidence: high Scope-risk: narrow Directive: Keep duplicate-method matching scoped to direct type members unless replacing this validator with a real syntax walk Tested: Unity -executeMethod repro failed on upstream/beta and passed on this branch with REPRO_OK Tested: git diff --check Not-tested: Full Unity 2021.3 EditMode suite locally; only Unity 6000 is installed in this environment and did not emit runner XML for the 2021.3-pinned project
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe duplicate-method-signature detection algorithm in ManageScript.cs is enhanced with brace-depth filtering to prevent false positives. Method signatures are now validated only when they match the containing type's member scope depth. Two test cases expand coverage to validate local functions and method invocations. Changes
Possibly related PRs
Poem
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Great to see you Justin! Thanks for the fix :) |
Summary
ManageScriptduplicate-method validation so it only counts method declarations that are direct members of a type.return Compute();from being misclassified as duplicate method declarations.Test plan
upstream/betawith a temporary Unity-executeMethodharness: repeatedreturn Compute();calls produced duplicateComputediagnostics.REPRO_OK.git diff --checkNotes
Summary by CodeRabbit
Bug Fixes
Tests