Skip to content

Commit 6a7470c

Browse files
author
Vincent Potucek
committed
Add error-prone.picnic.tech
1 parent d3a160d commit 6a7470c

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ repositories {
1212
apply from: rootProject.file('gradle/java-publish.gradle')
1313
apply from: rootProject.file('gradle/changelog.gradle')
1414
allprojects {
15+
apply from: rootProject.file('gradle/error-prone.gradle')
1516
apply from: rootProject.file('gradle/rewrite.gradle')
1617
apply from: rootProject.file('gradle/spotless.gradle')
1718
}

gradle/error-prone.gradle

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import static java.lang.System.getenv
2+
3+
apply plugin: 'net.ltgt.errorprone'
4+
5+
dependencies {
6+
errorprone('com.google.errorprone:error_prone_core:2.42.0')
7+
errorprone('tech.picnic.error-prone-support:error-prone-contrib:0.25.0')
8+
errorprone('tech.picnic.error-prone-support:refaster-runner:0.25.0')
9+
constraints {
10+
errorprone('com.google.guava:guava') {
11+
version {
12+
require('33.4.8-jre')
13+
}
14+
because('Older versions use deprecated methods in sun.misc.Unsafe')
15+
// https://github.com/junit-team/junit-framework/pull/5039#discussion_r2414490581
16+
}
17+
}
18+
}
19+
20+
tasks.withType(JavaCompile).configureEach {
21+
options.errorprone {
22+
errorproneArgs.add('-XepOpt:Refaster:NamePattern=^(?!.*Rules\\$).*')
23+
error(
24+
'DirectReturn',
25+
// 'ConstantNaming',
26+
// 'LexicographicalAnnotationAttributeListing',
27+
// 'LexicographicalAnnotationListing',
28+
// 'MissingOverride',
29+
// 'NonStaticImport',
30+
// 'OptionalMapUnusedValue',
31+
// 'OptionalOfRedundantMethod',
32+
// 'RedundantSetterCall',
33+
// 'RedundantStringConversion',
34+
// 'RedundantStringEscape',
35+
// 'StaticImport',
36+
// 'StringJoin',
37+
// 'UnnecessaryCheckNotNull',
38+
// 'UnnecessaryTypeArgument',
39+
// 'UnusedAnonymousClass',
40+
// 'UnusedCollectionModifiedInPlace',
41+
)
42+
if (!getenv().containsKey('CI') && getenv('IN_PLACE')?.toBoolean()) {
43+
errorproneArgs.addAll(
44+
'-XepPatchLocation:IN_PLACE',
45+
'-XepPatchChecks:' +
46+
'DirectReturn,'
47+
// 'ConstantNaming,' +
48+
// 'MissingOverride,' +
49+
// 'StaticImport,' +
50+
// LexicographicalAnnotationAttributeListing,' +
51+
// LexicographicalAnnotationListing,' +
52+
// NonStaticImport,' +
53+
// OptionalMapUnusedValue,' +
54+
// OptionalOfRedundantMethod,' +
55+
// RedundantSetterCall,' +
56+
// RedundantStringConversion,' +
57+
// RedundantStringEscape,' +
58+
// StringJoin,' +
59+
// UnnecessaryCheckNotNull,' +
60+
// UnnecessaryTypeArgument,' +
61+
// UnusedAnonymousClass,' +
62+
// UnusedCollectionModifiedInPlace,'
63+
)
64+
}
65+
}
66+
}

rewrite.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ tags:
1010
- cleanup
1111
recipeList:
1212
- org.openrewrite.gradle.EnableGradleBuildCache
13-
- org.openrewrite.gradle.EnableGradleParallelExecution
1413
- org.openrewrite.gradle.GradleBestPractices
1514
- org.openrewrite.java.RemoveUnusedImports
1615
- org.openrewrite.java.format.NormalizeFormat

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ plugins {
2323
id 'com.gradle.develocity' version '4.2.1'
2424
// https://github.com/equodev/equo-ide/blob/main/plugin-gradle/CHANGELOG.md
2525
id 'dev.equo.ide' version '1.7.8' apply false
26+
id 'net.ltgt.errorprone' version '4.3.0' apply false
2627
id 'org.openrewrite.rewrite' version '7.17.0' apply false
2728
}
2829

0 commit comments

Comments
 (0)