Java
Java copied to clipboard
[FEATURE REQUEST] Java Code Formatter
What would you like to Propose?
The current Clang format linter definitely does its job to identify linting errors in the code. But I think it will be better if we could have a formatter that we can integrate with CI jobs to auto-formate code if possible. Therefore, I am trying to propose a Java formatter.
Issue details
Currently, contributors have to format the code manually.
Additional Information
The fotmatter I am proposing is called Spotless.
The Pros for choosing Spotless:
- Just run
mvn spotless:applydoes magic. - It is widely used, and actively maintained!
- Can be integrated with CI.
- It supports many different formatting policies (google java style, eclipse jdt...).
- Support with IntelliJ IDEA and VSCode
@siriak what is your thought on this?
I think it's a great idea. Having a formatter is better than only having a check.
Great idea. The clang-format-lint-action support format the code inplace
name: Run clang-format Linter
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
source: '.'
exclude: './lib'
extensions: 'h,cpp,c'
clangFormatVersion: 16
inplace: True
- uses: EndBug/add-and-commit@v9
with:
author_name: Clang Robot
author_email: [email protected]
message: 'Committing clang-format changes'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Hello, I would like to work on this, can it be assigned to me, please
@abhisheksharma886 go ahead
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Please reopen this issue once you add more information and updates here. If this is not the case and you need some help, feel free to seek help from our Gitter or ping one of the reviewers. Thank you for your contributions!