简体   繁体   中英

Using custom checkstyle.xml file to check java codes

For our java code base, we tried to implement checkstyle github action for our needs but I couldn't figure out how to implement custom needs.

Here is the repo I want to use it. Checker

And my yml file to use it.

on: pull_request 
jobs:
  checkstyle_job:
    runs-on: ubuntu-latest
    name: Checkstyle job
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Run check style
        uses: efeozsoy/checkstyle-java-commenter@0.1.2
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: 'github-pr-check'
          tool_name: 'checkstyle-java'

This is the output of the default xml I need to change max lines and indentation rules在此处输入图像描述

You can set the config location using option checkstyle_config , in the same way as tool_name . The value can be a file in your local repository, or a link to a different configuration file. For example:

checkstyle_config: https://raw.githubusercontent.com/efeozsoy/checkstyle-java-commenter/master/custom_checker.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM