Giter Club home page Giter Club logo

aetotvl6789 / ohcount Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blackducksoftware/ohcount

0.0 0.0 0.0 8.01 MB

The Ohloh source code line counter

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

License: GNU General Public License v2.0

Shell 1.91% JavaScript 17.35% Ruby 10.38% C++ 0.04% Scheme 0.32% Python 2.78% Perl 13.31% C 43.72% ActionScript 1.27% PHP 0.73% Emacs Lisp 0.25% Erlang 1.74% Objective-C 0.45% Java 0.81% OCaml 0.09% Common Lisp 1.64% Lua 0.87% Haskell 1.50% Scala 0.44% Smalltalk 0.41%

ohcount's Introduction

Coverity Scan Build Build Status

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.

Language Support

See: src/languages.h

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.

Building Ohcount

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

Dockerfile

One may use the bundled Dockerfile to build ohcount for Ubuntu:

$ docker build -t ohcount:ubuntu .

Manual build

Last updated: 2021-12-09

Ohcount needs Ruby 2.* to run tests. The ruby dev headers provided by Ubuntu/Fedora package managers were found to be missing a config.h header file. If the default ruby and ruby-dev packages do not work, install ruby using brew/rbenv/asdf/rvm, which work reliably with ohcount.

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). For older gcc versions one could try this fix.

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
Other Unix systems
  • If build fails with a missing ohcount.so error and any ruby/x86.../ folder has the file, copy it to ruby/ folder.

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:

$ bin/ohcount path/to/directory

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.

Contributing

  • Observe any existing PR contribution and emulate the pattern. For e.g. see this.
  • While writing the test/expected_dir files, disable any whitespace/tab replacing options from your editor.
  • Ohcount output has tabs in it, so the test/expected_dir also needs to contain tab characters.
  • Sample format of test/expected_dir is as follows. There is a tab character after dart, code & comment:
dart	code	void main() {
dart	comment	  // Line comment
  • Run tests with ./build tests.

ohcount's People

Contributors

notalex avatar raphink avatar amujumdar avatar bytbox avatar oblomov avatar d0k avatar borisfaure avatar bnkr avatar pmoura avatar earl avatar chris-morgan avatar ciaranm avatar haraldkl avatar grubba avatar jasonriedy avatar krajaratnam avatar sylvestre avatar pshiryaev avatar tsee avatar abeaumont avatar antonertl avatar dcsobral avatar mernen avatar dlech avatar lefticus avatar jerstlouis avatar mjl- avatar mwh avatar wildmichael avatar pdegenportnoy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.