Commit Graph

5 Commits

Author SHA1 Message Date
Rory Hunter d8bd736f8a
Formatting: keep simple if / else on the same line (#51544)
Backport of #51526.

Previous the formatter was breaking simple if/else statements (i.e.
without braces) onto separate lines, which could be fragile because the
formatter cannot also introduce braces. Instead, keep such expressions
on the same line.
2020-01-29 10:42:04 +00:00
Rory Hunter 2f069d8f3f
Tweak formatter config for long generic lines (#51027)
Backport of #50909. The current formatting config allows some long
generic declarations to break the 140 character limit. Tweak the config
to wrap such lines.
2020-01-15 13:17:37 +00:00
Martijn van Groningen 18d5d73305
Enable spotless for enrich gradle project in 7 dot x branch. (#48976)
Backport of #48908

The enrich project doesn't have much history as all the other gradle projects,
so it makes sense to enable spotless for this gradle project.
2019-11-12 13:22:34 +01:00
Rory Hunter 61a4e24ecf
Refine the auto-formatting settings (#48618)
Backport of #48446. Update the Eclipse formatter settings as follows:

* Split arguments for methods, constructors etc into separate lines when
  they wrap
* Enable "joined wrapped lines", which basically means the formatter
  will ignore existing line breaks and join and re-wrap statements. I
  had originally hesitated about enabling this, but without it the
  codebase's style won't be as consistent as it should be, defeating the
  point of all this formatting business.
* Disable formatting between `// tag::` and `// end::` comments, which
  are the code snippet markers for the docs. They need a different line
  length, which isn't possible to configure separately.
* Detect and preserve aligned line comments at the end of consecutive
  lines.
* And a bunch of other tweaks.

Also update the contribution guidelines.
2019-10-29 10:40:03 +00:00
Rory Hunter 1c7dc3a5bf Format Java source files automatically (#46745)
This commit adds a Java source formatter and checker into the build process.
This is not yet enabled for any sub-projects - to format and check a
sub-project, add its Gradle path into `build.gradle` and run:

    ./gradlew spotlessApply

to format, and:

    ./gradlew spotlessJavaCheck
    # or:
    ./gradlew precommit

to verify formatting.
2019-09-30 10:35:47 +03:00