Skip to content
Andrea Aime edited this page Apr 18, 2018 · 6 revisions

GeoTools, GeoWebCache and GeoServer Codebase Reformat

Description

Perform mass reformats of all active branches to address:

  • Inconsistent formatting across the project
  • Number of files unreadable and hard to edit (mostly mixing tabs and space)
  • Friction on pull requests about current rule of “fix what you edit but don’t touch the rest”

The approach used is to adopt the Google styling convention, in particular the AOSP variant, and use the available maven integration for one time reformat and continuous build checks:

These are sample branches already reformatted with the tool (the process will be performed anew on the current codebases once the proposal is accepted). Please check them to verify how files will be modified (evident changes are tabs vs spaces, column widths, continuations for long statements)

The following approaches were also considered:

  • Maven and formatter-maven-plugin
  • One time IntelliJ reformat and checkstyle (thousands of manual fixes still needed after reformat to make the build pass under checkstyle)

References:

Status

Choose one of:

  • Under Discussion
  • In Progress
  • Completed
  • Rejected,
  • Deferred

Voting:

  • Andrea Aime: +1
  • Ben Caradoc-Davies: +1
  • Christian Mueller:
  • Ian Turton: +1
  • Justin Deoliveira: +1
  • Jody Garnett:
  • Simone Giannecchini:

And from the GeoServer PSC we have also:

  • Alessio Fabiani:
  • Brad Hards: +1
  • Jukka Rahkonen:
  • Kevin Smith: +1

Tasks

  1. Manually reformat master, add check style to build
  2. Manually reformat stable branch
  3. Manually reformat maintenance branch
  4. No documentation changes are required (build will now fail if style conventions not followed)

Build Change

<plugin>
<groupId>com.coveo</groupId>
    <artifactId>fmt-maven-plugin</artifactId>
    <configuration>
        <verbose>false</verbose>
        <filesNamePattern>.*\.java</filesNamePattern>
        <skip>false</skip>
        <style>aosp</style>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Clone this wiki locally