Skip to content

Commit

Permalink
Excavator: Upgrades Baseline to the latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-excavator-bot committed Jan 8, 2022
1 parent 3b67bcb commit 47d3332
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 50 deletions.
65 changes: 23 additions & 42 deletions .baseline/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!--
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
Palantir Baseline Checkstyle configuration.
Authors: Robert Fink, Brian Worth, Merrick Zoubeiri, and many other contributors. Based in part on http://checkstyle.sourceforge.net/google_style.html
Please keep checks alphabetized with one exception: "relaxed" checks are grouped together at the bottom for easier disabling.
Check-specific comments reference documents internal to Palantir and can be safely ignored or removed.
-->

--><!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>
Expand Down Expand Up @@ -47,6 +41,10 @@
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
<module name="LineLength"> <!-- Java Style Guide: No line-wrapping -->
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="TreeWalker">
<module name="SuppressionCommentFilter"/> <!-- baseline-gradle: README.md -->
<module name="SuppressionCommentFilter">
Expand All @@ -65,7 +63,9 @@
<property name="tokens" value="VARIABLE_DEF"/>
<property name="allowSamelineMultipleAnnotations" value="true"/>
</module>
<module name="AnnotationUseStyle"/> <!-- Java Style Guide: Annotations -->
<module name="AnnotationUseStyle"> <!-- Java Style Guide: Annotations -->
<property name="trailingArrayComma" value="ignore"/>
</module>
<module name="ArrayTypeStyle"/> <!-- Java Style Guide: No C-style array declarations -->
<module name="AvoidEscapedUnicodeCharacters"> <!-- Java Style Guide: Non-ASCII characters -->
<property name="allowEscapesForControlCharacters" value="true"/>
Expand All @@ -77,14 +77,7 @@
</module>
<module name="AvoidStarImport"/> <!-- Java Style Guide: No wildcard imports -->
<module name="AvoidStaticImport"> <!-- Java Style Guide: No static imports -->
<property name="excludes" value="
com.google.common.base.Preconditions.*,
com.palantir.logsafe.Preconditions.*,
java.util.Collections.*,
java.util.stream.Collectors.*,
org.apache.commons.lang3.Validate.*,
org.assertj.core.api.Assertions.*,
org.mockito.Mockito.*"/>
<property name="excludes" value="com.google.common.base.Preconditions.*, com.palantir.logsafe.Preconditions.*, java.util.Collections.*, java.util.stream.Collectors.*, org.apache.commons.lang3.Validate.*, org.assertj.core.api.Assertions.*, org.mockito.Mockito.*"/>
</module>
<module name="ClassTypeParameterName"> <!-- Java Style Guide: Type variable names -->
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
Expand Down Expand Up @@ -134,12 +127,12 @@
<module name="IllegalImport"> <!-- Java Coding Guidelines: Import the canonical package -->
<property name="id" value="BanShadedClasses"/>
<property name="illegalPkgs" value=".*\.(repackaged|shaded|thirdparty)"/>
<property name="regexp" value="true" />
<property name="regexp" value="true"/>
<message key="import.illegal" value="Must not import repackaged classes."/>
</module>
<module name="IllegalImport">
<property name="illegalPkgs" value="^org\.gradle\.(internal|.*\.internal)"/>
<property name="regexp" value="true" />
<property name="regexp" value="true"/>
<message key="import.illegal" value="Do not rely on gradle internal classes as these may change in minor releases - use org.gradle.api versions instead."/>
</module>
<module name="IllegalImport">
Expand Down Expand Up @@ -192,11 +185,9 @@
<property name="separated" value="true"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>

<module name="InnerAssignment"/> <!-- Java Coding Guidelines: Inner assignments: Not used -->
<module name="LineLength"> <!-- Java Style Guide: No line-wrapping -->
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<!-- Java Style Guide: Nonempty blocks: K & R style -->
<module name="MemberName"> <!-- Java Style Guide: Non-constant field names -->
<property name="format" value="^[a-z][a-zA-Z0-9]+$"/>
<message key="name.invalidPattern" value="Member name ''{0}'' must match pattern ''{1}''."/>
Expand Down Expand Up @@ -237,6 +228,7 @@
<message key="name.invalidPattern" value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterAssignment"/> <!-- Java Coding Guidelines: Final variables and parameters -->
<!-- Java Style Guide: Horizontal whitespace -->
<module name="RedundantImport"/> <!-- Java Style Guide: No unused imports -->
<module name="RedundantModifier"/> <!-- Java Coding Guidelines: Avoid redundant modifiers -->
<module name="RegexpSinglelineJava"> <!-- Java Coding Guidelines: Use appropriate assertion methods -->
Expand Down Expand Up @@ -352,7 +344,7 @@
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="\bCharset.defaultCharset\("/>
<property name="message" value="Use explicit charset (e.g. StandardCharsets.UTF-8) instead of default."/>
<property name="message" value="Use explicit charset (e.g. StandardCharsets.UTF_8) instead of default."/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="\bIOUtils\.toString\("/>
Expand All @@ -361,18 +353,19 @@
<module name="RegexpSinglelineJava">
<property name="format" value="\/\/TODO|\/\/ TODO(?!\([^()\s]+\): )"/>
<property name="message" value="TODO format: // TODO(#issue): explanation"/>
<property name="ignoreCase" value="true"/>
</module>
<module name="RegexpSinglelineJava">
<property name="format" value="(void setUp\(\))|(void setup\(\))|(void setupStatic\(\))|(void setUpStatic\(\))|(void beforeTest\(\))|(void teardown\(\))|(void tearDown\(\))|(void beforeStatic\(\))|(void afterStatic\(\))"/>
<property name="message" value="Test setup/teardown methods are called before(), beforeClass(), after(), afterClass(), but not setUp, teardown, etc."/>
</module>
<module name="RightCurly"> <!-- Java Style Guide: Nonempty blocks: K & R style -->
<property name="option" value="same"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_DO"/>
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_DO"/>
</module>
<module name="RightCurly"> <!-- Java Style Guide: Nonempty blocks: K & R style -->
<property name="option" value="alone"/>
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
<property name="tokens" value="LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
</module>
<module name="SeparatorWrap"> <!-- Java Style Guide: Where to break -->
<property name="tokens" value="DOT"/>
Expand All @@ -390,7 +383,7 @@
<module name="SuppressWarnings">
<property name="format" value="serial"/>
</module>
<module name="SuppressWarningsHolder" /> <!-- Required for SuppressWarningsFilter -->
<module name="SuppressWarningsHolder"/> <!-- Required for SuppressWarningsFilter -->
<module name="TypeName"> <!-- Java Style Guide: Class names -->
<message key="name.invalidPattern" value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
Expand All @@ -401,16 +394,7 @@
<module name="UpperEll"/> <!-- Java Style Guide: Numeric Literals -->
<module name="VisibilityModifier"/> <!-- Java Coding Guidelines: Minimize mutability -->
<module name="WhitespaceAfter"/> <!-- Java Style Guide: Horizontal whitespace -->
<module name="WhitespaceAround"> <!-- Java Style Guide: Horizontal whitespace -->
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="ignoreEnhancedForColon" value="false"/>
<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)"/>
<message key="ws.notPreceded" value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>


<!-- Stricter checks begin: delete some or all of the following for faster prototyping, but please restore before pushing to production. -->

Expand All @@ -423,13 +407,10 @@
<property name="ignoredAnnotations" value="ParameterizedTest, Test, Before, BeforeEach, After, AfterEach, BeforeClass, BeforeAll, AfterClass, AfterAll"/>
</module>
<module name="JavadocMethod"> <!-- Java Style Guide: Where Javadoc is used -->
<property name="scope" value="public"/>
<property name="accessModifiers" value="public"/>
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingThrowsTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="minLineCount" value="99999999"/>
<property name="allowedAnnotations" value="Override, Test"/>
<property name="allowThrowsTagsForSubclasses" value="true"/>
</module>
<module name="JavadocStyle"/> <!-- Java Style Guide: Javadoc -->
<module name="JavadocTagContinuationIndentation"> <!-- Java Style Guide: At-clauses -->
Expand Down Expand Up @@ -462,4 +443,4 @@

<!-- Stricter checks end -->
</module>
</module>
</module>
12 changes: 12 additions & 0 deletions .baseline/idea/intellij-java-palantir-style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@
<package name="" withSubpackages="true" static="false" />
</value>
</option>
<DO_NOT_IMPORT_INNER>
<CLASS name="Builder" />
<CLASS name="Callback" />
<CLASS name="Class" />
<CLASS name="Entry" />
<CLASS name="Enum" />
<CLASS name="Factory" />
<CLASS name="Type" />
<CLASS name="Key" />
<CLASS name="Id" />
<CLASS name="Provider" />
</DO_NOT_IMPORT_INNER>
</GroovyCodeStyleSettings>
<option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
<option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ buildscript {
classpath 'com.palantir.gradle.externalpublish:gradle-external-publish-plugin:1.4.0'
classpath 'com.palantir.javaformat:gradle-palantir-java-format:1.0.1'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:1.17.2'
classpath 'com.palantir.baseline:gradle-baseline-java:3.14.1'
classpath 'com.palantir.baseline:gradle-baseline-java:4.56.0'
classpath 'com.palantir.gradle.conjure:gradle-conjure:4.18.0'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.2'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.6.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ private PythonFile getImplPythonFile(

PythonPackage rootPackage = PythonPackage.of(implPackageNameProcessor.process(""));
List<PythonFile> pythonFiles = KeyedStream.stream(snippetsByPackage)
.map((pythonPackage, pythonSnippets) -> PythonFile.builder()
.map((_pythonPackage, pythonSnippets) -> PythonFile.builder()
.pythonPackage(rootPackage)
.fileName(IMPL_PY)
.contents(pythonSnippets)
Expand Down Expand Up @@ -239,7 +239,7 @@ private PythonFile getRootInit(Set<PythonPackage> packageNames, PythonPackage ro
.text(String.format("__conjure_generator_version__ = \"%s\"", config.generatorVersion()))
.build());
config.packageVersion()
.ifPresent(version -> builder.addContents(PythonLine.builder()
.ifPresent(_version -> builder.addContents(PythonLine.builder()
.pythonPackage(rootPackage)
.text(String.format(
"__version__ = \"%s\"", config.packageVersion().get()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static List<AliasSnippet> getSortedSnippets(List<AliasSnippet> snippets)
.collect(Collectors.toSet());
Map<AliasSnippet, Integer> nonRootsToInDegree = mutableGraph.nodes().stream()
.filter(node -> mutableGraph.inDegree(node) > 0)
.collect(Collectors.toMap(node -> node, mutableGraph::inDegree, (a, b) -> a));
.collect(Collectors.toMap(node -> node, mutableGraph::inDegree, (a, _b) -> a));

// Kahn's Algorithm https://en.wikipedia.org/wiki/Topological_sorting#Kahn's_algorithm
while (!roots.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private PythonEndpointDefinition generateEndpoint(
.myPyType(argEntry.getType().accept(myPyTypeNameVisitor))
.isOptional(dealiasingTypeVisitor
.dealias(argEntry.getType())
.fold(typeDefinition -> false, type -> type.accept(TypeVisitor.IS_OPTIONAL)))
.fold(_typeDefinition -> false, type -> type.accept(TypeVisitor.IS_OPTIONAL)))
.build())
.collect(Collectors.toList());

Expand All @@ -128,7 +128,7 @@ private PythonEndpointDefinition generateEndpoint(
.getReturns()
.map(rt -> dealiasingTypeVisitor
.dealias(rt)
.fold(typeDefinition -> false, type -> type.accept(TypeVisitor.IS_OPTIONAL)))
.fold(_typeDefinition -> false, type -> type.accept(TypeVisitor.IS_OPTIONAL)))
.orElse(false))
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private BeanSnippet generateBean(ObjectDefinition typeDef) {
.myPyType(entry.getType().accept(myPyTypeNameVisitor))
.isOptional(dealiasingTypeVisitor
.dealias(entry.getType())
.fold(typeDefinition -> false, type -> type.accept(TypeVisitor.IS_OPTIONAL)))
.fold(_typeDefinition -> false, type -> type.accept(TypeVisitor.IS_OPTIONAL)))
.build())
.collect(Collectors.toList());

Expand Down Expand Up @@ -166,7 +166,7 @@ private UnionSnippet generateUnion(UnionDefinition typeDef) {
.pythonType(conjureType.accept(pythonTypeNameVisitor))
.isOptional(dealiasingTypeVisitor
.dealias(unionMember.getType())
.fold(typeDefinition -> false, type -> type.accept(TypeVisitor.IS_OPTIONAL)))
.fold(_typeDefinition -> false, type -> type.accept(TypeVisitor.IS_OPTIONAL)))
.build();
})
.collect(Collectors.toList());
Expand Down

0 comments on commit 47d3332

Please sign in to comment.