PMD 用于检测未使用的代码 - API 使用情况
我查看了 PMD api 我想用它来检测未使用的类中的实例变量和方法。我看到它可以从命令行调用,但是我想通过以编程方式调用 PMD 来对我的类执行冗余分析。不幸的是,该 API 不包含有关各种类和方法的任何信息。有谁知道如何调用 PMD 以编程方式检测冗余代码吗?
I have taken a look at the PMD api which I want to use to detect unused instance variables and methods in a class. I see that it can be invoked from the command line, however I would like to perform a redundancy analysis of my class by invoking PMD programatically. Unfortunately, the api doesn't contain any information regarding the various classes and methods. Does anyone have any information regarding how PMD can be invoked to detect redundant code programatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的意思是调用它作为构建的一部分吗?在实际应用程序运行时调用 PMD 来分析源代码没有多大意义。
看看 maven-pmd-plugin 或 Ant 任务。
Do you mean invoke it as a part of your build? It wouldn't make much sense to invoke PMD to analyze the source code during the runtime of the actual application.
Take a look at maven-pmd-plugin or the Ant task.