Fix Maven Linter incomplete XML insertion (#1)#3
Merged
Conversation
- Implement InsertXMLTask type with XML parsing and element insertion - Support simplified XPath for Maven pom.xml and similar structures - Integrate with transaction manager for safe rollback - Path validation prevents directory traversal attacks - DryRun mode support - Comprehensive test coverage with edge cases - No linting warnings or test complexity violations
- Use InsertXMLTask to inject maven-checkstyle-plugin into existing pom.xml - Remove orphaned maven-checkstyle-plugin.xml file generation - Checkstyle configuration still created separately - Handler now properly integrates linter with Maven projects - Comprehensive test coverage verifying idempotency and error handling
- End-to-end test verifying plugin injection into pom.xml - Test idempotency (applying twice doesn't duplicate) - Test transaction rollback behavior - Test error handling for missing plugins section - All tests follow Go best practices with focused test functions - No linting warnings or complexity violations
- Document InsertXMLTask in pkg/tasks/doc.go - Update README with InsertXMLTask explanation and usage example - Add extension guidelines for file modification handlers - Update priority band documentation with new task type - Clarify Maven Linter now provides automatic pom.xml integration
- Update CI workflow to use golangci-lint v2.11 instead of v1.61 - Aligns with local development environment (golangci-lint 2.11.4) - Resolves configuration schema validation errors - Enables proper linting of new code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes issue #1: Maven Linter template was generating a Checkstyle configuration but failing to integrate it into the existing pom.xml file, leaving an orphaned maven-checkstyle-plugin.xml file that users had to manually handle.
Type of Change
Details
This implementation adds a new type that enables safe, transactional modifications to existing XML files. The task:
The Maven Linter handler now uses InsertXMLTask to inject the maven-checkstyle-plugin directly into the project's pom.xml, eliminating the orphaned file issue.
Tests
All tests follow Go best practices with focused test functions, zero linting violations, and comprehensive edge case coverage including:
API Impact
InsertXMLTask is internal to the scbake execution engine.
Checklist
Related Issues
Closes #1