Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-487

Update checkstyle to 6.1.1

    XMLWordPrintableJSON

    Details

    • Type: Wish
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 1.0.0-incubating
    • Fix Version/s: 1.14.0
    • Component/s: None
    • Labels:
      None

      Description

      Checkstyle 6.1.1 offers more consistent handling of indentations.
      I do not like that current checkstyle 5.7 tries to make arrays 2-indented, while IDEA makes them 4-aligned.

      I wish the style is as IDE-compatible as it could be (i.e. "reformat code" in IDE should result in checkstyle-acceptable code).

      The update is as "easy" as putting the following into pom.xml:

              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.12.1</version>
                <dependencies>
                  <dependency>
                    <groupId>com.puppycrawl.tools</groupId>
                    <artifactId>checkstyle</artifactId>
                    <version>6.1.1</version>
                  </dependency>
                </dependencies>
              </plugin>

      Checkstyle 6.1.1 complains a lot on array initializers.
      I did not manage to get "non indented" names of methods like groupingKeyExtractor in

        private static <K extends Comparable, V> Function1<Grouping<K, V>, K>
        groupingKeyExtractor() { // IDEA adds no indentation here, however checkstyle wants "6" here
          return new Function1<Grouping<K, V>, K>() {
            public K apply(Grouping<K, V> a0) {
              return a0.getKey();
            }
          };
        }

      With the following additions, the number of warnings is much less, however I wish the final style is IDE-compatible.

          <module name="Indentation">
            <property name="caseIndent" value="0"/>
            <property name="basicOffset" value="2"/>
            <property name="braceAdjustment" value="0"/>
            <property name="arrayInitIndent" value="2"/> <-- added -->
            <property name="throwsIndent" value="4"/> <-- added -->
            <property name="lineWrappingIndentation" value="4"/> <-- added -->
          </module>
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                vladimirsitnikov Vladimir Sitnikov
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: