Almad / ohcount

The Ohloh source code line counter

Home Page:https://github.com/blackducksw/ohcount

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

Usage & Installation in Docker

This is a fork of original code for easier installation and usage using Docker. Use the following lines:

docker build -t ohcount .
docker run -it -v `pwd`:/code ohcount

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 12.04 LTS. Other Linux environments should also work, but your mileage may vary.

Ohcount does not support Windows.

Ohcount targets Ruby 1.9.3. The build script requires a bash shell. You also need a C compiler to build the native extensions.

Source Code

Ohcount source code is available as a Git repository:

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

Building Ohcount

You will need ragel 6.8 or higher, bash, pcre, magic, gcc (version 4.8.2 or greater) and SWIG (2.0.11). Once you have them, go to the top directory of ohcount and run

./build

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.

About

The Ohloh source code line counter

https://github.com/blackducksw/ohcount

License:GNU General Public License v2.0


Languages

Language:Ragel in Ruby Host 28.5%Language:C 18.1%Language:JavaScript 9.2%Language:Perl 7.1%Language:Ruby 5.5%Language:C++ 4.2%Language:REXX 2.2%Language:MATLAB 1.7%Language:Python 1.5%Language:R 1.3%Language:Visual Basic 1.2%Language:Pascal 1.1%Language:Pike 1.0%Language:Shell 1.0%Language:Erlang 0.9%Language:Common Lisp 0.9%Language:Haskell 0.8%Language:Boo 0.8%Language:Puppet 0.7%Language:ActionScript 0.7%Language:eC 0.6%Language:Cuda 0.5%Language:IDL 0.5%Language:Haxe 0.5%Language:VHDL 0.5%Language:Limbo 0.5%Language:Lua 0.5%Language:Java 0.4%Language:C# 0.4%Language:Assembly 0.4%Language:PHP 0.4%Language:F# 0.4%Language:Awk 0.3%Language:HTML 0.3%Language:GLSL 0.3%Language:Rebol 0.3%Language:Scilab 0.3%Language:Vala 0.3%Language:ASP 0.3%Language:Smalltalk 0.2%Language:Objective-C 0.2%Language:Scala 0.2%Language:M 0.2%Language:Scheme 0.2%Language:D 0.1%Language:PLSQL 0.1%Language:Tcl 0.1%Language:Emacs Lisp 0.1%Language:NSIS 0.1%Language:Ada 0.1%Language:Forth 0.1%Language:CoffeeScript 0.1%Language:Clojure 0.1%Language:Modula-2 0.1%Language:BlitzMax 0.1%Language:Dylan 0.1%Language:Rust 0.1%Language:Vim Script 0.1%Language:Fortran 0.1%Language:COBOL 0.1%Language:XSLT 0.1%Language:CMake 0.1%Language:Gosu 0.1%Language:Objective-J 0.1%Language:Brainfuck 0.1%Language:Logtalk 0.1%Language:Factor 0.1%Language:Nix 0.1%Language:Prolog 0.1%Language:QML 0.1%Language:TeX 0.1%Language:Racket 0.1%Language:Augeas 0.1%Language:Makefile 0.0%Language:RenderScript 0.0%Language:OCaml 0.0%Language:Coq 0.0%Language:Eiffel 0.0%Language:Groovy 0.0%Language:DIGITAL Command Language 0.0%Language:M4 0.0%Language:Batchfile 0.0%Language:QMake 0.0%Language:CSS 0.0%Language:DTrace 0.0%Language:Perl 6 0.0%