简体   繁体   English

自动解决 Intellij 中的 PMD 违规

[英]Automatically Resolve PMD Violations in Intellij

I am trying integrating my service into existing spring cloud microservice based project where I am using PMD rule set defined in parent service.我正在尝试将我的服务集成到现有的基于 spring 云微服务的项目中,我在其中使用在父服务中定义的PMD规则集。

But since this new service does not use the pmd rules for parent service therefore I just want to either bypass or resolve all rules in this new service which is needed to be integrated at once where I have defined violations when I am checking the pmd using command.但是由于这项新服务不使用父服务的 pmd 规则,因此我只想绕过或解决这项新服务中的所有规则,这些规则需要立即集成,我在使用命令检查 pmd 时定义了违规行为.

mvn pmd:check pmd:cpd-check -rf com.company.api.newservice:TestService

Now this TestService is generating pmd.xml in target folder using above command around 701 violations is shown in this xml since priority is being set which is mandatory to be resolved else build at jenkins will fail .现在这个TestService正在使用上面的命令在目标文件夹中生成 pmd.xml 大约701 次违规显示在这个 xml 中,因为正在设置优先级,这是必须解决的,否则在jenkins 构建将失败 Total violation is 1442 when pmd is run normally.当 pmd 正常运行时,总违规为 1442。

I tried to use walkmod but some exceptions are coming in their dependency itself.我尝试使用 walkmod,但它们的依赖项本身出现了一些异常。

GOAL: I just need to resolve these 701 violations immediately manually it is hectic task please suggest some quick and fast fix for these prioritized violations.目标:我只需要立即手动解决这些 701 违规,这是一项繁忙的任务,请为这些优先违规提出一些快速且快速的修复建议。

If you run inspections from IntelliJ IDE, IDE will show the inspection results window where you can apply a quick fix (if exists) for the violations: You can also load inspection results from IDE inspection command line tool.如果您从 IntelliJ IDE 运行检查,IDE 将显示检查结果 window,您可以在其中对违规应用快速修复(如果存在):您还可以从 IDE 检查命令行工具加载检查结果

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

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