Skip to content

Commit ce8bb65

Browse files
Excavator: Upgrades Baseline to the latest version
1 parent 35a2d73 commit ce8bb65

File tree

10 files changed

+74
-36
lines changed

10 files changed

+74
-36
lines changed

.baseline/checkstyle/checkstyle-suppressions.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?xml version="1.0"?>
2-
32
<!DOCTYPE suppressions PUBLIC
4-
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
5-
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
3+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
4+
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
65

76
<!-- IMPORTANT ECLIPSE NOTE: If you change this file, you must restart Eclipse
87
for your changes to take effect in its Checkstyle integration. -->
@@ -12,6 +11,11 @@
1211
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" checks="VariableDeclarationUsageDistance" />
1312
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" checks="VisibilityModifier" />
1413
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" checks="AvoidStaticImport" />
14+
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" id="BanSystemOut" />
15+
<suppress files="[/\\]src[/\\].*[Tt]est[/\\](java|groovy)[/\\]" id="BanSystemErr" />
16+
17+
<!-- Suppress test resources -->
18+
<suppress files="[/\\]src[/\\]test[/\\]resources.*" checks="." />
1519

1620
<!-- JavadocStyle enforces existence of package-info.java package-level Javadoc; we consider this a bug. -->
1721
<suppress files="package-info.java" checks="JavadocStyle" />

.baseline/checkstyle/checkstyle.xml

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE module PUBLIC
3-
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4-
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
55

66
<!--
77
Palantir Baseline Checkstyle configuration.
@@ -40,14 +40,22 @@
4040
<property name="message" value="Whitespace at end-of-line"/>
4141
</module>
4242
<module name="RegexpMultiline"> <!-- Java Style Guide: Vertical Whitespace -->
43-
<property name="fileExtensions" value="java"/>
43+
<property name="fileExtensions" value="java"/>
4444
<property name="format" value="^\n\n$"/>
4545
<property name="message" value="Two consecutive blank lines are not permitted."/>
4646
</module>
4747
<module name="SuppressionFilter"> <!-- baseline-gradle: README.md -->
4848
<property name="file" value="${config_loc}/checkstyle-suppressions.xml"/>
4949
</module>
50+
<module name="SuppressionFilter"> <!-- baseline-gradle: README.md -->
51+
<!-- custom-suppressions.xml allows users to specify suppresions that will not be overriden by baselineUpdateConfig -->
52+
<property name="file" value="${config_loc}/custom-suppressions.xml"/>
53+
<property name="optional" value="true"/>
54+
</module>
5055
<module name="SuppressWarningsFilter"/> <!-- baseline-gradle: README.md -->
56+
<module name="BeforeExecutionExclusionFileFilter">
57+
<property name="fileNamePattern" value="module\-info\.java$"/>
58+
</module>
5159
<module name="TreeWalker">
5260
<module name="SuppressionCommentFilter"/> <!-- baseline-gradle: README.md -->
5361
<module name="SuppressionCommentFilter">
@@ -79,11 +87,13 @@
7987
<module name="AvoidStarImport"/> <!-- Java Style Guide: No wildcard imports -->
8088
<module name="AvoidStaticImport"> <!-- Java Style Guide: No static imports -->
8189
<property name="excludes" value="
90+
com.google.common.base.Preconditions.*,
91+
com.palantir.logsafe.Preconditions.*,
8292
java.util.Collections.*,
8393
java.util.stream.Collectors.*,
84-
com.palantir.logsafe.Preconditions.*,
85-
com.google.common.base.Preconditions.*,
86-
org.apache.commons.lang3.Validate.*"/>
94+
org.apache.commons.lang3.Validate.*,
95+
org.assertj.core.api.Assertions.*,
96+
org.mockito.Mockito.*"/>
8797
</module>
8898
<module name="ClassTypeParameterName"> <!-- Java Style Guide: Type variable names -->
8999
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
@@ -105,7 +115,6 @@
105115
<module name="EmptyStatement"/> <!-- Java Style Guide: One statement per line -->
106116
<module name="EqualsHashCode"/>
107117
<module name="FallThrough"/> <!-- Java Style Guide: Fall-through: commented -->
108-
<module name="FinalClass"/> <!-- Java Coding Guidelines: Private constructors -->
109118
<module name="GenericWhitespace"> <!-- Java Style Guide: Horizontal whitespace -->
110119
<message key="ws.followed" value="GenericWhitespace ''{0}'' is followed by whitespace."/>
111120
<message key="ws.preceded" value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
@@ -122,11 +131,17 @@
122131
<property name="illegalPkgs" value="junit.framework"/>
123132
<message key="import.illegal" value="Use JUnit 4-style (org.junit.*) test classes and assertions instead of JUnit 3 (junit.framework.*)."/>
124133
</module>
134+
<module name="IllegalImport"> <!-- Only relevant for pre-Java 11 because javafx is gone completely in Java 11 -->
135+
<property name="id" value="BanJavafx"/>
136+
<property name="illegalPkgs" value="javafx"/>
137+
<message key="import.illegal" value="Must not import javafx classes because some OpenJDK builds do not include javafx."/>
138+
</module>
125139
<module name="IllegalImport"> <!-- Java Coding Guidelines: Import the canonical package -->
126140
<property name="illegalPkgs" value="org.elasticsearch.common.base, com.clearspring.analytics.util, org.spark_project.guava"/>
127141
<message key="import.illegal" value="Must not import repackaged classes."/>
128142
</module>
129143
<module name="IllegalImport"> <!-- Java Coding Guidelines: Import the canonical package -->
144+
<property name="id" value="BanShadedClasses"/>
130145
<property name="illegalPkgs" value=".*\.(repackaged|shaded|thirdparty)"/>
131146
<property name="regexp" value="true" />
132147
<message key="import.illegal" value="Must not import repackaged classes."/>
@@ -334,6 +349,18 @@
334349
<property name="message" value="printStackTrace is not generally allowed."/>
335350
<property name="ignoreComments" value="true"/>
336351
</module>
352+
<module name="RegexpSinglelineJava">
353+
<property name="id" value="BanSystemOut"/>
354+
<property name="format" value="System\.out\."/>
355+
<property name="message" value="Logging with System.out is not allowed because it has no metadata and can't be configured at runtime. Please use an SLF4J logger instead, e.g. log.info(&quot;Message&quot;)."/>
356+
<property name="ignoreComments" value="true"/>
357+
</module>
358+
<module name="RegexpSinglelineJava">
359+
<property name="id" value="BanSystemErr"/>
360+
<property name="format" value="System\.err\."/>
361+
<property name="message" value="Logging with System.err is not allowed because it has no metadata and can't be configured at runtime. Please use an SLF4J logger instead, e.g. log.info(&quot;Message&quot;)."/>
362+
<property name="ignoreComments" value="true"/>
363+
</module>
337364
<module name="RegexpSinglelineJava">
338365
<property name="format" value="\bCharsets\."/>
339366
<property name="message" value="Use JDK StandardCharsets instead of alternatives."/>
@@ -346,10 +373,6 @@
346373
<property name="format" value="\bIOUtils\.toString\("/>
347374
<property name="message" value="Prefer Guava''s [CharStreams,Files,Resources].toString to avoid charset/stream closing issues."/>
348375
</module>
349-
<module name="RegexpSinglelineJava">
350-
<property name="format" value="static enum"/>
351-
<property name="message" value="Redundant ''static'' modifier."/>
352-
</module>
353376
<module name="RegexpSinglelineJava">
354377
<property name="format" value="\/\/TODO|\/\/ TODO(?!\([^()\s]+\): )"/>
355378
<property name="message" value="TODO format: // TODO(#issue): explanation"/>
@@ -399,6 +422,7 @@
399422
<property name="allowEmptyMethods" value="true"/>
400423
<property name="allowEmptyTypes" value="true"/>
401424
<property name="allowEmptyLoops" value="true"/>
425+
<property name="allowEmptyLambdas" value="true"/>
402426
<property name="ignoreEnhancedForColon" value="false"/>
403427
<message key="ws.notFollowed" value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
404428
<message key="ws.notPreceded" value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
@@ -412,7 +436,7 @@
412436
</module>
413437
<module name="CyclomaticComplexity"/> <!-- Java Coding Guidelines: Reduce Cyclomatic Complexity -->
414438
<module name="DesignForExtension"> <!-- Java Coding Guidelines: Design for extension -->
415-
<property name="ignoredAnnotations" value="Test, Before, BeforeEach, After, AfterEach, BeforeClass, BeforeAll, AfterClass, AfterAll"/>
439+
<property name="ignoredAnnotations" value="ParameterizedTest, Test, Before, BeforeEach, After, AfterEach, BeforeClass, BeforeAll, AfterClass, AfterAll"/>
416440
</module>
417441
<module name="JavadocMethod"> <!-- Java Style Guide: Where Javadoc is used -->
418442
<property name="scope" value="public"/>
@@ -445,10 +469,9 @@
445469
<module name="NestedTryDepth"/> <!-- Java Coding Guide: Try/catch blocks: never nested -->
446470
<module name="NonEmptyAtclauseDescription"/> <!-- Java Style Guide: At-clauses -->
447471
<module name="ParameterName"> <!-- Java Style Guide: Parameter names -->
448-
<property name="format" value="^[a-z][a-zA-Z0-9]+$"/>
472+
<property name="format" value="^_?[a-z][a-zA-Z0-9]+$"/>
449473
<message key="name.invalidPattern" value="Parameter name ''{0}'' must match pattern ''{1}''."/>
450474
</module>
451-
<module name="SingleLineJavadoc"/> <!-- Java Style Guide: General form -->
452475
<module name="SummaryJavadocCheck"> <!-- Java Coding Guidelines: Javadoc -->
453476
<property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
454477
</module>

.baseline/idea/intellij-java-palantir-style.xml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<option name="JD_KEEP_EMPTY_EXCEPTION" value="false" />
5151
<option name="JD_KEEP_EMPTY_PARAMETER" value="false" />
5252
<option name="JD_KEEP_EMPTY_RETURN" value="false" />
53+
<option name="JD_PRESERVE_LINE_FEEDS" value="true" />
5354
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
5455
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
5556
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
@@ -85,34 +86,44 @@
8586
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
8687
<option name="ALIGN_MULTILINE_RESOURCES" value="false" />
8788
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
89+
<option name="ASSIGNMENT_WRAP" value="1" />
8890
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
8991
<option name="BINARY_OPERATION_WRAP" value="1" />
9092
<option name="BLANK_LINES_AROUND_METHOD_IN_INTERFACE" value="0" />
91-
<option name="CALL_PARAMETERS_WRAP" value="1" />
93+
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
94+
<option name="CALL_PARAMETERS_WRAP" value="5" />
9295
<option name="DOWHILE_BRACE_FORCE" value="3" />
96+
<option name="ENUM_CONSTANTS_WRAP" value="2" />
9397
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
9498
<option name="EXTENDS_LIST_WRAP" value="1" />
9599
<option name="FIELD_ANNOTATION_WRAP" value="1" />
96100
<option name="FOR_BRACE_FORCE" value="3" />
97101
<option name="FOR_STATEMENT_WRAP" value="1" />
98102
<option name="IF_BRACE_FORCE" value="3" />
99-
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
103+
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
104+
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
105+
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
100106
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
101107
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
102108
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true" />
109+
<option name="KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE" value="true" />
103110
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
104111
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
105112
<option name="LINE_COMMENT_ADD_SPACE" value="true" />
106-
<option name="METHOD_PARAMETERS_WRAP" value="1" />
113+
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
114+
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
115+
<option name="METHOD_PARAMETERS_WRAP" value="5" />
107116
<option name="OPTIMIZE_IMPORTS_ON_THE_FLY" value="true" />
108117
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
109118
<option name="RESOURCE_LIST_WRAP" value="5" />
119+
<option name="RIGHT_MARGIN" value="120" />
110120
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
111121
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
112-
<option name="TERNARY_OPERATION_WRAP" value="1" />
122+
<option name="TERNARY_OPERATION_WRAP" value="5" />
113123
<option name="THROWS_KEYWORD_WRAP" value="1" />
114124
<option name="THROWS_LIST_WRAP" value="1" />
115125
<option name="WHILE_BRACE_FORCE" value="3" />
126+
<option name="WRAP_ON_TYPING" value="1" />
116127
<arrangement>
117128
<rules>
118129
<section>

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ buildscript {
2929
classpath 'com.netflix.nebula:gradle-info-plugin:5.1.1'
3030
classpath 'com.netflix.nebula:nebula-publishing-plugin:14.0.0'
3131
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
32-
classpath 'com.palantir.baseline:gradle-baseline-java:0.37.4'
32+
classpath 'com.palantir.baseline:gradle-baseline-java:2.35.0'
3333
classpath 'com.palantir.gradle.conjure:gradle-conjure:4.13.4'
3434
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.2'
3535
}

test-cases-internal/src/main/java/com/palantir/conjure/verification/EndpointNameConjureTypeVisitor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*/
3636
public final class EndpointNameConjureTypeVisitor implements ConjureTypeVisitor<String> {
3737
@Override
38-
public String visitAny(AnyType type) {
38+
public String visitAny(AnyType _type) {
3939
return "any";
4040
}
4141

@@ -77,12 +77,12 @@ public String visitSet(SetType type) {
7777
}
7878

7979
@Override
80-
public String visitBinary(BinaryType type) {
80+
public String visitBinary(BinaryType _type) {
8181
return "binary";
8282
}
8383

8484
@Override
85-
public String visitDateTime(DateTimeType type) {
85+
public String visitDateTime(DateTimeType _type) {
8686
return "datetime";
8787
}
8888
}

test-cases-internal/src/main/java/com/palantir/conjure/verification/GenerateClientServices.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
package com.palantir.conjure.verification;
66

7-
import com.google.common.base.Preconditions;
87
import com.google.common.collect.ImmutableMap;
98
import com.google.common.io.MoreFiles;
109
import com.google.common.io.RecursiveDeleteOption;
@@ -19,7 +18,8 @@ public final class GenerateClientServices {
1918
private GenerateClientServices() {}
2019

2120
public static void main(String... args) throws IOException {
22-
Preconditions.checkArgument(args.length == 2, "Usage: <master-test-cases.yml> <gitignored output dir>");
21+
com.palantir.logsafe.Preconditions.checkArgument(
22+
args.length == 2, "Usage: <master-test-cases.yml> <gitignored output dir>");
2323
File file = new File(args[0]);
2424
File outputDir = new File(args[1]);
2525

test-cases-internal/src/main/java/com/palantir/conjure/verification/GenerateServerServices.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
package com.palantir.conjure.verification;
66

7-
import com.google.common.base.Preconditions;
87
import com.google.common.collect.ImmutableMap;
98
import com.google.common.io.MoreFiles;
109
import com.google.common.io.RecursiveDeleteOption;
@@ -19,7 +18,8 @@ public final class GenerateServerServices {
1918
private GenerateServerServices() {}
2019

2120
public static void main(String... args) throws IOException {
22-
Preconditions.checkArgument(args.length == 2, "Usage: <master-test-cases.yml> <gitignored output dir>");
21+
com.palantir.logsafe.Preconditions.checkArgument(
22+
args.length == 2, "Usage: <master-test-cases.yml> <gitignored output dir>");
2323
File file = new File(args[0]);
2424
File outputDir = new File(args[1]);
2525

test-cases-internal/src/main/java/com/palantir/conjure/verification/ResolveLocalReferencesConjureTypeVisitor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*/
3434
public final class ResolveLocalReferencesConjureTypeVisitor implements ConjureTypeVisitor<String> {
3535
@Override
36-
public String visitAny(AnyType type) {
36+
public String visitAny(AnyType _type) {
3737
return "any";
3838
}
3939

@@ -75,12 +75,12 @@ public String visitSet(SetType type) {
7575
}
7676

7777
@Override
78-
public String visitBinary(BinaryType type) {
78+
public String visitBinary(BinaryType _type) {
7979
return "binary";
8080
}
8181

8282
@Override
83-
public String visitDateTime(DateTimeType type) {
83+
public String visitDateTime(DateTimeType _type) {
8484
return "datetime";
8585
}
8686
}

verification-client-api/src/main/java/com/palantir/conjure/verification/client/CompileVerificationClientTestCasesJson.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import static java.util.stream.Collectors.toSet;
2020

2121
import com.fasterxml.jackson.databind.ObjectMapper;
22-
import com.google.common.base.Preconditions;
2322
import com.google.common.collect.ImmutableMap;
2423
import com.google.common.collect.Sets;
2524
import com.google.common.collect.Streams;
@@ -49,7 +48,8 @@ private CompileVerificationClientTestCasesJson() {}
4948

5049
public static void main(String... args) throws IOException {
5150

52-
Preconditions.checkArgument(args.length == 2, "Usage: <master-test-cases.yml> <client-test-cases.json>");
51+
com.palantir.logsafe.Preconditions.checkArgument(
52+
args.length == 2, "Usage: <master-test-cases.yml> <client-test-cases.json>");
5353
File file = new File(args[0]);
5454
File outputFile = new File(args[1]);
5555

verification-server-api/src/main/java/com/palantir/conjure/verification/server/CompileVerificationServerTestCasesJson.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import static java.util.stream.Collectors.toSet;
88

99
import com.fasterxml.jackson.databind.ObjectMapper;
10-
import com.google.common.base.Preconditions;
1110
import com.google.common.collect.ImmutableMap;
1211
import com.google.common.collect.Sets;
1312
import com.google.common.collect.Streams;
@@ -40,7 +39,8 @@ private CompileVerificationServerTestCasesJson() {}
4039

4140
public static void main(String... args) throws IOException {
4241

43-
Preconditions.checkArgument(args.length == 2, "Usage: <master-test-cases.yml> <server-test-cases.json>");
42+
com.palantir.logsafe.Preconditions.checkArgument(
43+
args.length == 2, "Usage: <master-test-cases.yml> <server-test-cases.json>");
4444
File file = new File(args[0]);
4545
File outputFile = new File(args[1]);
4646

0 commit comments

Comments
 (0)