java ncss 代码_本地调测JavaNCSS源码

JavaNCSS是一款用于计算源代码复杂性的工具。要运行它,你需要将javancss.jar、ccl.jar和jhbasic.jar添加到CLASSPATH中。启动JavaNCSS后,你可以通过命令行指定Java源文件进行分析,或者使用GUI界面。JavaNCSS可以提供包、类和函数级别的代码度量,并支持通过Ant任务进行集成。此外,它还提供了自我测试功能和XML输出选项。
摘要由CSDN通过智能技术生成

Usage

Make sure javancss-30.51/lib/javancss.jar, javancss-30.51/lib/ccl.jar, and javancss30.51/lib/ jhbasic.jar are added to your CLASSPATH.

Then to start JavaNCSS type: java javancss.Main. As an alternative you can edit and use either the JAVANCSS.BAT or javancss file. Just change the JAVA_HOME and CLASSPATH variables according to your system. Make sure you did include the swingall.jar archive in the classpath.

Now for the first run type in (beeing in the javancss-30.51 directory itself):

./bin/javancss -gui test/*.java

or

./bin/javancss -gui -recursive test

For regression test of JavaNCSS use:

java javancss.test.JavancssTest

If no parameter is provided for JavaNCSS, standard input (stdin) is used as the input stream. Multiple java source files can be specified in the command line. If a '@' char is put in front of a file name, then not this file will be measured but its content will be interpreted as a list of Java source files that shall be counted. The '@' functionality can be used recursively inside this file as well. Wild cards are not supported yet. (If the operating system processes the command line for the program, then you are lucky. Windows doesn't do that.) Instead use something like cat *.java | javancss or type *.java | javancss. Of course, this can lead to ambiguities when mixing source files that belong to a package with files that doesn't.

If no option is given, JavaNCSS only calculates the total non commenting source statements (NCSS) of the given input.

JavaNCSS can also be used conveniently via Ant. For details have a look at the JavaNCSS Ant Task page, especially at the example at the bottom of that page. You can also have a look at the build.xml file that gets distributed with JavaNCSS itself (see "javancss" target).

Synopsis

javancss [-option] stdin | [@]source_file*

Options

-ncss

This is the default which counts total non commenting source statements and nothing else.

-package

Collects the metrics data for each package. This is the most top level view javancss offers for your projects. Take a look here what javancss prints out for the Sun JDK 1.1.5 java.* source tree.

-object

Collects the metrics data for each class/interface. For an example program output, look here.

-function

Collects the metrics data for each function. For an example program output, look here.

-all

The same as '-package -object -function'.

-gui

Opens a gui to presents the '-all' output in tabbed panels.

-xml

Output in xml and not in ascii format. Additional option '-all' is recommended.

-out file

Output goes normally to standard output, with this option an output file can be specified.

-recursive

Java file in sub directories will be parsed as well. Be careful not to get caught in an endless loops because some Unix links.

-check

Trigger JavaNCSS self test suite.

-version

Prints out the version of JavaNCSS.

-help

Prints out some basic information.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值