jsch icon indicating copy to clipboard operation
jsch copied to clipboard

Add checkstyle to maven build and fix whitespace after for/while

Open turbanoff opened this issue 2 years ago • 3 comments

JSch is a mature project. As every mature project, it has legacy code with inconsistent formatting. It makes hard to read/modify/audit the source code. I propose to improve formatting step by step in separate PRs/commits. In this PR I have added missing spaces after cycles: for/while. To make sure code style will not regress over time I propose to add maven-checkstyle-plugin to build process. Checkstyle has a lot of useful checks which can used to verify the code. I have plan to enable some them in separate PRs. What do you think?

turbanoff avatar Feb 13 '22 19:02 turbanoff

I have to say that I oppose such a massive change like this. It would cause severe disruption for several ongoing changes I'm working on, and would also make merging changes from other JSch forks far more difficult.

norrisjeremy avatar Feb 13 '22 19:02 norrisjeremy

@turbanoff thanks for your PR. Indeed, clear formatting would help to improve the readability of the code. I will keep it open until we have finished other things, which might bring more value to the project at the moment. If you look at #11 there are lots of bugs reported from static code analysis, but fixing them might also cause merging problems. Once we decide to decouple from forks and upstream, everything should be open to change those things.

mwiede avatar Feb 14 '22 21:02 mwiede

What do we think of instead perhaps moving to the Google Java Style for everything?

We could just do a single massive reformat of everything once I'm finished with some other outstanding changes.

norrisjeremy avatar Feb 15 '22 21:02 norrisjeremy

Closing as we added formatting in #247

mwiede avatar Feb 09 '23 21:02 mwiede