-
Notifications
You must be signed in to change notification settings - Fork 0
/
usage.html
280 lines (216 loc) · 9.67 KB
/
usage.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.8 from src/site/xhtml/usage.xhtml at 2019-08-07
| Rendered using Apache Maven Fluido Skin 1.7
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="Date-Revision-yyyymmdd" content="20190807" />
<meta http-equiv="Content-Language" content="en" />
<title>JavaNCSS – JavaNCSS - Usage</title>
<link rel="stylesheet" href="./css/apache-maven-fluido-1.7.min.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
<script type="text/javascript" src="./js/apache-maven-fluido-1.7.min.js"></script>
<link rel="SHORTCUT ICON" href="favjavancss.ico" /> </head>
<body class="topBarDisabled">
<div class="container-fluid">
<div id="banner">
<div class="pull-left"><a href="http://javancss.github.io/" id="bannerLeft"><h2>JavaNCSS</h2>
</a></div>
<div class="pull-right"></div>
<div class="clear"><hr/></div>
</div>
<div id="breadcrumbs">
<ul class="breadcrumb">
<li class=""><a href="http://www.kclee.de/clemens/java/" class="externalLink" title="Chr. Clemens Lee">Chr. Clemens Lee</a><span class="divider">/</span></li>
<li class=""><a href="http://javancss.github.io/" class="externalLink" title="JavaNCSS">JavaNCSS</a><span class="divider">/</span></li>
<li class="active ">JavaNCSS - Usage</li>
<li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2019-08-07</li>
<li id="projectVersion" class="pull-right"><span class="divider">|</span>Version: 34.55-SNAPSHOT</li>
<li class="pull-right"><span class="divider">|</span>
<a href="http://ant.apache.org/" class="externalLink" title="Ant">Ant</a></li>
<li class="pull-right"><span class="divider">|</span>
<a href="http://maven.apache.org/" class="externalLink" title="Maven">Maven</a></li>
<li class="pull-right"><a href="http://www.mojohaus.org/javancss-maven-plugin/" class="externalLink" title="JavaNCSS Maven Plugin">JavaNCSS Maven Plugin</a></li>
</ul>
</div>
<div class="row-fluid">
<div id="leftColumn" class="span2">
<div class="well sidebar-nav">
<ul class="nav nav-list">
<li class="nav-header">General Information</li>
<li><a href="index.html" title="Home"><span class="none"></span>Home</a></li>
<li class="active"><a href="#"><span class="none"></span>Usage</a></li>
<li><a href="specification.html" title="Specification"><span class="none"></span>Specification</a></li>
<li><a href="release-history.html" title="Release History"><span class="none"></span>Release History</a></li>
<li><a href="credits.html" title="Credits"><span class="none"></span>Credits</a></li>
<li><a href="links.html" title="Related Links"><span class="none"></span>Related Links</a></li>
<li class="nav-header">Development</li>
<li><a href="development.html" title="Development"><span class="none"></span>Development</a></li>
<li><a href="todo.html" title="TODO"><span class="none"></span>TODO</a></li>
<li class="nav-header">Project Documentation</li>
<li><a href="project-info.html" title="Project Information"><span class="icon-chevron-right"></span>Project Information</a></li>
<li><a href="project-reports.html" title="Project Reports"><span class="icon-chevron-right"></span>Project Reports</a></li>
</ul>
<hr />
<div id="poweredBy">
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" /></a>
</div>
</div>
</div>
<div id="bodyColumn" class="span10" >
<table border="0" class="table table-striped">
<tr class="a">
<td>
<center>
<h1>JavaNCSS - Usage</h1></center>
</td>
</tr>
</table>
<div class="section">
<h2><a name="Usage"></a><a name="usage"></a>Usage</h2>
Make sure <tt>javancss-x.y/lib/javancss.jar</tt> is added to your CLASSPATH.
<p>
Then to start JavaNCSS type: <tt>java javancss.Main</tt>.
As an alternative you can edit and use either the <tt>javancss.bat</tt>
or <tt>javancss</tt> file. Just change the
<tt>JAVA_HOME</tt> and <tt>CLASSPATH</tt>
variables according to your system.</p>
<p>
Now for the first run type in (being in the <tt>javancss-x.y</tt> directory itself):</p>
<p>
<tt>./bin/javancss -gui src/test/resources/*.java</tt></p>
<p>
or
</p>
<p>
<tt>./bin/javancss -gui -recursive src/test/resources/</tt></p>
<p>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 <tt>cat *.java | javancss</tt>
or <tt>type *.java | javancss</tt>. Of course, this can lead to ambiguities when mixing
source files that belong to a package with files that doesn't.</p>
<p> If no option
is given, JavaNCSS only calculates the total non commenting source statements
(NCSS) of the given input.</p>
<p>JavaNCSS can also be used conveniently via Ant. For details
have a look at the <a href="JavancssAntTask.html">JavaNCSS Ant Task page</a>,
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).</p>
<div class="section">
<h3><a name="Synopsis"></a>Synopsis</h3>
<tt>javancss [-option] stdin | [@]source_file*</tt>
</div>
<div class="section">
<h3><a name="Options"></a>Options</h3>
<dl>
<dt><tt>-ncss</tt></dt>
<dd>
This is the default which counts total non commenting source statements
and nothing else.</dd>
<dt><tt>-package</tt></dt>
<dd>
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 <a href="package.txt">java.*</a> source
tree.</dd>
<dt><tt>-object</tt></dt>
<dd>
Collects the metrics data for each class/interface. For an example program
output, look <a href="object.txt">here</a>.</dd>
<dt><tt>-function</tt></dt>
<dd>
Collects the metrics data for each function. For an example program output,
look <a href="function.txt">here</a>.</dd>
<dt><tt>-all</tt></dt>
<dd>
The same as '-package -object -function'.</dd>
<dt><tt>-gui</tt></dt>
<dd>
Opens a gui to presents the '-all' output in tabbed panels.
</dd>
<dt><tt>-xml</tt></dt>
<dd>
Output in xml and not in ascii format. Additional option '-all' is recommended.
</dd>
<dt><tt>-out file</tt></dt>
<dd>
Output goes normally to standard output, with this
option an output file can be specified.
</dd>
<dt><tt>-recursive</tt></dt>
<dd>
Java file in sub directories will be parsed as well. Be careful
not to get caught in an endless loops because some Unix links.
</dd>
<dt><tt>-version</tt></dt>
<dd>
Prints out the version of JavaNCSS.</dd>
<dt><tt>-help</tt></dt>
<dd>
Prints out some basic information.</dd>
</dl>
<a name="xslt"></a></div>
<div class="section">
<h3><a name="XSLT_Stylesheets"></a>XSLT Stylesheets</h3>
JavaNCSS comes with some XSLT stylesheet (<tt>javancss-x.y/xslt/javancss2text.xsl</tt> and <tt>javancss-x.y/xslt/javancss2html.xsl</tt>). These stylesheets can be used to
convert XML output from JavaNCSS to ASCII or HTML output. In case of
the ASCII output this is of course
quite boring and much slower as JavaNCSS creates the identical output
by default anyway. But you can use this stylesheet (or any of the others
shipped as well) as a starting
point to have your own presentation format.
You could also change sort rules (e.g. sort by NCSS)
or add your own filters to the output (e.g. show only methods
with NCSS greater some limit).
<p>
Assuming you have e.g. Xalan2 installed and somewhere in your
path is a shell script named 'xslt' that knows how to invoke
Java with the Xalan 2 main processor class (org.apache.xalan.xslt.Process),
here is how you can make use of JavaNCSS' XSLT stylesheet:</p>
<p>
<tt>cd javancss-x.y</tt><br />
<tt>javancss -all -xml -recursive src > example.xml</tt><br />
<tt>xslt -in example.xml -xsl xslt/javancss2text.xsl</tt></p>
<p>
Have fun. If you create a useful new stylesheet for JavaNCSS,
I would be happy to get a copy of it.</p>
<div class="section">
<h4><a name="SVG_Output"></a>SVG Output</h4>
Yves Coene <i><a class="externalLink" href="mailto:[email protected]"><[email protected]></a></i> has donated some XSLT stylesheets which produce beautiful
SVG charts out of JavaNCSS's XML output.
<p>
Use e.g. batik as an SVG viewer and have a look at the example
files in directory xslt/svg under the JavaNCSS home directory.</p>
<p>
Here is an <a href="chart_ncss.svg">example SVG chart</a> file.</p>
<p>
Generation of SVG files is similar to using other XSLT stylesheets
as described above.</p>
</div></div></div>
</div>
</div>
</div>
<hr/>
<footer>
<div class="container-fluid">
<div class="row-fluid">
<p>Copyright ©1997–2019
Chr. Clemens Lee and companions.
All rights reserved.</p>
</div>
</div>
</footer>
</body>
</html>