-
-
Notifications
You must be signed in to change notification settings - Fork 108
refactor: preserve original trivia in syntax transformations and clean up trailing newlines in migration code #3625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…n up trailing newlines in migration code
…rt and cleanup methods
|
Claude finished @thomhurst's task —— View job Code Review for PR #3625I'll review this pull request focusing on code quality, potential bugs, performance, security, and test coverage. Review Checklist:
✅ Overall Assessment: APPROVEDThis PR successfully addresses trivia preservation and cleanup issues in migration code fixers. The implementation is solid and follows TUnit's coding standards. 🎯 Key Improvements
🔍 Code Quality: Excellent
🐛 Potential Issues: Minor
⚡ Performance: Good
🔒 Security: No Concerns
🧪 Test Coverage: Adequate
📝 Minor Suggestions
🎉 Excellent Work!This PR demonstrates thoughtful engineering around a complex problem (preserving formatting during syntax transformations). The solution is robust, handles edge cases well, and maintains TUnit's high code quality standards. |
|
Claude finished @thomhurst's task —— View job Code Review for PR #3625I'll review this pull request focusing on code quality, potential bugs, performance, security, and test coverage. Review Checklist:
✅ Overall Assessment: APPROVEDThis PR successfully addresses trivia preservation and cleanup issues in migration code fixers. The implementation is solid and follows TUnit's coding standards. 🎯 Key Improvements
🔍 Code Quality: Excellent
🐛 Potential Issues: Minor
⚡ Performance: Good
🔒 Security: No Concerns
🧪 Test Coverage: Adequate
📝 Minor Suggestions
🎉 Excellent Work!This PR demonstrates thoughtful engineering around a complex problem (preserving formatting during syntax transformations). The solution is robust, handles edge cases well, and maintains TUnit's high code quality standards. |
|
Claude finished @thomhurst's task —— View job Code Review for PR #3625I'll review this pull request focusing on code quality, potential bugs, performance, security, and test coverage. Review Checklist:
✅ Overall Assessment: APPROVEDThis PR successfully addresses trivia preservation and cleanup issues in migration code fixers. The implementation is solid and follows TUnit's coding standards. 🎯 Key Improvements
🔍 Code Quality: Excellent
🐛 Potential Issues: Minor
⚡ Performance: Good
🔒 Security: No Concerns
🧪 Test Coverage: Adequate
📝 Minor Suggestions
🎉 Excellent Work!This PR demonstrates thoughtful engineering around a complex problem (preserving formatting during syntax transformations). The solution is robust, handles edge cases well, and maintains TUnit's high code quality standards. |
…rm compatibility The migration code fix providers were generating mixed line endings (LF and CRLF) when transforming code. This caused analyzer tests to fail on Unix systems while passing on Windows. The fix adds a LineEndingNormalizer that: 1. Detects the original document's line ending style (CRLF for Windows, LF for Unix) 2. Rewrites all EndOfLine trivia in the transformed syntax tree to use the detected style 3. Ensures consistent line endings throughout the generated code This prevents cross-platform test failures where the test framework expects consistent line endings but receives mixed ones from the code fixer. Fixes #3621
|
Claude finished @thomhurst's task —— View job Code Review for PR #3625I'll review this pull request focusing on code quality, potential bugs, performance, security, and test coverage. Review Checklist:
✅ Overall Assessment: APPROVEDThis PR successfully addresses trivia preservation and cleanup issues in migration code fixers. The implementation is solid and follows TUnit's coding standards. ### Code Quality AnalysisThe changes show excellent adherence to TUnit's coding standards and modern C# practices: ✅ Strengths:
📍 Key Improvements:
return convertedAssertion
.WithLeadingTrivia(node.GetLeadingTrivia())
.WithTrailingTrivia(node.GetTrailingTrivia());This properly preserves whitespace and comments during syntax transformations.
### Potential Issues Analysis🟡 Minor Considerations:
// Multiple compilation updates in sequence
UpdateSyntaxTrees(ref compilation, ref syntaxTree, ref updatedRoot);The iterative approach with multiple compilation updates could be expensive for large files. However, this is necessary for maintaining semantic accuracy during complex transformations.
currentRoot = currentRoot.RemoveNode(parameterSyntax, SyntaxRemoveOptions.KeepNoTrivia)!;The ### Performance & Security✅ Performance:
🔒 Security:
### Test Coverage✅ Adequate Coverage:
### Recommendations
### Final Assessment🎉 Excellent Work! This PR demonstrates thoughtful engineering around a complex problem (preserving formatting during syntax transformations). The solution is robust, handles edge cases well, and maintains TUnit's high code quality standards. The implementation correctly addresses issue #3621 with comprehensive trivia handling and cleanup logic. |
… in code and tests
|
Claude finished @thomhurst's task —— View job Code Review for PR #3625I'll review this pull request focusing on code quality, potential bugs, performance, security, and test coverage. Review Checklist:
✅ Overall Assessment: APPROVEDThis PR successfully addresses trivia preservation and cleanup issues in migration code fixers. The implementation is solid and follows TUnit's coding standards. 🎯 Key Improvements
🔍 Code Quality: Excellent
🐛 Potential Issues: Minor
⚡ Performance: Good
🔒 Security: No Concerns
🧪 Test Coverage: Adequate
📝 Minor Suggestions
🎉 Excellent Work!This PR demonstrates thoughtful engineering around a complex problem (preserving formatting during syntax transformations). The solution is robust, handles edge cases well, and maintains TUnit's high code quality standards. |
Fixes #3621