This is an automated email from the ASF dual-hosted git repository.
blue pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-docs.git
The following commit(s) were added to refs/heads/main by this push:
new 4d9facf1 Document spotless/google-java-format IDE plugin usage (#125)
4d9facf1 is described below
commit 4d9facf128a9f37477f7d0e63249f808f53be3a0
Author: Eduard Tudenhöfner <[email protected]>
AuthorDate: Wed Jul 27 19:52:24 2022 +0200
Document spotless/google-java-format IDE plugin usage (#125)
---
landing-page/content/common/contribute.md | 110 +++++++++++-------------------
landing-page/content/common/join.md | 17 -----
2 files changed, 40 insertions(+), 87 deletions(-)
diff --git a/landing-page/content/common/contribute.md
b/landing-page/content/common/contribute.md
index 86564243..b362020a 100644
--- a/landing-page/content/common/contribute.md
+++ b/landing-page/content/common/contribute.md
@@ -54,6 +54,7 @@ Iceberg is built using Gradle with Java 8 or Java 11.
* To invoke a build and run tests: `./gradlew build`
* To skip tests: `./gradlew build -x test -x integrationTest`
+* To fix code style: `./gradlew spotlessApply`
Iceberg table support is organized in library modules:
@@ -76,54 +77,25 @@ This project Iceberg also has modules for adding Iceberg
support to processing e
## Setting up IDE and Code Style
-### Configuring Code Formatter for IntelliJ IDEA
+### Configuring Code Formatter for Eclipse/IntelliJ
-In the **Settings/Preferences** dialog go to **Editor > Code Style > Java**.
Click on the gear wheel and select **Import Scheme** to import IntelliJ IDEA
XML code style settings.
-Point to
[intellij-java-palantir-style.xml](https://github.com/apache/iceberg/blob/master/.baseline/idea/intellij-java-palantir-style.xml)
and hit **OK** (you might need to enable **Show Hidden Files and Directories**
in the dialog). The code itself can then be formatted via **Code > Reformat
Code**.
+Follow the instructions for
[Eclipse](https://github.com/google/google-java-format#eclipse) or
+[IntelliJ](https://github.com/google/google-java-format#intellij-android-studio-and-other-jetbrains-ides)
to install the **google-java-format** plugin (note the required manual actions
for IntelliJ).
-See also the IntelliJ [Code Style
docs](https://www.jetbrains.com/help/idea/copying-code-style-settings.html) and
[Reformat Code
docs](https://www.jetbrains.com/help/idea/reformat-and-rearrange-code.html) for
additional details.
-
-### Configuring Copyright for IntelliJ IDEA
-
-Every file needs to include the Apache license as a header. This can be
automated in IntelliJ by
-adding a Copyright profile:
-
-1. In the **Settings/Preferences** dialog go to **Editor → Copyright →
Copyright Profiles**.
-2. Add a new profile and name it **Apache**.
-3. Add the following text as the license text:
-
- ```
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- ```
-4. Go to **Editor → Copyright** and choose the **Apache** profile as the
default profile for this
- project.
-5. Click **Apply**.
## Iceberg Code Contribution Guidelines
### Style
-For Java styling, check out the section
-[Setting up IDE and Code
Style](https://iceberg.apache.org/community/#setting-up-ide-and-code-style)
from the
-documentation site.
-
For Python, please use the tox command `tox -e format` to apply autoformatting
to the project.
+Java code adheres to the [Google
style](https://google.github.io/styleguide/javaguide.html), which will be
verified via `./gradlew spotlessCheck` during builds.
+In order to automatically fix Java code style issues, please use `./gradlew
spotlessApply`.
+
+**NOTE**: The **google-java-format** plugin will always use the latest version
of the **google-java-format**. However, `spotless` itself is configured to use
**google-java-format** 1.7
+since that version is compatible with JDK 8. When formatting the code in the
IDE, there is a slight chance that it will produce slightly different results.
In such a case please run `./gradlew spotlessApply`
+as CI will check the style against **google-java-format** 1.7.
+
### Copyright
Each file must include the Apache license information as a header.
@@ -147,40 +119,38 @@ specific language governing permissions and limitations
under the License.
```
-### Java style guidelines
+### Configuring Copyright for IntelliJ IDEA
-#### Line breaks
+Every file needs to include the Apache license as a header. This can be
automated in IntelliJ by
+adding a Copyright profile:
-Continuation indents are 2 indents (4 spaces) from the start of the previous
line.
+1. In the **Settings/Preferences** dialog go to **Editor → Copyright →
Copyright Profiles**.
+2. Add a new profile and name it **Apache**.
+3. Add the following text as the license text:
-Try to break long lines at the same semantic level to make code more readable.
-* Don't use the same level of indentation for arguments to different methods
-* Don't use the same level of indentation for arguments and chained methods
+ ```
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
-```java
- // BAD: hard to see arguments passed to the same method
- doSomething(new ArgumentClass(1,
- 2),
- 3);
-
- // GOOD: break lines at the same semantic level
- doSomething(
- new ArgumentClass(1, 2),
- 3);
-
- // BAD: arguments and chained methods mixed
- SomeObject myNewObject = SomeObject.builder(schema, partitionSpec,
- sortOrder)
- .withProperty("x", "1")
- .build()
-
- // GOOD: method calls at the same level, arguments indented
- SomeObject myNewObject = SomeObject
- .builder(schema, partitionSpec,
- sortOrder)
- .withProperty("x", "1")
- .build()
-```
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ ```
+4. Go to **Editor → Copyright** and choose the **Apache** profile as the
default profile for this
+ project.
+5. Click **Apply**.
+
+### Java style guidelines
#### Method naming
@@ -280,4 +250,4 @@ rm -rf docs/content/docs
rm -rf landing-page/content/common
cp -r <path to iceberg repo>/docs/versioned docs/content/docs
cp -r <path to iceberg repo>/docs/common landing-page/content/common
-```
\ No newline at end of file
+```
diff --git a/landing-page/content/common/join.md
b/landing-page/content/common/join.md
index a70be245..7feea8b3 100644
--- a/landing-page/content/common/join.md
+++ b/landing-page/content/common/join.md
@@ -64,20 +64,3 @@ Iceberg has four mailing lists:
- [Archive](https://lists.apache.org/[email protected])
* **Private**: <[email protected]> -- private list for the PMC to
discuss sensitive issues related to the health of the project
- [Archive](https://lists.apache.org/[email protected])
-
-
-## Setting up IDE and Code Style
-
-### Configuring Code Formatter for IntelliJ IDEA
-
-In the **Settings/Preferences** dialog go to **Editor > Code Style > Java**.
Click on the gear wheel and select **Import Scheme** to import IntelliJ IDEA
XML code style settings.
-Point to
[intellij-java-palantir-style.xml](https://github.com/apache/iceberg/blob/master/.baseline/idea/intellij-java-palantir-style.xml)
and hit **OK** (you might need to enable **Show Hidden Files and Directories**
in the dialog). The code itself can then be formatted via **Code > Reformat
Code**.
-
-See also the IntelliJ [Code Style
docs](https://www.jetbrains.com/help/idea/copying-code-style-settings.html) and
[Reformat Code
docs](https://www.jetbrains.com/help/idea/reformat-and-rearrange-code.html) for
additional details.
-
-## Running Benchmarks
-Some PRs/changesets might require running benchmarks to determine whether they
are affecting the baseline performance. Currently there is
-no "push a single button to get a performance comparison" solution available,
therefore one has to run JMH performance tests on their local machine and
-post the results on the PR.
-
-See [Benchmarks](../benchmarks) for a summary of available benchmarks and how
to run them.