Skip to content
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

Error prone suggestions profile #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
error prone support from Picnic to import new ruls
  • Loading branch information
gtiwari333 committed Jun 18, 2023
commit ffe137a6b3efd396655b8adddd4bfe5ef1ff144e
103 changes: 88 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<groupId>gt.app</groupId>

<properties>
<error-prone.patch-args/>
<java.version>17</java.version>

<springdoc-openapi-ui.version>2.1.0</springdoc-openapi-ui.version>
Expand Down Expand Up @@ -54,7 +55,9 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven-surefire-plugin.version>3.1.0</maven-surefire-plugin.version>
<maven-failsafe-plugin.version>3.1.0</maven-failsafe-plugin.version>
<google.error-prone.compiler.version>2.19.1</google.error-prone.compiler.version>
<!-- https://github.com/PicnicSupermarket/error-prone-support/issues/686 not yet compatible with 2.20 -->
<version.error-prone>2.19.1-picnic-1</version.error-prone>
<version.error-prone-support>0.11.1</version.error-prone-support>
<groovy.maven.plugin.version>2.1.0</groovy.maven.plugin.version>
<modernizer-maven-plugin.version>2.6.0</modernizer-maven-plugin.version>
<spotbugs.plugin.version>4.7.3.4</spotbugs.plugin.version>
Expand Down Expand Up @@ -297,17 +300,51 @@
<target>17</target>
<compilerArgs>
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne</arg>
<!-- this will fix mapstruct -->
<arg>-Amapstruct.defaultComponentModel=spring</arg>
<arg>-Amapstruct.defaultInjectionStrategy=constructor</arg>
<!-- Enable and configure Error Prone. -->
<arg>
-Xplugin:ErrorProne
-Xep:NestedInstanceOfConditions:OFF -Xep:ParameterName:OFF -Xep:SameNameButDifferent:OFF

-XepAllErrorsAsWarnings
-XepAllSuggestionsAsWarnings
-XepAllDisabledChecksAsWarnings
-XepDisableWarningsInGeneratedCode
-XepExcludedPaths:\Q${project.build.directory}${file.separator}\E.*
-Xep:AndroidJdkLibsChecker:OFF
-Xep:Java7ApiChecker:OFF
-Xep:Java8ApiChecker:OFF
<!-- We generally discourage `var` use. -->
-Xep:Varifier:OFF
<!-- Refaster name pattern example:
-XepOpt:Refaster:NamePattern=^(?!(Immutable.*Rules)).*
-->

<!--
START Error Prone Support configuration.
-->
<!-- XXX: Enable once sufficiently configurable. -->
-Xep:LexicographicalAnnotationListing:OFF
<!-- XXX: Enable once false positives no longer have a major performance impact. -->
-Xep:MethodReferenceUsage:OFF
<!-- XXX: Disabled as it is not a clear improvement. -->
-Xep:StringJoin:OFF
-XepOpt:ErrorProneSupport:IgnoreClasspathCompat=true
<!--
END Error Prone Support configuration.
-->

<!-- Append additional custom arguments. -->
${error-prone.patch-args}
</arg>
<arg>-XDcompilePolicy=simple</arg>
<!-- this will fix mapstruct -->
<arg>-Amapstruct.defaultComponentModel=spring</arg>
<arg>-Amapstruct.defaultInjectionStrategy=constructor</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>${google.error-prone.compiler.version}</version>
</path>
<annotationProcessorPaths combine.children="append">
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand All @@ -318,6 +355,24 @@
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
<!-- Picnic's Error Prone fork. -->
<path>
<groupId>com.github.PicnicSupermarket.error-prone</groupId>
<artifactId>error_prone_core</artifactId>
<version>${version.error-prone}</version>
</path>
<!-- Error Prone Support's additional bug checkers. -->
<path>
<groupId>tech.picnic.error-prone-support</groupId>
<artifactId>error-prone-contrib</artifactId>
<version>${version.error-prone-support}</version>
</path>
<!-- Error Prone Support's Refaster templates. -->
<path>
<groupId>tech.picnic.error-prone-support</groupId>
<artifactId>refaster-runner</artifactId>
<version>${version.error-prone-support}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
Expand Down Expand Up @@ -502,13 +557,13 @@
<artifactId>dependency-check-maven</artifactId>
<version>${owasp-dependency-check-plugin.version}</version>
<!-- should be manually run, uncomment it needs to be a part of build pipeline-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>check</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>check</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
</plugin>

<plugin>
Expand Down Expand Up @@ -621,6 +676,24 @@
</properties>
</profile>

<profile>
<!-- this profile configures Error Prone to try and automatically fix in the source code. -->
<id>errorPronePatch</id>
<properties>
<error-prone.patch-args>-XepPatchChecks:${error-prone.patch-checks} -XepPatchLocation:IN_PLACE
</error-prone.patch-args>
<!-- One can override this value to specify which checks should be patched. -->
<error-prone.patch-checks/>
</properties>
</profile>

</profiles>

<repositories>
<!-- picnic dependencies -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
</project>
1 change: 1 addition & 0 deletions src/main/java/gt/app/domain/BaseEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@Data
@MappedSuperclass
@SuppressWarnings("DirectReturn") //getting [ERROR] java.lang.IllegalArgumentException: Replacement{range=[165..170), replaceWith=} conflicts with existing replacement Replacement{range=[165..170), replaceWith=return @Data;}
public abstract class BaseEntity {

@Id
Expand Down
1 change: 1 addition & 0 deletions src/main/java/gt/app/domain/LiteUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@Entity
@Table(name="APP_USER")
@Data
@SuppressWarnings("DirectReturn")
public class LiteUser extends BaseEntity {

@Column(nullable = false)
Expand Down
1 change: 1 addition & 0 deletions src/main/java/gt/app/domain/Note.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
@Entity
@Table(name = "note")
@Data
@SuppressWarnings("DirectReturn")
public class Note extends BaseAuditingEntity {

private String title;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/gt/app/domain/ReceivedFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@Entity
@Data
@NoArgsConstructor
@SuppressWarnings("DirectReturn")
public class ReceivedFile {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import jakarta.validation.constraints.Size;

@Data
@SuppressWarnings("DirectReturn")
@AllArgsConstructor
@NoArgsConstructor
public class UserProfileUpdateDTO {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/gt/app/modules/user/dto/UserSignUpDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

@EqualsAndHashCode(callSuper = true)
@Data
@SuppressWarnings("DirectReturn")
public class UserSignUpDTO extends UserProfileUpdateDTO {

@NotNull
Expand Down