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

Enforce Google Java Style. #3

Closed
Clivern opened this issue Sep 23, 2019 · 3 comments · Fixed by #5
Closed

Enforce Google Java Style. #3

Clivern opened this issue Sep 23, 2019 · 3 comments · Fixed by #5
Assignees
Labels
enhancement New feature or request Hacktoberfest

Comments

@Clivern
Copy link
Owner

Clivern commented Sep 23, 2019

No description provided.

@Clivern Clivern added enhancement New feature or request Hacktoberfest labels Sep 23, 2019
@IEnoobong
Copy link
Contributor

IEnoobong commented Sep 25, 2019

Hi @Clivern Happy to take this up for #Hacktoberfest!

If I may ask, why AOSP style and not say Google Java Style guide, since this is not an Android project?

Same as Clivern/Racter#13

@Clivern
Copy link
Owner Author

Clivern commented Sep 26, 2019

Sure you can take this over and Clivern/Racter#13. I chosen the AOSP style because it is more readable. I kind of hate the google style with the 2 whitespace ident. But you can use it indeed for a PR.

I was thinking to use https://github.com/sherter/google-java-format-gradle-plugin. I used it somewhere else and works as expected.

Here's part of my build.gradle

plugins {
    id 'com.github.sherter.google-java-format' version '0.8'
}

googleJavaFormat {
  options style: 'AOSP'
}

It gives you two gradle tasks to format & verify

$ ./gradlew goJF --info
$ ./gradlew verGJF --info

or you can give https://github.com/diffplug/spotless a try

plugins {
    id 'com.diffplug.gradle.spotless' version '3.24.3'
}

spotless {
    java {
        licenseHeaderFile 'spotless.license.java'
        importOrder 'java'
    }
}
$ ./gradlew spotlessApply
$ ./gradlew spotlessJavaCheck

@IEnoobong
Copy link
Contributor

IEnoobong commented Sep 26, 2019

Great, A number of folks have issues with the 2 whitespace indent too 😄. I'll begin with it from the when #Hacktoberfest begins using the google java format plugin

@Clivern Clivern changed the title Enforce AOSP Style. Enforce Google Java Style. Sep 26, 2019
@Clivern Clivern closed this as completed in #5 Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Hacktoberfest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants