Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: CI
on:
push:
branches: [ master, main ]
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the pull_request trigger from the CI workflow means that pull requests will no longer be tested by this workflow. This appears to be intentional since there is a separate pr-validation.yml workflow, but it's worth noting that the ci.yml workflow runs SonarCloud analysis which the pr-validation.yml also runs. Consider whether this separation is needed, or if the pull_request trigger should be retained to ensure consistency between PR validation and main branch CI.

Suggested change
branches: [ master, main ]
branches: [ master, main ]
pull_request:
branches: [ master, main ]

Copilot uses AI. Check for mistakes.
pull_request:
branches: [ master, main ]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -41,8 +39,8 @@ jobs:
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Run tests and generate coverage
run: mvn clean verify
- name: Run tests with coverage
run: mvn clean test jacoco:report

- name: Run SonarCloud analysis
if: env.SONAR_TOKEN != ''
Expand Down Expand Up @@ -95,7 +93,7 @@ jobs:
restore-keys: ${{ runner.os }}-m2

- name: Build package
run: mvn clean package -DskipTests
run: mvn package -DskipTests

- name: Upload build artifacts
uses: actions/upload-artifact@v4
Expand Down
185 changes: 154 additions & 31 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,147 @@ env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

jobs:
validate:
# Run quality checks in parallel
spotless:
name: Code Formatting (Spotless)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

java-version: '17'
distribution: 'temurin'

- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Check code formatting with Spotless
run: mvn spotless:check

checkstyle:
name: Code Style (Checkstyle)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Run tests
run: mvn clean test

- name: Generate test coverage report
run: mvn jacoco:report

- name: Run checkstyle

- name: Run Checkstyle
run: mvn checkstyle:check
continue-on-error: true


- name: Upload Checkstyle report
uses: actions/upload-artifact@v4
if: always()
with:
name: checkstyle-report
path: target/site/checkstyle.html

pmd:
name: Static Analysis (PMD)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Run PMD
run: mvn pmd:check
continue-on-error: true


- name: Upload PMD report
uses: actions/upload-artifact@v4
if: always()
with:
name: pmd-report
path: target/site/pmd.html

spotbugs:
name: Bug Detection (SpotBugs)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Run SpotBugs
run: mvn spotbugs:check
continue-on-error: true

- name: Check code formatting with Spotless
run: mvn spotless:check
continue-on-error: true

- name: Build package
run: mvn clean package -DskipTests

run: mvn compile spotbugs:check

- name: Upload SpotBugs report
uses: actions/upload-artifact@v4
if: always()
with:
name: spotbugs-report
path: target/site/spotbugs.html

# Run coverage tests only if all quality checks pass
coverage:
name: Test Coverage
needs: [spotless, checkstyle, pmd, spotbugs]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Run tests with coverage
run: mvn clean test jacoco:report

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
Expand All @@ -79,7 +174,7 @@ jobs:
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

- name: Archive test results
uses: actions/upload-artifact@v4
if: always()
Expand All @@ -88,6 +183,34 @@ jobs:
path: |
target/surefire-reports/
target/site/jacoco/
target/site/checkstyle.html
target/site/pmd.html
target/site/spotbugs.html

# Build package only if all checks pass
build:
name: Build Package
needs: [spotless, checkstyle, pmd, spotbugs, coverage]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Build package
run: mvn package -DskipTests

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: jar-artifact
path: target/*.jar
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@

MongOCOM (Mongo Object-COllection Mapper) is a lightweight Java Object-Document Mapping (ODM) library for MongoDB. It provides an annotation-based approach to map Java objects to MongoDB documents, similar to how JPA/Hibernate works for relational databases.

## Current Status

**Version:** 0.4-SNAPSHOT
**Test Coverage:** 62% (target: 80%)
**Tests:** 609 passing
**Quality:** ✅ All PMD, SpotBugs, Checkstyle passing
**Architecture:** ✅ Refactored with SOLID principles

📊 **[View Detailed Status](CURRENT_STATUS.md)** | 🚫 **[Coverage Blockers](COVERAGE_BLOCKERS.md)**

### Recent Achievements
- ✅ Completed comprehensive refactoring (Phases 1-9)
- ✅ Increased test coverage from 27% to 62% (+35 points)
- ✅ Added 426 new tests (183 → 609 tests)
- ✅ Implemented 11 design patterns
- ✅ Applied SOLID principles throughout
- ✅ Achieved 100% code quality compliance

### Next Steps
- 🎯 Create MongoEntityRepositoryTest (+8-10% coverage)
- 🎯 Reach 80% test coverage goal
- 🎯 Add integration tests with Testcontainers

## Table of Contents

- [Features](#features)
Expand Down
32 changes: 25 additions & 7 deletions check-quality.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,37 @@ echo "2️⃣ Checking code formatting..."
mvn spotless:check
if [ $? -ne 0 ]; then
echo "❌ Code formatting issues found. Run 'mvn spotless:apply' to fix them."
echo "⚠️ Continuing with other checks..."
else
echo "✅ Code formatting is correct!"
exit 1
fi
echo "✅ Code formatting is correct!"
echo

echo "3️⃣ Running static analysis..."
mvn checkstyle:check pmd:check spotbugs:check
echo " - Running Checkstyle..."
mvn checkstyle:check
if [ $? -ne 0 ]; then
echo "❌ Checkstyle found violations!"
exit 1
fi
echo " ✅ Checkstyle passed!"

echo " - Running PMD..."
mvn pmd:check
if [ $? -ne 0 ]; then
echo "⚠️ Static analysis found some issues (warnings only)"
else
echo "✅ Static analysis passed!"
echo "❌ PMD found violations!"
exit 1
fi
echo " ✅ PMD passed!"

echo " - Running SpotBugs..."
mvn spotbugs:check
if [ $? -ne 0 ]; then
echo "❌ SpotBugs found violations!"
exit 1
fi
echo " ✅ SpotBugs passed!"

echo "✅ All static analysis checks passed!"
echo

echo "4️⃣ Building package..."
Expand Down
20 changes: 14 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,22 @@
<configuration>
<java>
<googleJavaFormat>
<version>1.7</version>
<version>1.24.0</version>
<style>GOOGLE</style>
</googleJavaFormat>
<removeUnusedImports />
<trimTrailingWhitespace />
<endWithNewline />
</java>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>

<!-- SpotBugs for static analysis -->
Expand All @@ -81,7 +89,7 @@
<configuration>
<effort>Max</effort>
<threshold>Low</threshold>
<failOnError>false</failOnError>
<failOnError>true</failOnError>
</configuration>
<executions>
<execution>
Expand All @@ -106,7 +114,7 @@
<ruleset>/category/java/errorprone.xml</ruleset>
<ruleset>/category/java/performance.xml</ruleset>
</rulesets>
<failOnViolation>false</failOnViolation>
<failOnViolation>true</failOnViolation>
</configuration>
<executions>
<execution>
Expand All @@ -126,10 +134,10 @@
<configLocation>google_checks.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>false</failsOnError>
<failOnViolation>false</failOnViolation>
<failsOnError>true</failsOnError>
<failOnViolation>true</failOnViolation>
<linkXRef>false</linkXRef>
<violationSeverity>error</violationSeverity>
<violationSeverity>warning</violationSeverity>
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The violationSeverity is changed from "error" to "warning" while simultaneously setting failsOnError and failOnViolation to true. This creates an inconsistency: failsOnError is set to true, but violationSeverity is set to "warning", which means only warnings will be reported. This configuration may not catch actual errors as intended. Consider either keeping violationSeverity as "error" to enforce strict quality gates, or clarifying the intention behind this change.

Suggested change
<violationSeverity>warning</violationSeverity>
<violationSeverity>error</violationSeverity>

Copilot uses AI. Check for mistakes.
</configuration>
<executions>
<execution>
Expand Down
Loading
Loading