如何 运行 从 Intellij IDEA 分析 Checkstyle 代码 "Run/Debug Configuration"

How to run Checkstyle code analysis from Intellij IDEA "Run/Debug Configuration"

我在 "Run/Debug Configuration"(运行-> 编辑配置)中有一个配置,运行 进行了一些测试。我希望此配置 运行 也希望在测试前进行 Checkstyle 检查。

怎么做?可能吗?

我安装了 CheckStyle-IDEA 插件(5.15.0 版)。通常我 运行 它手动使用
Analyze->Run Inspection by name->"Checkstyle real-time scan".
在我构建应用程序的一些 Maven 任务中,Checkstyle 也是 运行。但是我想 运行 它也像 "Run/Debug Configuration" 一样进行测试,如前所述。

您可以运行一个配置在另一个配置之前。

  1. 使用 运行 Maven Checkstyle 插件创建第一个配置 Edit Configuration -> Maven
  2. 创建第二个 JUnit 配置并在 启动前 下的字段中选择先前的配置 我添加了一张图片来帮助你。