Skip to content

Commit 1aa9fee

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

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-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: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
// 'EmptyMethod',
27+
// 'EmptyMonoZip',
28+
// 'LexicographicalAnnotationAttributeListing',
29+
// 'LexicographicalAnnotationListing',
30+
// 'MissingOverride',
31+
// 'MissingTestCall',
32+
// 'NonEmptyMono',
33+
// 'NonStaticImport',
34+
// 'OptionalMapUnusedValue',
35+
// 'OptionalOfRedundantMethod',
36+
// 'RedundantSetterCall',
37+
// 'RedundantStringConversion',
38+
// 'RedundantStringEscape',
39+
// 'StaticImport',
40+
// 'StringJoin',
41+
// 'UnnecessaryCheckNotNull',
42+
// 'UnnecessaryTypeArgument',
43+
// 'UnusedAnonymousClass',
44+
// 'UnusedCollectionModifiedInPlace',
45+
)
46+
if (!getenv().containsKey('CI') && getenv('IN_PLACE')?.toBoolean()) {
47+
errorproneArgs.addAll(
48+
'-XepPatchLocation:IN_PLACE',
49+
'-XepPatchChecks:' +
50+
'DirectReturn,'
51+
// 'ConstantNaming,' +
52+
// 'MissingOverride,' +
53+
// 'StaticImport,' +
54+
// EmptyMethod,' +
55+
// EmptyMonoZip,' +
56+
// LexicographicalAnnotationAttributeListing,' +
57+
// LexicographicalAnnotationListing,' +
58+
// MissingTestCall,' +
59+
// NonEmptyMono,' +
60+
// NonStaticImport,' +
61+
// OptionalMapUnusedValue,' +
62+
// OptionalOfRedundantMethod,' +
63+
// RedundantSetterCall,' +
64+
// RedundantStringConversion,' +
65+
// RedundantStringEscape,' +
66+
// StringJoin,' +
67+
// UnnecessaryCheckNotNull,' +
68+
// UnnecessaryTypeArgument,' +
69+
// UnusedAnonymousClass,' +
70+
// UnusedCollectionModifiedInPlace,'
71+
)
72+
}
73+
}
74+
}

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)