Allow Java source formatting mvn formatter:format #4214

Merged
merged 1 commit into from Nov 23, 2016

Conversation

Projects
None yet
2 participants
Contributor

nickcmaynard commented Nov 18, 2016

PR checklist

  • Read the contribution guildelines.
  • Ran the shell/batch script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)
  • Filed the PR against the correct branch: master for non-breaking changes and 2.3.0 branch for breaking (non-backward compatible) changes.

Description of the PR

More work towards our code style standards aim #3972.

Uses Eclipse formatting tools with a configuration matching Google's style guide (plus our customisations).

This brings in an appropriately configured Java formatter maven plugin, but doesn't run it as part of the build. To manually run it:
mvn formatter:format

Having done this once, we fix ~2200 code style warnings.

~/Documents/Personal/swagger-codegen$ mvn clean compile | wc -l
    3809
➜  ~/Documents/Personal/swagger-codegen$ mvn formatter:format | wc -l
      80
➜  ~/Documents/Personal/swagger-codegen$ mvn clean compile | wc -l
    1660

I haven't included the results of a run in this PR, as it would generate lots of merge conflicts... I'd suggest whoever merges this PR does a once-off formatter run.

@nickcmaynard nickcmaynard Allow Java source formatting mvn formatter:format
Uses Eclipse formatting tools with a configuration matching Google's style guide (plus our customisations).
9b63dcb

wing328 merged commit 4c05d5f into swagger-api:master Nov 23, 2016

3 checks passed

Shippable Run 1109 status is SUCCESS.
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Member

wing328 commented Nov 23, 2016

@nickcmaynard thanks for the PR. I'll run mvn formatter:format later as there're some PRs about refactoring DefaultCodegen.

wing328 added this to the v2.2.2 milestone Nov 23, 2016

Contributor

nickcmaynard commented Nov 30, 2016

@wing328 Do you think the codebase is ready for a formatter run yet?

nickcmaynard deleted the nickcmaynard:formatter-maven-plugin branch Nov 30, 2016

Member

wing328 commented Nov 30, 2016

@nickcmaynard I'll do it after merging latest enhancements in the master to 2.3.0 first (there are lots of conflicts I need to resolve after removing the licenses from the templates)

Contributor

nickcmaynard commented Nov 30, 2016

Fair - this will cause some conflicts. Just making sure it doesn't get buried under all the other stuff you're doing!

Member

wing328 commented Nov 30, 2016

Yup, I've created #4295 for tracking.

@davidgri davidgri pushed a commit to davidgri/swagger-codegen that referenced this pull request May 11, 2017

@nickcmaynard @wing328 nickcmaynard + wing328 Allow Java source formatting mvn formatter:format (#4214)
Uses Eclipse formatting tools with a configuration matching Google's style guide (plus our customisations).
6d9347b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment