PMD 用于检测未使用的代码 - API 使用情况

发布于 2024-11-25 20:12:42 字数 225 浏览 4 评论 0原文

我查看了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫卆 2024-12-02 20:12:43

您的意思是调用它作为构建的一部分吗?在实际应用程序运行时调用 PMD 来分析源代码没有多大意义。

看看 maven-pmd-pluginAnt 任务

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文