简体   繁体   English

使用自定义 checkstyle.xml 文件检查 java 代码

[英]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.对于我们的 java 代码库,我们尝试根据需要实现 checkstyle github 操作,但我不知道如何实现自定义需求。

Here is the repo I want to use it.这是我想使用它的回购协议。 Checker检查器

And my yml file to use it.和我的 yml 文件来使用它。

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这是默认xml的output我需要更改最大行数和缩进规则在此处输入图像描述

You can set the config location using option checkstyle_config , in the same way as tool_name .您可以使用选项checkstyle_config设置配置位置,方法与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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将规则添加到CheckStyle.xml - How to add a rule to CheckStyle.xml 如何在 googles checkstyle.xml 中的方法之前添加一个选项卡 - How to add exactly one tab before method in googles checkstyle.xml sonar-maven-plugin由于checkstyle.xml无效而失败(不允许与“ [xX] [mM] [lL]”匹配的处理指令目标) - sonar-maven-plugin fails because of invalid checkstyle.xml (The processing instruction target matching “[xX][mM][lL]” is not allowed) 创建自定义版本的 Google Java Checkstyle XML 文件 - Creating a customized version of the Google Java Checkstyle XML file Checkstyle 自定义检查不适用于 gradle checkstyle 插件 - Checkstyle custom check does not work on gradle checkstyle plugin 使用 python/java 生成自定义 xml 文件 - Generating a custom xml file using python/java CheckStyle 自定义检查 — 检索所有参数名称 - CheckStyle Custom Check — Retrieve All Parameter Names 使用checkStyle实施java 8约定 - Enforce java 8 conventions using checkStyle 如何使用checkstyle,PMD,findbugs等工具检查Java类的继承级别? - How to check the inheritance level of a java class using tools as checkstyle, PMD, findbugs etc? 如何使用java检查xml文件中的开始和结束标记? - How to check for opening and closing tags in xml file using java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM