Skip to content

Commit

Permalink
Remove conflicting checkstyle checks due to Spotless
Browse files Browse the repository at this point in the history
This is the minimal set of checkstyle rules that were conflicting with
the code format that Spotless would apply. Additionally, this adds a few
`MethodLength` suppressions since those methods will become slightly
longer than the limit after formatting has been applied.
  • Loading branch information
nastra authored and rdblue committed Jul 27, 2022
1 parent 2ea5b9e commit 6e7a5df
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 60 deletions.
59 changes: 0 additions & 59 deletions .baseline/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
<property name="severity" value="error"/>

<module name="FileTabCharacter"/> <!-- Java Style Guide: Whitespace characters -->
<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="NewlineAtEndOfFile"> <!-- Java Style Guide: Line ending: LF -->
<property name="lineSeparator" value="lf"/>
</module>
Expand Down Expand Up @@ -148,10 +144,6 @@
<property name="exceptionVariableName" value="expected"/>
</module>
<module name="EmptyForInitializerPad"/> <!-- Java Style Guide: Horizontal whitespace -->
<module name="EmptyLineSeparator"> <!-- Java Style Guide: Source file structure -->
<property name="tokens" value="PACKAGE_DEF, IMPORT, CLASS_DEF, ENUM_DEF, INTERFACE_DEF, CTOR_DEF, STATIC_INIT, INSTANCE_INIT, VARIABLE_DEF"/>
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="EmptyStatement"/> <!-- Java Style Guide: One statement per line -->
<module name="EqualsHashCode"/>
<module name="FallThrough"/> <!-- Java Style Guide: Fall-through: commented -->
Expand Down Expand Up @@ -255,20 +247,7 @@
<property name="illegalClassNames" value="com.google.common.cache.CacheBuilder, com.google.common.cache.Cache, com.google.common.cache.LoadingCache"/>
<message key="illegal.type" value="Do not use Guava caches, they are outperformed by and harder to use than Caffeine caches"/>
</module>
<module name="ImportOrder"> <!-- Java Style Guide: Ordering and spacing -->
<property name="groups" value="/.*/"/>
<property name="option" value="bottom"/>
<property name="separated" value="true"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>
<module name="Indentation"> <!-- Java Style Guide: Block indentation: +4 spaces -->
<property name="basicOffset" value="2"/>
<property name="arrayInitIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="caseIndent" value="2"/>
</module>
<module name="InnerAssignment"/> <!-- Java Coding Guidelines: Inner assignments: Not used -->
<module name="LeftCurly"/> <!-- 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 All @@ -287,19 +266,8 @@
<module name="NoClone"/> <!-- Java Coding Guidelines: Never override Object#finalize or Object#clone -->
<module name="NoFinalizer"/> <!-- Java Coding Guidelines: Never override Object#finalize -->
<module name="NoLineWrap"/> <!-- Java Style Guide: No line-wrapping -->
<module name="NoWhitespaceAfter"> <!-- Java Style Guide: Horizontal whitespace -->
<property name="allowLineBreaks" value="false"/>
<property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"> <!-- Java Style Guide: Horizontal whitespace -->
<property name="allowLineBreaks" value="true"/>
</module>
<module name="OneStatementPerLine"/> <!-- Java Style Guide: One statement per line -->
<module name="OneTopLevelClass"/> <!-- Java Style Guide: Exactly one top-level class declaration -->
<module name="OperatorWrap"> <!-- Java Style Guide: Where to break -->
<property name="option" value="EOL"/>
<property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>
</module>
<module name="OuterTypeFilename"/> <!-- Java Style Guide: File name -->
<module name="PackageAnnotation"/> <!-- Java Style Guide: Package statement -->
<module name="PackageDeclaration"/> <!-- Java Style Guide: Package statement -->
Expand Down Expand Up @@ -415,22 +383,6 @@
<property name="format" value="@Test\(.*expected.*\)"/>
<property name="message" value="Prefer using Assertions.assertThatThrownBy(...).isInstanceOf(...) instead."/>
</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"/>
</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"/>
</module>
<module name="SeparatorWrap"> <!-- Java Style Guide: Where to break -->
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap"> <!-- Java Style Guide: Where to break -->
<property name="tokens" value="COMMA"/>
<property name="option" value="EOL"/>
</module>
<module name="SimplifyBooleanExpression"/> <!-- Java Coding Guidelines: Keep Boolean expressions simple -->
<module name="SimplifyBooleanReturn"/> <!-- Java Coding Guidelines: Keep Boolean expressions simple -->
<module name="StaticVariableName"/> <!-- Java Style Guide: Naming -->
Expand All @@ -453,16 +405,6 @@
</module>
<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="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 Down Expand Up @@ -510,7 +452,6 @@
<message key="name.invalidPattern" value="Parameter name ''{0}'' must match pattern ''{1}''."/>
<property name="ignoreOverridden" value="true"/>
</module>
<module name="SingleLineJavadoc"/> <!-- Java Style Guide: General form -->

<!-- Stricter checks end -->
</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ private void assertEqualsForField(
}
}

@SuppressWarnings("MethodLength")
private void checkAllVectorValues(
int expectedNumRows,
List<GenericRecord> expectedRows,
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/apache/iceberg/RemoveSnapshots.java
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ private void cleanExpiredSnapshots() {
removeExpiredFiles(current.snapshots(), validIds, expiredIds);
}

@SuppressWarnings("checkstyle:CyclomaticComplexity")
@SuppressWarnings({"checkstyle:CyclomaticComplexity", "MethodLength"})
private void removeExpiredFiles(List<Snapshot> snapshots, Set<Long> validIds, Set<Long> expiredIds) {
// Reads and deletes are done using Tasks.foreach(...).suppressFailureWhenFinished to complete
// as much of the delete work as possible and avoid orphaned data or manifest files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,7 @@ public void testRemoveIdentifierFields() {
newSchema.identifierFieldIds());
}

@SuppressWarnings("MethodLength")
@Test
public void testSetIdentifierFieldsFails() {
Schema testSchema = new Schema(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class TestIcebergObjectInspector {
required(21, "time_field", Types.TimeType.get(), "time comment")
);

@SuppressWarnings("MethodLength")
@Test
public void testIcebergObjectInspector() {
ObjectInspector oi = IcebergObjectInspector.create(schema);
Expand Down

0 comments on commit 6e7a5df

Please sign in to comment.