-
Notifications
You must be signed in to change notification settings - Fork 3
/
cyclo.0
198 lines (116 loc) · 5.73 KB
/
cyclo.0
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
cyclo(1) cyclo(1)
NNAAMMEE
mcstrip, cyclo - tools for analysing cyclomatic complexity
SSYYNNOOPPSSIISS
mmccssttrriipp [-l] [-c] [-r] [-a] [inputfile]
ccyycclloo [-l] [-t] [-f|-F] [-n func#] [-p] [-s scale] [-c]
[-d] [-i]
DDEESSCCRRIIPPTTIIOONN
These two tools are used to measure the cyclomatic com-
plexity of a piece of ANSI C or C++ code. A postscript
flowgraph of the functions can also be produced.
CCOOMMMMAANNDDSS
mmccssttrriipp
This command removes comments, string and character con-
stants from the input file, or standard input if none is
specified. If any of the following options are given, it
will give details of the file instead.
[-l] print number of lines in file
[-c] print number of lines that contain comments
[-r] print ratio of lines against lines with comments
[-a] print all of the above
ccyycclloo
This command takes as its standard input a file that has
had the comments, string and character constants removed
(by _m_c_s_t_r_i_p ). It will then produce either flowcharts or
the cyclomatic complexity number of one or more files in
the input.
Information
[-l] prints results of tokenisation
[-t] prints results of flow generation
Functions
[-i] ignores functions declared within a
struct/class/union
[-n func#] limits output of -p,-f,-F,-c to the given
function number, rather than the default of
all functions.
[-f] prints function name(s)
[-F] prints functions called by each source function
[-c] print cyclomatic complexity of function(s)
[-p] produce postscript flow graph
[-s scale] scales postscript output (float)
[-d] prints function names to postscript standard
output
RREETTUURRNN CCOODDEESS
mmccssttrriipp always returns zero. ccyycclloo returns one in the
event of an error, otherwise it returns zero.
tools Programmer's 1
cyclo(1) cyclo(1)
EEXXAAMMPPLLEESS
IInnffoorrmmaattiioonn aabboouutt ffiillee
$ _m_c_s_t_r_i_p -_a _m_a_i_n._C
63 comment lines
1199 lines
5 % comments to lines ratio
FFuunnccttiioonn nnaammeess
$ _m_s_t_r_i_p _m_a_i_n._C | _c_y_c_l_o -_f
Token::Token
Token::~Token
print_funcs
display_arc
display
FFuunnccttiioonn ccaallllss
$ _m_c_s_t_r_i_p _m_a_i_n._C | _c_y_c_l_o -_F -_n _3
print_funcs
setw
setiosflags
print_token
resetiosflags
FFllooww cchhaarrttss
$ _m_c_s_t_r_i_p _m_a_i_n._C | _c_y_c_l_o -_p -_n _3 > _f_l_o_w._p_s
$ _g_s _f_l_o_w._p_s
MMOORREE DDEETTAAIILLEEDD IINNFFOORRMMAATTIIOONN
The cyclomatic complexity measure counts the number of
decisions made within a piece of code. This number is
equal to the number of linearly independent paths through
the code. Its main application is in establishing test
cases. Be aware that the measure may not be useful. It
is recommended that further reading is done before using
it.
The following papers contain further relevant information:
'A Complexity Measure' McCabe T.J., IEEE Transactions
on Software Engineering vol SE-2, #4 1976, pp 308-320.
'A Critique of Cyclomatic Complexity as a Software Met-
ric' Shepperd M., Software Engineering Journal, March
1988, pp 30-36.
'Software Defect Prevention Using McCabe's Complexity
Metric' Ward W.T., Hewlett-Packard Journal, April 1989,
pp 64-69.
SSEEEE AALLSSOO
cflow(1) wc(1)
LLIIMMIITTAATTIIOONNSS
Only the ANSI C method of declaring functions is recog-
nised.
tools Programmer's 2
cyclo(1) cyclo(1)
Constructors that have an initialiser list have their
names incorrectly detected.
Lexical elements that span more than one line are not
recognised. This includes strings terminating with a con-
tinuation slash, struct and the following tag, and func-
tion names and the following opening parenthesis.
CCOOPPYYRRIIGGHHTT
(c) 1993 Roger Binns
These tools were produced by Roger Binns for a fourth year
project as part of a computer science degree, for the Com-
puter Science department, Brunel University, Uxbridge,
Middlesex UB8 3PH, United Kingdom.
This software is provided in good faith, having been
developed by Brunel University students as part of their
normal course work. It should not be assumed that Brunel
has any rights of ownership, and the University cannot
accept any liability for its subsequent use. It is a con-
dition of any such use that the user idemnifies the Uni-
versity against any claim (including third party claims)
arising therefrom.
tools Programmer's 3