Skip to content

[Improvement-11074]Add generated annotation to Lombok generated codes to make the code coverage results of Sonar more meaningful#11212

Merged
SbloodyS merged 1 commit intoapache:devfrom
rickchengx:Improvement-11074
Aug 2, 2022
Merged

[Improvement-11074]Add generated annotation to Lombok generated codes to make the code coverage results of Sonar more meaningful#11212
SbloodyS merged 1 commit intoapache:devfrom
rickchengx:Improvement-11074

Conversation

@rickchengx
Copy link
Contributor

@rickchengx rickchengx commented Jul 30, 2022

Purpose of the pull request

To exclude the Lombok generated code during the coverage tests and make the code coverage results of Sonar more meaningful.
#11074

Brief change log

add a lombok.config file in the root of the project and add the config below:

lombok.addLombokGeneratedAnnotation = true

which makes Lombok to add @lombok.Generated annotation to all generated methods so that Jacoco will automatically ignore the lombok auto generated code.

Ref:
https://community.sonarsource.com/t/getting-meaningful-coverage-results-in-sonarqube-when-using-jacoco-and-lombok/13821

https://projectlombok.org/features/configuration

And here is an example provided by @kezhenxu94 :
https://github.com/apache/skywalking/blob/master/lombok.config

Verify this pull request

This pull request is code cleanup without any test coverage.

@rickchengx rickchengx changed the title [Improvement-11074] [Improvement-11074]Make the code coverage results of Sonar more meaningful Jul 30, 2022
@EricGao888 EricGao888 added good first issue good first issue first time contributor First-time contributor labels Jul 30, 2022
@rickchengx rickchengx marked this pull request as ready for review August 1, 2022 02:06
@SbloodyS SbloodyS requested a review from kezhenxu94 August 1, 2022 06:57
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 1, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

58.6% 58.6% Coverage
0.0% 0.0% Duplication

Copy link
Member

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

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

Lgtm

@kezhenxu94
Copy link
Member

Prefer to change the pr title to something like "Add generated annotation to Lombok generated codes to ..."

@rickchengx rickchengx changed the title [Improvement-11074]Make the code coverage results of Sonar more meaningful [Improvement-11074]Add generated annotation to Lombok generated codes to make the code coverage results of Sonar more meaningful Aug 1, 2022
Copy link
Member

@SbloodyS SbloodyS left a comment

Choose a reason for hiding this comment

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

+1

@SbloodyS SbloodyS merged commit d9516e2 into apache:dev Aug 2, 2022
@SbloodyS SbloodyS added this to the 3.1.0-alpha milestone Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first time contributor First-time contributor good first issue good first issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants