我可以使用 checkstyle、maven-checkstyle-plugin 和 google_checks.xml 启用抑制吗?

Can I enable suppressions with checkstyle, the maven-checkstyle-plugin and google_checks.xml?

我想做以下事情:

  1. 使用标准 google_checks.xml 配置,因为我不想重复它。
  2. 能够抑制警告,特别是针对生成的代码,但也可能针对误报。
  3. 使用 maven-checkstyle-plugin。

据我所知,为了能够使用抑制,你需要在 .xml 配置中添加一个过滤器,而 google_checks.xml 配置是我想要的而不是自己。有可能解决这个问题吗?如果项目特定的东西(如抑制)与更通用的东西(如代码样式规则)分开,那就太好了。

我最终通过基于 google_checks.xml 创建一个单独的 checkstyle 配置并将其作为单独的 Maven 工件提供来解决 checkstyle 中的缺陷。结果在这里:https://github.com/spotify/spotify-checkstyle-config.

这意味着我们将复制 google_checks.xml 配置,但只复制一次。