Skip to content

Add Maven target to format (Java) code using Spotless#41

Merged
sebastian-nagel merged 5 commits intomainfrom
java-code-formatter
Feb 19, 2026
Merged

Add Maven target to format (Java) code using Spotless#41
sebastian-nagel merged 5 commits intomainfrom
java-code-formatter

Conversation

@sebastian-nagel
Copy link
Contributor

Copy link

@lfoppiano lfoppiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I have left a couple of comments, that are mostly personal preferences.

EDIT: I would also add spotless in the CI (also a personal preference)

<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I prefer spaces rather than tabs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not change it because it would cause that the entire code is reformatted.

Tabs is the Eclipse default. One benefit of using only tabs (not mixing tabs and spaces): no need to discuss whether 2 or 4 spaces are the best. You could change the editor view by adjusting the tabulation size without changing the code.

I have no strict preference. And various projects I work with use different indentation styles.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those I personally would prefer to have them aligned vertically 🙂

<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="80"/>
        <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="48"/>
        <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="48"/>

Copy link
Contributor Author

@sebastian-nagel sebastian-nagel Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 These are useful. Thanks! I'll integrate them, and eventually also update the formatter in cc-webgraph.

@sebastian-nagel sebastian-nagel merged commit 53da96a into main Feb 19, 2026
7 checks passed
sebastian-nagel added a commit to commoncrawl/cc-webgraph that referenced this pull request Feb 19, 2026
Sync the code formatting rules with those defined
in commoncrawl/cc-index-table#41.
@sebastian-nagel sebastian-nagel deleted the java-code-formatter branch February 19, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants