如何从命令行执行 Google Codepro analytix?

发布于 2024-10-31 21:28:10 字数 268 浏览 5 评论 0原文

是否可以从命令行运行 Google CodePro analytix

我正在寻找的是从 shell 脚本运行它,传递文件名作为参数,并获取我作为参数传递的文件名在文件级别生成的所有指标。

可以这样做吗?以及如何?

是否有其他工具可以为 Java 文件提供相同的指标并从 shell 脚本执行?

Is it possible to run Google CodePro analytix from Command Line.

What I am looking for is to run this from a shell script passing the file name as a parameter and get all the metrics generated on file level for the filename I passed in as parameter.

Is it possible to do so? and How?

Are there any other tools that can give same metrics for a Java file and be executed from a shell script?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

脸赞 2024-11-07 21:28:10

有一组codepro ant 任务集,可以用于审计以及报告生成。

至于其他工具,还有PMD 的 ant 任务集以及maven 的 PMD 插件。两者都可以从命令行运行。

与 Findbugs 类似:ant 任务的说明可以在 此处 找到,还有 Maven 插件此处

编辑:在我看来,谷歌购买这个漂亮的工具只是为了让它消亡的默默无闻。似乎没有正在进行的开发,也没有开源版本。 ant任务没有发布(我没有找到可用的例子)。没有maven插件。我们无法将其集成到我们的构建中,并重新使用 PMD、Findbugs 和 Sonar。这是一个耻辱。

There is a set of codepro ant tasks that can be used for auditing as well as report generation.

As to other tools, there is also a set of ant tasks for PMD as well as a PMD plugin for maven. Both can be run from command line.

Similar for Findbugs : the instructions for the ant task can be found here, and the maven plugin here

EDIT: It seems to me that google purchased this beatiful tool just to let it die of obscurity. There seems to be no ongoig development and no release to open source. The ant tasks are not released (and I have found no usable examples). there is no maven plugin. We were unable to integrate it in our build and are back to using PMD, Findbugs and Sonar. It's a shame.

飘过的浮云 2024-11-07 21:28:10

Google CodePro Analytix 应该有一个 Ant 任务,它应该是命令行实用程序执行所需操作的地方。

Google CodePro Analytix should have an Ant task, it should be the place where a command-line utility would do the desired action.

柠檬色的秋千 2024-11-07 21:28:10

CodePro Analytix 确实有 ant 任务并且它们很实用。请参阅此处的文档。

https://developers.google.com/java-dev -tools/codepro/doc/features/ant/headless - 即使第一行说任务已弃用,它仍然有效。

ant 任务 codepro.audit 和 codepro.metrics 都可以与 Eclipse Juno 配合良好。通过编辑 https://developers.google.com/java-dev-tools/codepro/doc/features/ant/example/headless_existing_workspace_33.zip

我编辑了默认的 headless.xml 以使用特定的规则/指标集并以 xml 格式导出结果。

<?xml version="1.0" encoding="UTF-8"?>
<project name="Ant Test" basedir="." default="main">
    <target name="main">        
        <!-- the project source directory to be analyzed -->
        <property name="projSrc" location="<full path to your project source folder>"/>

        <!-- test codepro.audit -->
        <codepro.audit auditRuleSetName="CodePro Default"  
            resultFile="headless_audit_out.txt">
            <fileSet dir="${projSrc}"/>
            <report file="audit_result.xml" format="xml">
            </report>
        </codepro.audit>

        <!-- test codepro.metrics -->
        <codepro.metrics metricSetName="CodePro Default"
            resultFile="headless_metrics_out.txt">
            <fileSet dir="${projSrc}"/>
            <report file="metrics_result.xml" format="xml">
            </report>
        </codepro.metrics>

        <echo message="It works!"/>
    </target>   
</project>

CodePro Analytix does have ant tasks and they are functional. Please see the documentation here.

https://developers.google.com/java-dev-tools/codepro/doc/features/ant/headless - It works even though the first line says the tasks are deprecated.

Both ant tasks codepro.audit and codepro.metrics works fine with Eclipse Juno. I was able to run both audit and metrics tasks on an existing workspace project by editing headless.xml and run_headless.bat files from https://developers.google.com/java-dev-tools/codepro/doc/features/ant/example/headless_existing_workspace_33.zip

I edited the default headless.xml to use a specific rule/metric set and to export the results in xml format.

<?xml version="1.0" encoding="UTF-8"?>
<project name="Ant Test" basedir="." default="main">
    <target name="main">        
        <!-- the project source directory to be analyzed -->
        <property name="projSrc" location="<full path to your project source folder>"/>

        <!-- test codepro.audit -->
        <codepro.audit auditRuleSetName="CodePro Default"  
            resultFile="headless_audit_out.txt">
            <fileSet dir="${projSrc}"/>
            <report file="audit_result.xml" format="xml">
            </report>
        </codepro.audit>

        <!-- test codepro.metrics -->
        <codepro.metrics metricSetName="CodePro Default"
            resultFile="headless_metrics_out.txt">
            <fileSet dir="${projSrc}"/>
            <report file="metrics_result.xml" format="xml">
            </report>
        </codepro.metrics>

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