You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add solutions to remove invalid metadata directives in documentation comments (#1277)
* Add solutions to remove invalid metadata directives in documentation comments
- Implement solutions for org.swift.docc.Metadata.Invalid<directive>InDocumentationComment diagnostics
- Each invalid directive now has a solution that removes the directive
- Follows the same pattern as other directive removal solutions in the codebase
- Added comprehensive tests to verify solutions are provided correctly
- Fixes issue #1111
* Fix code duplication in validateForUseInDocumentationComment method
- Create diagnostic once instead of duplicating it
- Use conditional solutions array based on range availability
- Single Problem creation path for better maintainability
* Add range verification test for invalid metadata directive solutions
- Verify replacement range matches problem's diagnostic range
- Ensures solution targets the correct content
- Improves test coverage for range accuracy
* Move test comments into assertion messages for better clarity
- Move explanatory comments into assertion message parameters
- Provides better context when tests fail
- Makes tests more self-documenting
* Fix code duplication in validateForUseInDocumentationComment method
- Create diagnostic once instead of duplicating it
- Use conditional solutions array based on range availability
- Single Problem creation path for better maintainability
XCTAssertEqual(replacement.replacement,"","Replacement should be empty string to remove the directive")
1392
+
XCTAssertNotNil(replacement.range,"Replacement should have a valid range")
1393
+
1394
+
// Verify that the replacement range covers the expected content
1395
+
XCTAssertEqual(replacement.range, problem.diagnostic.range,"Replacement range should match the problem's diagnostic range to ensure it removes the entire @DisplayName directive")
0 commit comments