Skip to content

Commit 6d13e79

Browse files
author
Vincent Potucek
committed
Add error-prone.picnic.tech
1 parent 90ff85a commit 6d13e79

File tree

69 files changed

+502
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+502
-226
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: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
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+
}
10+
11+
tasks.withType(JavaCompile).configureEach {
12+
options.errorprone {
13+
allErrorsAsWarnings = true
14+
disableWarningsInGeneratedCode = true
15+
disable(
16+
// avoid
17+
'StaticImport',
18+
// bug
19+
'AddNullMarkedToPackageInfo',
20+
'Slf4jLogStatement',
21+
'Slf4jLogStatement',
22+
)
23+
// dev opt-in
24+
if (!getenv().containsKey('CI') && getenv('IN_PLACE')?.toBoolean()) {
25+
// apply
26+
errorproneArgs.addAll(
27+
'-XepPatchLocation:IN_PLACE',
28+
'-XepPatchChecks:' +
29+
'AddNullMarkedToPackageInfo,' +
30+
'AlwaysThrows,' +
31+
'AmbiguousJsonCreator,' +
32+
'AndroidInjectionBeforeSuper,' +
33+
'ArrayEquals,' +
34+
'ArrayFillIncompatibleType,' +
35+
'ArrayHashCode,' +
36+
'ArrayToString,' +
37+
'ArraysAsListPrimitiveArray,' +
38+
'AssertJNullnessAssertion,' +
39+
'AsyncCallableReturnsNull,' +
40+
'AsyncFunctionReturnsNull,' +
41+
'AutoValueBuilderDefaultsInConstructor,' +
42+
'AutoValueConstructorOrderChecker,' +
43+
'AutowiredConstructor,' +
44+
'BadAnnotationImplementation,' +
45+
'BadShiftAmount,' +
46+
'BanJNDI,' +
47+
'BoxedPrimitiveEquality,' +
48+
'BundleDeserializationCast,' +
49+
'CanonicalAnnotationSyntax,' +
50+
'CanonicalClassNameUsage,' +
51+
'ChainingConstructorIgnoresParameter,' +
52+
'CheckNotNullMultipleTimes,' +
53+
'CheckReturnValue,' +
54+
'ClassCastLambdaUsage,' +
55+
'CollectionIncompatibleType,' +
56+
'CollectionToArraySafeParameter,' +
57+
'CollectorMutability,' +
58+
'ComparableType,' +
59+
'ComparingThisWithNull,' +
60+
'ComparisonOutOfRange,' +
61+
'CompatibleWithAnnotationMisuse,' +
62+
'CompileTimeConstant,' +
63+
'ComputeIfAbsentAmbiguousReference,' +
64+
'ConditionalExpressionNumericPromotion,' +
65+
'ConstantNaming,' +
66+
'ConstantOverflow,' +
67+
'DaggerProvidesNull,' +
68+
'DangerousLiteralNull,' +
69+
'DeadException,' +
70+
'DeadThread,' +
71+
'DefaultCharset,' +
72+
'DereferenceWithNullBranch,' +
73+
'DirectReturn,' +
74+
'DiscardedPostfixExpression,' +
75+
'DoNotCall,' +
76+
'DoNotMock,' +
77+
'DoubleBraceInitialization,' +
78+
'DuplicateMapKeys,' +
79+
'DurationFrom,' +
80+
'DurationGetTemporalUnit,' +
81+
'DurationTemporalUnit,' +
82+
'DurationToLongTimeUnit,' +
83+
'EagerStringFormatting,' +
84+
'EmptyMethod,' +
85+
'EmptyMonoZip,' +
86+
'EqualsHashCode,' +
87+
'EqualsNaN,' +
88+
'EqualsNull,' +
89+
'EqualsReference,' +
90+
'EqualsWrongThing,' +
91+
'ExplicitArgumentEnumeration,' +
92+
'ExplicitEnumOrdering,' +
93+
'FloggerFormatString,' +
94+
'FloggerLogString,' +
95+
'FloggerLogVarargs,' +
96+
'FloggerSplitLogStatement,' +
97+
'FluxFlatMapUsage,' +
98+
'FluxImplicitBlock,' +
99+
'ForOverride,' +
100+
'FormatString,' +
101+
'FormatStringAnnotation,' +
102+
'FormatStringConcatenation,' +
103+
'FromTemporalAccessor,' +
104+
'FunctionalInterfaceMethodChanged,' +
105+
'FunctionalInterfaceMethodChanged,' +
106+
'FuturesGetCheckedIllegalExceptionType,' +
107+
'FuzzyEqualsShouldNotBeUsedInEqualsMethod,' +
108+
'GetClassOnAnnotation,' +
109+
'GetClassOnClass,' +
110+
'GuardedBy,' +
111+
'GuiceAssistedInjectScoping,' +
112+
'GuiceAssistedParameters,' +
113+
'GuiceInjectOnFinalField,' +
114+
'HashtableContains,' +
115+
'IdentityBinaryExpression,' +
116+
'IdentityConversion,' +
117+
'IdentityHashMapBoxing,' +
118+
'Immutable,' +
119+
'ImmutableEnumChecker,' +
120+
'ImmutablesSortedSetComparator,' +
121+
'ImpossibleNullComparison,' +
122+
'Incomparable,' +
123+
'IncompatibleArgumentType,' +
124+
'IncompatibleModifiers,' +
125+
'IndexOfChar,' +
126+
'InexactVarargsConditional,' +
127+
'InfiniteRecursion,' +
128+
'InjectMoreThanOneScopeAnnotationOnClass,' +
129+
'InjectOnMemberAndConstructor,' +
130+
'InlineMeValidator,' +
131+
'InstantTemporalUnit,' +
132+
'InvalidJavaTimeConstant,' +
133+
'InvalidPatternSyntax,' +
134+
'InvalidTimeZoneID,' +
135+
'InvalidZoneId,' +
136+
'IsInstanceIncompatibleType,' +
137+
'IsInstanceLambdaUsage,' +
138+
'IsInstanceOfClass,' +
139+
'IsLoggableTagLength,' +
140+
'JUnit3TestNotRun,' +
141+
'JUnit4ClassAnnotationNonStatic,' +
142+
'JUnit4SetUpNotRun,' +
143+
'JUnit4TearDownNotRun,' +
144+
'JUnit4TestNotRun,' +
145+
'JUnit4TestsNotRunWithinEnclosed,' +
146+
'JUnitAssertSameCheck,' +
147+
'JUnitClassModifiers,' +
148+
'JUnitMethodDeclaration,' +
149+
'JUnitNullaryParameterizedTestDeclaration,' +
150+
'JUnitParameterMethodNotFound,' +
151+
'JUnitValueSource,' +
152+
'JavaxInjectOnAbstractMethod,' +
153+
'JodaToSelf,' +
154+
'LenientFormatStringValidation,' +
155+
'LexicographicalAnnotationAttributeListing,' +
156+
'LexicographicalAnnotationListing,' +
157+
'LiteByteStringUtf8,' +
158+
'LocalDateTemporalAmount,' +
159+
'LockOnBoxedPrimitive,' +
160+
'LoopConditionChecker,' +
161+
'LossyPrimitiveCompare,' +
162+
'MathRoundIntLong,' +
163+
'MislabeledAndroidString,' +
164+
'MisleadingEmptyVarargs,' +
165+
'MisleadingEscapedSpace,' +
166+
'MisplacedScopeAnnotations,' +
167+
'MissingOverride,' +
168+
'MissingSuperCall,' +
169+
'MissingTestCall,' +
170+
'MisusedDayOfYear,' +
171+
'MisusedWeekYear,' +
172+
'MixedDescriptors,' +
173+
'MockitoMockClassReference,' +
174+
'MockitoStubbing,' +
175+
'MockitoUsage,' +
176+
'ModifyingCollectionWithItself,' +
177+
'MongoDBTextFilterUsage,' +
178+
'MoreThanOneInjectableConstructor,' +
179+
'MustBeClosedChecker,' +
180+
'NCopiesOfChar,' +
181+
'NestedOptionals,' +
182+
'NestedPublishers,' +
183+
'NoCanIgnoreReturnValueOnClasses,' +
184+
'NonCanonicalStaticImport,' +
185+
'NonEmptyMono,' +
186+
'NonFinalCompileTimeConstant,' +
187+
'NonRuntimeAnnotation,' +
188+
'NonStaticImport,' +
189+
'NullArgumentForNonNullParameter,' +
190+
'NullTernary,' +
191+
'NullableOnContainingClass,' +
192+
'OptionalEquality,' +
193+
'OptionalMapUnusedValue,' +
194+
'OptionalOfRedundantMethod,' +
195+
'OptionalOrElseGet,' +
196+
'OverlappingQualifierAndScopeAnnotation,' +
197+
'OverridesJavaxInjectableMethod,' +
198+
'PackageInfo,' +
199+
'ParametersButNotParameterized,' +
200+
'ParcelableCreator,' +
201+
'PeriodFrom,' +
202+
'PeriodGetTemporalUnit,' +
203+
'PeriodTimeMath,' +
204+
'PreconditionsInvalidPlaceholder,' +
205+
'PrimitiveComparison,' +
206+
'PrivateSecurityContractProtoAccess,' +
207+
'ProtoBuilderReturnValueIgnored,' +
208+
'ProtoStringFieldReferenceEquality,' +
209+
'ProtoTruthMixedDescriptors,' +
210+
'ProtocolBufferOrdinal,' +
211+
'ProvidesMethodOutsideOfModule,' +
212+
'RandomCast,' +
213+
'RandomModInteger,' +
214+
'RectIntersectReturnValueIgnored,' +
215+
'RedundantSetterCall,' +
216+
'RedundantStringConversion,' +
217+
'RedundantStringEscape,' +
218+
'RefasterAnyOfUsage,' +
219+
'RequestMappingAnnotation,' +
220+
'RequestParamType,' +
221+
'RequiredModifiers,' +
222+
'RestrictedApi,' +
223+
'ReturnValueIgnored,' +
224+
'SelfAssertion,' +
225+
'SelfAssignment,' +
226+
'SelfComparison,' +
227+
'SelfEquals,' +
228+
'SetUnrecognized,' +
229+
'ShouldHaveEvenArgs,' +
230+
'SizeGreaterThanOrEqualsZero,' +
231+
'Slf4jLogStatement,' +
232+
'Slf4jLoggerDeclarationSlf4jLoggerDeclaration,' +
233+
'SpringMvcAnnotation,' +
234+
'StreamToString,' +
235+
'StringBuilderInitWithChar,' +
236+
'StringJoin,' +
237+
'SubstringOfZero,' +
238+
'SuppressWarningsDeprecated,' +
239+
'TemporalAccessorGetChronoField,' +
240+
'TestParametersNotInitialized,' +
241+
'TheoryButNoTheories,' +
242+
'ThreadBuilderNameWithPlaceholder,' +
243+
'ThrowIfUncheckedKnownChecked,' +
244+
'ThrowNull,' +
245+
'TimeZoneUsage,' +
246+
'TreeToString,' +
247+
'TryFailThrowable,' +
248+
'TypeParameterQualifier,' +
249+
'UnicodeDirectionalityCharacters,' +
250+
'UnicodeInCode,' +
251+
'UnnecessaryCheckNotNull,' +
252+
'UnnecessaryTypeArgument,' +
253+
'UnsafeWildcard,' +
254+
'UnusedAnonymousClass,' +
255+
'UnusedCollectionModifiedInPlace,' +
256+
'VarTypeName,' +
257+
'WrongOneof,' +
258+
'XorPower,' +
259+
'ZoneIdOfZ,'
260+
)
261+
}
262+
}
263+
}

lib-extra/src/jdt/java/com/diffplug/spotless/extra/glue/jdt/EclipseJdtSortMembers.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,64 +98,84 @@ private static class Buffer implements IBuffer {
9898
this.contents = contents;
9999
}
100100

101+
@Override
101102
public void addBufferChangedListener(IBufferChangedListener listener) {}
102103

104+
@Override
103105
public void append(char[] text) {}
104106

107+
@Override
105108
public void append(String text) {}
106109

110+
@Override
107111
public void close() {}
108112

113+
@Override
109114
public char getChar(int position) {
110115
return '\u0000';
111116
}
112117

118+
@Override
113119
public char[] getCharacters() {
114120
return contents.toCharArray();
115121
}
116122

123+
@Override
117124
public String getContents() {
118125
return contents;
119126
}
120127

128+
@Override
121129
public int getLength() {
122130
return 0;
123131
}
124132

133+
@Override
125134
public IOpenable getOwner() {
126135
return null;
127136
}
128137

138+
@Override
129139
public String getText(int offset, int length) {
130140
return null;
131141
}
132142

143+
@Override
133144
public IResource getUnderlyingResource() {
134145
return null;
135146
}
136147

148+
@Override
137149
public boolean hasUnsavedChanges() {
138150
return false;
139151
}
140152

153+
@Override
141154
public boolean isClosed() {
142155
return false;
143156
}
144157

158+
@Override
145159
public boolean isReadOnly() {
146160
return true;
147161
}
148162

163+
@Override
149164
public void removeBufferChangedListener(IBufferChangedListener listener) {}
150165

166+
@Override
151167
public void replace(int position, int length, char[] text) {}
152168

169+
@Override
153170
public void replace(int position, int length, String text) {}
154171

172+
@Override
155173
public void save(IProgressMonitor progress, boolean force) {}
156174

175+
@Override
157176
public void setContents(char[] contents) {}
158177

178+
@Override
159179
public void setContents(String contents) {
160180
this.contents = contents;
161181
}

lib-extra/src/main/java/com/diffplug/spotless/extra/GitWorkarounds.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ private static IOException emptyFile(File commonDir) {
202202
return new IOException("Empty 'commondir' file: " + commonDir.getAbsolutePath());
203203
}
204204

205-
@SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE")
206205
@Override
206+
@SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE")
207207
public FileRepositoryBuilder readEnvironment(SystemReader sr) {
208208
super.readEnvironment(sr);
209209

lib/src/compatKtLint0Dot48Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot48Dot0Adapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 DiffPlug
2+
* Copyright 2023-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -115,7 +115,7 @@ public String format(
115115
private static EditorConfigOverride createEditorConfigOverride(final List<Rule> rules, Map<String, Object> editorConfigOverrideMap) {
116116
// Get properties from rules in the rule sets
117117
Stream<EditorConfigProperty<?>> ruleProperties = rules.stream()
118-
.filter(rule -> rule instanceof UsesEditorConfigProperties)
118+
.filter(UsesEditorConfigProperties.class::isInstance)
119119
.flatMap(rule -> ((UsesEditorConfigProperties) rule).getEditorConfigProperties().stream());
120120

121121
// Create a mapping of properties to their names based on rule properties and default properties

lib/src/compatKtLint0Dot49Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot49Dot0Adapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 DiffPlug
2+
* Copyright 2023-2025 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@
5555

5656
public class KtLintCompat0Dot49Dot0Adapter implements KtLintCompatAdapter {
5757

58-
private static final Logger logger = LoggerFactory.getLogger(KtLintCompat0Dot49Dot0Adapter.class);
58+
private static final Logger LOGGER = LoggerFactory.getLogger(KtLintCompat0Dot49Dot0Adapter.class);
5959

6060
private static final List<EditorConfigProperty<?>> DEFAULT_EDITOR_CONFIG_PROPERTIES;
6161

0 commit comments

Comments
 (0)