diff --git a/.eclipseformat.xml b/.eclipseformat.xml index 4df52d1b603..9ff0aa1f408 100644 --- a/.eclipseformat.xml +++ b/.eclipseformat.xml @@ -29,7 +29,7 @@ - + @@ -39,15 +39,15 @@ - + - + - + @@ -64,7 +64,7 @@ - + @@ -89,7 +89,7 @@ - + @@ -98,7 +98,7 @@ - + @@ -128,11 +128,11 @@ - + - + @@ -143,7 +143,7 @@ - + @@ -167,7 +167,7 @@ - + @@ -189,8 +189,8 @@ - - + + @@ -202,12 +202,12 @@ - + - - + + - + @@ -225,7 +225,7 @@ - + @@ -240,7 +240,7 @@ - + @@ -291,7 +291,7 @@ - + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7f437e8333b..b41cd35572c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -109,15 +109,15 @@ and `JAVA11_HOME` available so that the tests can pass. Elasticsearch uses the Gradle wrapper for its build. You can execute Gradle using the wrapper via the `gradlew` script in the root of the repository. -We support development in the Eclipse and IntelliJ IDEs. -For Eclipse, the minimum version that we support is [4.13][eclipse]. +We support development in the Eclipse and IntelliJ IDEs. +For Eclipse, the minimum version that we support is [4.13][eclipse]. For IntelliJ, the minimum version that we support is [IntelliJ 2017.2][intellij]. ### Configuring IDEs And Running Tests Eclipse users can automatically configure their IDE: `./gradlew eclipse` then `File: Import: Gradle : Existing Gradle Project`. -Additionally you will want to ensure that Eclipse is using 2048m of heap by modifying +Additionally you will want to ensure that Eclipse is using 2048m of heap by modifying `eclipse.ini` accordingly to avoid GC overhead and OOM errors. IntelliJ users can automatically configure their IDE: `./gradlew idea` @@ -175,9 +175,12 @@ Please follow these formatting guidelines: * Java indent is 4 spaces * Line width is 140 characters -* Lines of code surrounded by `// tag` and `// end` comments are included +* Lines of code surrounded by `// tag::NAME` and `// end::NAME` comments are included in the documentation and should only be 76 characters wide not counting - leading indentation + leading indentation. Such regions of code are not formatted automatically as + it is not possible to change the line length rule of the formatter for + part of a file. Please format such sections sympathetically with the rest + of the code, while keeping lines to maximum length of 76 characters. * Wildcard imports (`import foo.bar.baz.*`) are forbidden and will cause the build to fail. This can be done automatically by your IDE: * Eclipse: `Preferences->Java->Code Style->Organize Imports`. There are @@ -187,6 +190,13 @@ Please follow these formatting guidelines: There are two configuration options: `Class count to use import with '*'` and `Names count to use static import with '*'`. Set their values to 99999 or some other absurdly high value. +* If *absolutely* necessary, you can disable formatting for regions of code + with the `// tag::NAME` and `// end::NAME` directives, but note that + these are intended for use in documentation, so please make it clear what + you have done, and only do this where the benefit clearly outweighs the + decrease in consistency. +* Note that JavaDoc and block comments i.e. `/* ... */` are not formatted, + but line comments i.e `// ...` are. #### Editor / IDE Support @@ -213,7 +223,7 @@ Spotless will write files to different copies of the formatted files, so that you can see how they differ and infer what is the problem. -The `paddedCell() option is disabled for normal operation in order to +The `paddedCell()` option is disabled for normal operation in order to detect any misbehaviour. You can enabled the option from the command line by running Gradle with `-Dspotless.paddedcell`.