nebula-java icon indicating copy to clipboard operation
nebula-java copied to clipboard

Use spotless to format code to standard

Open wdroste opened this issue 3 years ago • 2 comments

Its great to have checkstyle for a community project its even better if the build can format the code to the standard.

My suggestion would be to use spotless https://github.com/diffplug/spotless/tree/main/plugin-maven

wdroste avatar Nov 07 '22 01:11 wdroste

Applied this to project and then used checkstyle:check to verify and they are different.

            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>apply</goal>
                        </goals>
                        <phase>compile</phase>
                    </execution>
                </executions>
                <configuration>
                    <!-- define a language-specific format -->
                    <java>
                        <importOrder/>
                        <removeUnusedImports/>
                        <googleJavaFormat>
                            <version>1.15.0</version>
                            <style>AOSP</style>
                        </googleJavaFormat>
                    </java>
                </configuration>
            </plugin>

wdroste avatar Nov 07 '22 01:11 wdroste

related pr https://github.com/vesoft-inc/nebula-java/pull/486

Nicole00 avatar Dec 29 '22 02:12 Nicole00