Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use spotless to format code to standard #485

Open
wdroste opened this issue Nov 7, 2022 · 2 comments
Open

Use spotless to format code to standard #485

wdroste opened this issue Nov 7, 2022 · 2 comments
Labels
type/enhancement Type: make the code neat or more efficient

Comments

@wdroste
Copy link
Contributor

wdroste commented Nov 7, 2022

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
Copy link
Contributor Author

wdroste commented Nov 7, 2022

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>

@Sophie-Xie Sophie-Xie added the type/enhancement Type: make the code neat or more efficient label Nov 30, 2022
@Nicole00
Copy link
Contributor

related pr #486

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Type: make the code neat or more efficient
Projects
None yet
Development

No branches or pull requests

3 participants