-
Notifications
You must be signed in to change notification settings - Fork 0
Ci/setup pipeline, enforce test coverage and improve tests #3
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
Ci/setup pipeline, enforce test coverage and improve tests #3
Conversation
- Refactor all Java files to comply with HMCTS checkstyle rules - Expand wildcard imports and fix indentation/line-length violations - Add .editorconfig using HMCTS formatting conventions - Update .gitignore to include HMCTS-relevant patterns - Remove Spotless plugin from build.gradle (not used in HMCTS projects) - Ensure Checkstyle uses HMCTS-provided configuration files This brings the project into alignment with the HMCTS engineering standards and eliminates conflicting or redundant formatting tools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request establishes a comprehensive CI/CD pipeline and code quality framework for the Book API project, ensuring consistent code standards and 100% test coverage for all future contributions.
Key Changes:
- Introduced GitHub Actions CI workflow with automated testing, Checkstyle, SpotBugs, and JaCoCo coverage verification
- Refactored package structure from
BookAPItobookapi(lowercase) to follow Java naming conventions - Converted
BookRequestDTO from Lombok@Valueto Javarecordtype
Reviewed Changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/ci.yml |
New CI workflow that runs all quality checks on pull requests and pushes to main |
build.gradle |
Added JaCoCo, Checkstyle, and SpotBugs plugins with 100% coverage enforcement and exclusions for DTOs/entities |
config/checkstyle/checkstyle.xml |
Google Java Style-based Checkstyle configuration for code formatting enforcement |
.editorconfig |
Editor configuration for consistent formatting (4-space indent for Java, LF line endings) |
README.md |
Comprehensive documentation for running quality checks, coverage reports, and IDE setup |
src/main/java/com/codesungrape/hmcts/bookapi/ |
Refactored main source files to lowercase package names with improved documentation |
src/main/java/com/codesungrape/hmcts/bookapi/dto/BookRequest.java |
Converted from Lombok @Value to Java record type |
src/main/java/com/codesungrape/hmcts/bookapi/repository/BookRepository.java |
Fixed method name from findByIdAndDeleteFalse to findByIdAndDeletedFalse |
src/test/java/com/codesungrape/hmcts/bookapi/BookServiceTest.java |
Enhanced tests with better formatting and updated to use record accessor methods |
src/test/java/com/codesungrape/hmcts/bookapi/BookApiApplicationTests.java |
Added @ActiveProfiles("test") for test-specific configuration |
src/test/resources/application.properties |
New H2 in-memory database configuration for tests |
.gitignore |
Added additional patterns for build artifacts and IDE files |
Comments suppressed due to low confidence (6)
src/test/java/com/codesungrape/hmcts/bookapi/BookServiceTest.java:132
- The comment contains "CoPilot" which should be "Copilot" (one word, not camel case).
src/test/java/com/codesungrape/hmcts/bookapi/BookServiceTest.java:134 - The annotation name is incorrectly written as "@notblank" (lowercase) when it should be "@notblank" (Pascal case) to match the actual Java annotation name.
src/test/java/com/codesungrape/hmcts/bookapi/BookServiceTest.java:133 - The comment mentions "@value from Lombok" but BookRequest has been changed from a Lombok
@Valueclass to a Javarecord. The comment should be updated to reflect that BookRequest is now a record type, not a Lombok @value class.
src/main/java/com/codesungrape/hmcts/bookapi/service/BookService.java:33 - The pronoun "i" should be capitalized to "I".
src/test/java/com/codesungrape/hmcts/bookapi/BookServiceTest.java:30 - The Javadoc comment starts with
/**followed by a period, which should be/**without the period. This is a documentation formatting issue.
src/main/java/com/codesungrape/hmcts/bookapi/service/BookService.java:35 - The annotation name is incorrectly written as "@notblank" (lowercase) when it should be "@notblank" (Pascal case) to match the actual Java annotation name.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces a full CI pipeline (ci.yml). It ensures all future pull requests must satisfy testing, formatting, and static-analysis requirements before merging into main.
Key Changes
CI Enforcement (Post-Merge)
Once this PR is merged into main, the repository can be configured to block merges unless:
This ensures consistent code quality across all future contributors.