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

[GEOS-11659] Developer Guide formatting with Palantir #8158

Merged
merged 1 commit into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[GEOS-11659] Developer Guide formatting with Palantir
  • Loading branch information
jodygarnett committed Dec 23, 2024
commit e3cd4df5e3e0fbecfc4e912108b6a442d9759636
Binary file not shown.
20 changes: 4 additions & 16 deletions doc/en/developer/source/eclipse-guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,25 +157,13 @@ Eclipse preferences
Code formatting
^^^^^^^^^^^^^^^

The Google formatter plugin is embedded in the build and will reformat the code at each build, matching the coding conventions. Please always build before committing!
GeoServer uses the `palantir-java-format <https://github.com/palantir/palantir-java-format?tab=readme-ov-file#palantir-java-format>`__ which is a fork of the google-java-format ASOP style updated Lamda expressions and 120 columns.

The `google-java-format <https://github.com/google/google-java-format>`__ project offers a plugin for Eclipse, but we are waiting an support for ASOP variant. While we wait for this fix build once on the command line, to format the any code changes before committing.
The formatter plugin is embedded in the build and will reformat the code at each build, matching the coding conventions. Please always build locally before committing!

As workaround you could use a `modified version <https://github.com/fernandor777/google-java-format/releases/download/1.7-gsgt/google-java-format-eclipse-plugin-1.6.0.jar>`__ with 4 spaces indent by default, putting the jar file on Eclipse dropins folder.
The `palantir-java-format <https://github.com/palantir/palantir-java-format>`__ project offers a `plugin <https://github.com/palantir/palantir-java-format/tree/develop/eclipse_plugin>`__ for Eclipse.


You may also:

#. Download https://github.com/geotools/geotools/blob/main/build/eclipse/eclipse-java-google-style.xml
#. Navigate to ``Java``, ``Code Style``, ``Formatter`` and click ``Import...``
#. Select the ``eclipse-java-google-style.xml`` file downloaded in step 1
#. Click ``Apply``

.. image:: code_formatting2.png

#. We follow `Google Code Formatting <https://google.github.io/styleguide/javaguide.html>`__ with the AOSP variant (4 spaces indent instead of 2).

For more information see GeoTools `Coding Style <http://docs.geotools.org/latest/developer/conventions/code/style.html>`__ page.
Code formatting is covered by our build :ref:`Quality Assurance <spotless>` checks.

Code templates
^^^^^^^^^^^^^^
Expand Down
9 changes: 8 additions & 1 deletion doc/en/developer/source/qa-guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ prefix, that will be used to perform the close, for example:
For closing delegates that use an instance object instead of a class static method, the variable
name is included in the prefix, so some uninformity in variable names is required.


Error Prone
-----------

Expand Down Expand Up @@ -167,10 +168,12 @@ or if it's a general one that should be ignored, the `build/qa/spotbugs-exclude.
:language: xml


.. _spotless:

Spotless
--------

Spotless is used as a fast way to check that the google-java-format is being applied to the codebase.
Spotless is used as a fast way to check that the `palantir-java -format <https://github.com/palantir/palantir-java-format?tab=readme-ov-file#palantir-java-format>`__ is being applied to the codebase.

.. literalinclude:: /../../../../src/pom.xml
:language: xml
Expand Down Expand Up @@ -205,6 +208,10 @@ Property ``spotless.apply.skip`` is used to skip spotless plugin when running ``

mvn clean install -Dqa -Dspotless.apply.skip=true

.. note::

IDE Plugins are available for `IntelliJ <https://plugins.jetbrains.com/plugin/13180-palantir-java-format>`__ and `Eclipse <https://github.com/palantir/palantir-java-format/tree/develop/eclipse_plugin>`__ IDEs.

Sortpom
-------

Expand Down
14 changes: 14 additions & 0 deletions doc/en/developer/source/quickstart/intellij.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,17 @@ Access GeoServer front page

* After a few seconds, GeoServer should be accessible at: `<http://localhost:8080/geoserver>`_
* The default ``admin`` password is ``geoserver``.

Development Environment
-----------------------

Code formatting
^^^^^^^^^^^^^^^

GeoServer uses the [palantir-java-format](https://github.com/palantir/palantir-java-format?tab=readme-ov-file#palantir-java-format) which is a fork of the google-java-format ASOP style updated Lamda expressions and 120 columns.

The formatter plugin is embedded in the build and will reformat the code at each build, matching the coding conventions. Please always build locally before committing!

The `palantir-java-format <https://github.com/palantir/palantir-java-format>`__ project offers a [plugin](https://plugins.jetbrains.com/plugin/13180-palantir-java-format) for IntelliJ.

Code formatting is covered by our build :ref:`Quality Assurance <spotless>` checks.
Loading