skip to navigation
skip to content

Not Logged In

codevalidator 0.8.1

Simple source code validator with file reformatting option (remove trailing WS, pretty print XML, ..)

Simple source code validator with file reformatting option (remove trailing WS, pretty print XML, ..).

For Python code formatting it can either use autopep8 or the builtin copy of PythonTidy.


  • Python 2.7+
  • lxml (for XML formatting)
  • pep8 (for Python checking)
  • autopep8 (for Python formatting)
  • pyflakes (for static Python code checking)
  • Jalopy (for Java code formatting)
  • coffeelint (for CoffeeScript validation)
  • PHP_CodeSniffer (for PHP style checking)
  • Puppet (for Puppet manifest validation)
  • sqlparse
  • jshint (for JavaScript checking)
  • PyYAML (for YAML checking)

On Ubuntu you can install most packages easily:

sudo apt-get install python-lxml pep8 pyflakes nodejs npm
sudo npm install -g jshint


There are at least two ways of installing codevalidator:

  • Alternative 1: Use the codevalidator source tree directly (i.e. clone the GIT repo and put in your PATH):

    git clone
    sudo ln -s codevalidator/ /usr/local/bin/
  • Alternative 2: Install codevalidator from PyPI using PIP:

    sudo pip install codevalidator

Getting Started

Validating test files with builtin default configuration:

./ test/*

Fixing test files (removing trailing whitespace, XML format):

./ -f test/*

Using custom configuration file:

./ -c test/config.json test/*

Validate and fix a whole directory tree:

./ -c myconfig.json -rf /path/to/mydirectory

Validate a single PHP file and print detailed error messages (needs PHP_CodeSniffer with PSR standards installed!):

./ -v test/test.php

Running in very verbose (debug) mode to see what is validated:

./ -vvrc test/config.json test

Using the filter mode to “fix” stdin and write to stdout:

echo 'print 1' | ./ --fix --filter && echo success

If you are annoyed by the .XX.pre-cvfix backup files you can disable them either on the command line (--no-backup) or in the config file.

Advanced Usages

You can use the --fix --filter combination to directly filter your current buffer in VIM:

:%! --fix --filter %

The --fix --filter was also designed to be used with GIT filters.

To apply a formatting rule once without changing you configuration file, you can use the -a option. Formatting a Python file once with the pythontidy rule looks like:

./ -a pythontidy

Known Issues

  • PythonTidy cannot parse dict comprehensions. As a workaround you can use list comprehensions and wrap it with dict.
File Type Py Version Uploaded on Size
codevalidator-0.8.1.tar.gz (md5) Source 2014-05-04 34KB
  • Downloads (All Versions):
  • 0 downloads in the last day
  • 27 downloads in the last week
  • 152 downloads in the last month