1SLOCCOUNT(1)                       SLOCCount                      SLOCCOUNT(1)
2
3
4

NAME

6       sloccount - count source lines of code (SLOC)
7

SYNOPSIS

9       sloccount  [--version]  [--cached]  [--append]  [ --datadir directory ]
10       [--follow] [--duplicates]  [--crossdups]  [--autogen]  [--multiproject]
11       [--filecount]  [--wide] [--details] [ --effort F E ] [ --schedule F E ]
12       [ --personcost cost ] [ --overhead overhead ] [ --addlang language ]  [
13       --addlangall ] [--] directories
14

DESCRIPTION

16       sloccount  counts the physical source lines of code (SLOC) contained in
17       descendants of the specified  set  of  directories.   It  automatically
18       determines  which  files  are  source  code files, and it automatically
19       determines the computer language used in each file.  By default it sum‐
20       marizes the SLOC results and presents various estimates (such as effort
21       and cost to develop), but its  output  can  be  controlled  by  various
22       options.
23
24       If  you  give  sloccount  a list of two or more directories, the counts
25       will be broken up according to that list.  There is one important limi‐
26       tation:  the  basenames  of the directories given as parameters must be
27       different, because those names are used to group  summary  information.
28       Thus,  you  can't  run "sloccount /usr/src/hello /usr/local/src/hello".
29       This limitation only applies to parameters of sloccount  -  subdirecto‐
30       ries descended from the top directories can have the same basename.
31
32       If you give sloccount only a single directory, sloccount tries to auto‐
33       matically find a reasonable breakdown for  purposes  of  reporting  (so
34       it'll  produce a useful report).  In this case, if the directory has at
35       least two subdirectories, then those subdirectories will be used as the
36       breakdown.   If the single directory contains files as well as directo‐
37       ries (or if you give sloccount some files as parameters),  those  files
38       will  be assigned to the directory "top_dir" so you can tell them apart
39       from other contents.  Finally, if there's a subdirectory  named  "src",
40       then  that subdirectory is again broken down, with all the further sub‐
41       directories prefixed with "src_".  Thus, if directory "X" has a  subdi‐
42       rectory  "src",  which  contains subdirectory "modules", sloccount will
43       report a separate count for "src_modules".
44
45       sloccount normally considers  all  descendants  of  these  directories,
46       though unless told otherwise it ignores symbolic links.
47
48       sloccount  is  the usual front-end of the package of tools named "SLOC‐
49       Count".  Note that the name of the entire package has capital  letters,
50       while the name of this front-end program does not.
51
52       sloccount  will normally report estimates of schedule time, effort, and
53       cost, and for single projects it also estimates the average  number  of
54       active  developers.   These  are merely estimates, not etched in stone;
55       you can modify the parameters used to improve the estimates.
56
57
58

OPTIONS

60       --version   Report the version  number  of  SLOCCount  and  immediately
61                   exit.   This  option  can't  be  usefully combined with any
62                   other option.
63
64
65       --cached    Do not recalculate; instead, use cached results from a pre‐
66                   vious  execution.  Without the --cached or --append option,
67                   sloccount automatically  removes  the  data  directory  and
68                   recreates it.
69
70
71       --append    Do  not  remove  previous calculations from the data direc‐
72                   tory; instead, add the analysis to the current contents  of
73                   the data directory.
74
75
76       --datadir directory
77                   Store  or  use  cached  data  in  the given data directory;
78                   default value is "~/.slocdata".
79
80
81       --follow    Follow symbolic links.
82
83
84       --duplicates
85                   Count all duplicates.  Normally, if files have  equal  con‐
86                   tent  (as  determined  using  MD5 hash values), only one is
87                   counted.
88
89
90       --crossdups Count duplicates if they occur in different portions of the
91                   breakdown.   Thus,  if the top directory contains many dif‐
92                   ferent projects, and you want the duplicates  in  different
93                   projects to count in each project, choose this option.
94
95
96       --autogen   Count  source  code  files  that appear to be automatically
97                   generated.  Normally these are excluded.
98
99
100       --multiproject
101                   The different  directories  represent  different  projects;
102                   otherwise, it's assumed that all of the source code belongs
103                   to a single project.  This doesn't change the total  number
104                   of  files or SLOC values, but it does affect the effort and
105                   schedule estimates.  Given this option, effort is  computed
106                   separately  for  each  project  (and  then summed), and the
107                   schedule is the estimated schedule of the largest project.
108
109
110       --filecount Display counts of files instead of SLOC.
111
112
113       --wide      Display in the "wide" (tab-separated) format.
114
115
116       --details   Display details, that is, results  for  every  source  code
117                   file.
118
119
120       --effort F E
121                   Change  the  factor  and  exponent  for  the  effort model.
122                   Effort (in person-months) is computed as F*(SLOC/1000)^E.
123
124
125       --schedule F E
126                   Change the factor and  exponent  for  the  schedule  model.
127                   Schedule (in months) is computed as F*(effort)^E.
128
129
130       --personcost cost
131                   Change the average annual salary to cost.
132
133
134       --overhead overhead
135                   Change  the  overhead value to overhead.  Estimated cost is
136                   computed as effort * personcost * overhead.
137
138
139       --addlang language
140                   Add a language not considered by default  to  be  a  ``lan‐
141                   guage''  to  be  reported.  Currently the only legal values
142                   for language are  "makefile",  "sql",  and  "html".   These
143                   files  are  not  normally  included  in  the  SLOC  counts,
144                   although their SLOCs are internally calculated and they are
145                   shown in the file counts.  If you want to include more than
146                   one such language, do it by  passing  --addlang  more  than
147                   once, e.g., --addlang makefile --addlang sql.
148
149
150       --addlangall
151                   Add all languages not normally included in final reports.
152
153

NOTES

155       As  with many other programs using Unix-like options, directories whose
156       names begin with a dash (``-'') can be misinterpreted as  options.   If
157       the directories to be analyzed might begin with a dash, use the double-
158       dash (``- -'') to indicate the end of the option  list  before  listing
159       the directories.
160
161

BUGS

163       Filenames  with  embedded newlines (in the directories or their descen‐
164       dants) won't be handled correctly; they will be interpreted as separate
165       filenames  where  the newlines are inserted.  An attacker could prevent
166       sloccount from working by creating filenames of the form /normal/direc‐
167       tory  ...  NEWLINE/dev/zero.   Such  filenames  are exceedingly rare in
168       source code because they're a pain to work with using other tools, too.
169       Future versions of sloccount may internally use NUL-separated filenames
170       (like GNU find's -print0 command) to fix this.
171
172       There are many more languages not yet handled by SLOCCount.
173
174       SLOCCount only reports physical source lines of code.  It would be very
175       useful if it could also report logical lines of code, and perhaps other
176       common metrics such as McCabe's complexity measures and complexity den‐
177       sity (complexity/SLOC for each function or procedure).
178
179
180

SEE ALSO

182       See  the  SLOCCount website at http://www.dwheeler.com/sloccount.  Note
183       that more detailed documentation is available both on the  website  and
184       with the SLOCCount package.
185
186

AUTHOR

188       David A. Wheeler (dwheeler@dwheeler.com).
189
190
191
192
193SLOCCount                        31 July 2004                     SLOCCOUNT(1)
Impressum