Skip to content

Optimized Utils.name() method #57

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
58 changes: 58 additions & 0 deletions .github/workflows/coverage-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: JaCoCo Coverage Report

on:
pull_request:
branches: [ main, master ] # Adjust branches as needed

permissions:
# Required for checking out the code
contents: read
# Required for posting comments and status checks
pull-requests: write
# Required for reading report files
actions: read # Optional, often implicitly available

jobs:
build-and-report:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '8' # Or your project's Java version
distribution: 'temurin' # Or your preferred distribution

- name: Build and Test with Maven
run: mvn clean verify --batch-mode # The 'verify' phase usually triggers the jacoco:report goal

- name: Check for JaCoCo Report File
run: |
echo "Searching for JaCoCo reports..."
find ${{ github.workspace }} -name 'jacoco*.xml' # General search
echo "--- Listing Maven default ---"
ls -l ${{ github.workspace }}/target/site/jacoco/jacoco.xml || echo "Maven default not found"

# --- Coverage Reporting Step ---
- name: JaCoCo Report to PR Comment
id: jacoco
uses: madrapps/[email protected] # Use the latest version
with:
paths: |
${{ github.workspace }}/**/target/site/jacoco/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 95 # Example value
min-coverage-changed-files: 95 # Example value
update-comment: true
title: "📊 JaCoCo Code Coverage"

# Optional: Output coverage details
- name: Print Coverage Summary
run: |
echo "Overall Coverage: ${{ steps.jacoco.outputs.coverage-overall }}%"
echo "Changed Files Coverage: ${{ steps.jacoco.outputs.coverage-changed-files }}%"
66 changes: 19 additions & 47 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<groupId>com.flipkart.databuilderframework</groupId>
<version>0.5.12</version>
<version>0.5.13-RC1</version>
<modelVersion>4.0.0</modelVersion>

<artifactId>databuilderframework</artifactId>
Expand Down Expand Up @@ -62,8 +62,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jackson.version>2.10.3</jackson.version>
<lombok.version>1.16.6</lombok.version>
<lombok.maven.version>1.16.6.1</lombok.maven.version>
<lombok.version>1.18.30</lombok.version>
<hibernate.validator.version>5.2.5.Final</hibernate.validator.version>
<junit.version>4.13.1</junit.version>
</properties>
Expand Down Expand Up @@ -118,17 +117,23 @@
<build>
<plugins>
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
</execution>
</executions>
<version>${lombok.maven.version}</version>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.13</version> <executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>verify</phase> <goals>
<goal>report</goal>
</goals>
<configuration>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -138,39 +143,6 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<check>
<branchRate>85</branchRate>
<lineRate>85</lineRate>
<haltOnFailure>true</haltOnFailure>
<totalBranchRate>85</totalBranchRate>
<totalLineRate>85</totalLineRate>
<packageLineRate>85</packageLineRate>
<packageBranchRate>85</packageBranchRate>
<regexes>
<regex>
<pattern>com.flipkart.databuilderframework.*</pattern>
<branchRate>100</branchRate>
<lineRate>100</lineRate>
</regex>
</regexes>
</check>
<instrumentation>
<ignoreTrivial>true</ignoreTrivial>
</instrumentation>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public static String name(Object object) {
}

public static String name(Class<?> clazz) {
return CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE,
CLASS_TO_NAME_MAPPING.computeIfAbsent(clazz, aClass -> clazz.getSimpleName()));
return CLASS_TO_NAME_MAPPING.computeIfAbsent(clazz,
aClass -> CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, clazz.getSimpleName()));
}

public static boolean isEmpty(Collection collection) {
Expand Down