Boothj5

Full time software developer, part time hacker

Pyloc

Pyloc is a Lines Of Code analyser written in Python. Supported languages are configurable. Stats are broken down in to code, comments and whitespace, with Physical SLOC including everything.

Requires Python 2.6+ and WxPython to run the GUI.

Screenshots

Click an image to load the fullsize version.

Adding new languages

To add support for a new language, edit languages.py. Add a string value representing the language and the definition to the language dictionary:

LUA = "Lua"

LUA :
    { EXTENSIONS:    [ ".lua" ] ,
      LINECOMMENTS:  "--" ,
      BLOCKCOMMENTS: [ ( "--[[" , "]]" ) ] } }

Where the string represnets the name of the language, and the dictionary entries represent:

  1. EXTENSIONS is a comma seperated list of file extensions.
  2. LINECOMMENTS (optional) is a string representing characters used for line comments.
  3. BLOCKCOMMENTS (optional) is a comma seperated list of pairs of begin and end block comment strings.

Running

Pyloc can either be run as a desktop GUI:

./pyloc.py

Or as a terminal application by calling pylocstats.py directly:

Usage: pylocstats.py directory [-v]

Where 'directory' is the directory to scan and -v will cause verbose output.

Source

The source can be found on Github