File: README.md

package info (click to toggle)
ohcount 4.0.0-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 8,580 kB
  • sloc: ansic: 7,584; javascript: 3,300; ruby: 2,363; perl: 2,065; objc: 1,325; python: 445; pascal: 398; erlang: 350; sh: 275; lisp: 272; vhdl: 150; haskell: 149; asm: 127; cs: 124; awk: 98; java: 92; php: 77; tcl: 58; xml: 57; fortran: 54; modula3: 32; makefile: 30; ada: 30; jsp: 28; sql: 18; cobol: 13; ml: 9
file content (126 lines) | stat: -rw-r--r-- 3,291 bytes parent folder | download | duplicates (3)
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
Ohcount
=======

Ohloh's source code line counter.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License Version 2 as
published by the Free Software Foundation.

License
-------

Ohcount is specifically licensed under GPL v2.0, and no later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Overview
--------

Ohcount is a library for counting lines of source code.
It was originally developed at Ohloh, and is used to generate
the reports at www.openhub.net.

Ohcount supports multiple languages within a single file: for example,
a complex HTML document might include regions of both CSS and JavaScript.

Ohcount has two main components: a detector which determines the primary
language family used by a particular source file, and a parser which
provides a line-by-line breakdown of the contents of a source file.

Ohcount includes a command line tool that allows you to count individual
files or whole directory trees. It also allows you to find source code
files by language family, or to create a detailed annotation of an
individual source file.

Ohcount includes a Ruby binding which allows you to directly access its
language detection features from a Ruby application.

System Requirements
-------------------

Ohcount is supported on Ubuntu 18.04 LTS. It has also been tested on Fedora 29.
Other unix-like environments should also work, but your mileage may vary.

Ohcount does not support Windows.

Ohcount targets Ruby 2.5.0. The ruby dev headers provided by Ubuntu/Fedora
package managers were found to be missing a *config.h* header file. Installing
ruby using brew/rbenv/rvm works better for compiling ohcount.

Source Code
-----------

Ohcount source code is available as a Git repository:

  git clone git://github.com/blackducksoftware/ohcount.git

Building Ohcount
----------------

> Last updated: 2019-01-28

You will need ragel 7.0 or higher, bash, gperf, libpcre3-dev, libmagic-dev,
gcc(version 7.3 or greater) and swig (>=3.0.0).

#### Ubuntu/Debian

```
$ sudo apt-get install libpcre3 libpcre3-dev libmagic-dev gperf gcc ragel swig
$ ./build
```

### Fedora

```
$ sudo dnf install gcc file-devel gperf ragel swig pcre-devel
$ ./build
```

#### OSx

```
$ brew install libmagic pcre ragel swig
$ ./build
```

For the ruby bindings, there is a dependency for the 'test-unit' gem:

```
$ gem install test-unit
```

Using Ohcount
-------------

Once you've built ohcount, the executable program will be at bin/ohcount. The most basic use is to count lines of code in a directory tree. run:

```
$ bin/ohcount
```

Ohcount support several options. Run `ohcount --help` for more information.

Building Ruby and Python Libraries
----------------------------------

To build the ruby wrapper:

```
$ ./build ruby
```

To build the python wrapper, run

```
$ python python/setup.py build
$ python python/setup.py install
```

The python wrapper is currently unsupported.