Skip to content

Conversation

@luoluoyuyu
Copy link
Member

@luoluoyuyu luoluoyuyu commented Apr 20, 2025

Purpose

Add Spotless plugin to realize automatic code formatting. The mvn spotless:apply command can automatically format the code. Thanks to @Yuukadesu for his contribution. Based on PR #3290

Remarks

PR introduces (a) breaking change(s): <yes/no>

PR introduces (a) deprecation(s): <yes/no>

@github-actions github-actions bot added dependencies Pull requests that update a dependency file java Pull requests that update Java code backend Everything that is related to the StreamPipes backend testing Relates to any kind of test (unit test, integration, or E2E test). pipeline elements Relates to pipeline elements connect Related to the `connect` module (adapters) labels Apr 20, 2025
@dominikriemer
Copy link
Member

Hi @luoluoyuyu thanks for the PR! I'm in favor of introducing spotless :-)
Do you think it's possible to turn automated formatting on only for newly modified files? So that we can switch to spotless on a per-module basis instead of having a single huge PR?
And just an idea..what do you think about configuring spotless so that every method parameter is written in a new line? Don't now if this is considered good practice but I personally like it since it's improving the readability of git diffs in code changes. Do you or anyone else have any experience on what is a good choice here?

@luoluoyuyu luoluoyuyu force-pushed the support-spotless-plugin branch from eda18f7 to ad898e3 Compare May 13, 2025 16:39
@github-actions github-actions bot removed pipeline elements Relates to pipeline elements connect Related to the `connect` module (adapters) testing Relates to any kind of test (unit test, integration, or E2E test). labels May 13, 2025
@luoluoyuyu
Copy link
Member Author

Hi @luoluoyuyu thanks for the PR! I'm in favor of introducing spotless :-) Do you think it's possible to turn automated formatting on only for newly modified files? So that we can switch to spotless on a per-module basis instead of having a single huge PR? And just an idea..what do you think about configuring spotless so that every method parameter is written in a new line? Don't now if this is considered good practice but I personally like it since it's improving the readability of git diffs in code changes. Do you or anyone else have any experience on what is a good choice here?

Great suggestion. I have modified it according to the suggestion. The function parameters are already aligned to columns, and the Spotless plugin is not effective. You need to set Skip to false to make it effective.

@luoluoyuyu luoluoyuyu force-pushed the support-spotless-plugin branch from 022d9cc to 9a5ebcf Compare May 13, 2025 16:46
@dominikriemer
Copy link
Member

Great, thank you @luoluoyuyu !

@dominikriemer dominikriemer merged commit 47c4752 into apache:dev Jun 10, 2025
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Everything that is related to the StreamPipes backend dependencies Pull requests that update a dependency file java Pull requests that update Java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants