Here are listed different validator and linting modules supported by VVV.
Validator name: tabs
Do not allow hard tabs in committed files. Instead, use soft tabs and spaces.
To allow hard tabs in any file add the following in your validator-options.yaml:
tabs:
enable: false
To allow hard tabs in specific files use validator-files.yaml:
tabs:
Makefile
*.mk
VVV provides a Python script to expand tabs to spaces in-place.
See vvv-expand-tabs.
No options.
Validator name: linelength
Check that that text file lines are not too long.
Built-in - no external software needed.
Validator name:: evilspace
Make sure text files do not contain no-break space (NBS) character.
All text files.
No options.
Validator name: jshint
Lint Javascript files using jshint.
Your system supports Node.js and must have jshint package installed.
Please see prerequisites.
Options for jshint section in validation-options.yaml.
Example validation-options.yaml:
jshint:
configuration: |
{
eqeqeq : true
}
Warning
Make sure configuration is valid JSON. jshint silently ignores these options otherwise.
Pass in .jshintrc configuration options.
Pass in extra arguments for the jshint command line.
VVV provides a Python script to add /* global */ hints to several Javascript files once.
See vvv-add-js-globals.
Validator name: pylint
Lint Python files using Pylint.
Warning
pylint installation is broken for Python 3.x - please see notes below
A temporarily virtualenv environment is automatically created where pylint command and its dependencies are is installed. However this is not very good way to run pylint, as if you are using any third party libraries pylint cannot import them and thus fails.
It is recommended to use host-python-env option - this whill install pylint to a Python environment which you enable before running.
Example (assuming you have host-python-env set in validate-options.yaml):
# Activate virtualenv
source venv/bin/activate
# Run vvv and install pylint to now activate Python env
vvv --reinstall
The default pylint checks are very strict. You might want to see a more relaxed configuration example:
* https://github.com/miohtama/vvv/blob/master/validation-options.yaml
Example validation-options.yaml:
pylint:
python3k: true
command-line: --reports=n
If true do not create a virtualenv for running pylint, but install pylint using the active python environment where vvv is run.
Default is false.
Note
If you change this you need run vvv --reinstall.
A path spec pointing to used pylint command.
Use this command to run pylint. This is for cases where host-python-env is not enough to tame your Python package dependencies.
If this option starts with . it is considered to be a directory reference relative to the project root.
IF this option starts with / it is considered to be absolute directory reference.
Otherwise normal path look behavior is used (UNIX which commmand behavior).
Example:
pylint:
enabled: true
python3k: false
# Points to buildout/bin/pylint command two levels below project folder
pylint-command: ../../bin/pylint
Pass in pylint configuration file data. This is a block of text which gets passed in as pylint .rc file. For rc file example run command:
pylint --generate-rcfile
If true set-up pylint for Python 3.x. The default is Python 2.x.
Note
If you change this you need run vvv --reinstall.
To disable warning per source code file one can add pylint hints in the .py files using pylint: directives like:
# :R0201: *Method could be a function*
# W0102 Dangerous default value [] as argument
# R0921 Abstract class not referenced
# :W0611: *Unused import %s*
# pylint: disable=R0201, W0102, R0921, W0611
These can be function or module level scoped.
To see all pylint error and warning message ids:
pylint --list-msgs
And to find a message id:
pylint --list-msgs|grep -i "Dangerous default"
:W0102: *Dangerous default value %s as argument*
Currently you need to manually fix logilab-astng package for Python 3 with trunk version.
The error:
File "/Users/moo/code/vvv/dist/test/lib/python3.2/site-packages/logilab_astng-0.23.1-py3.2.egg/logilab/astng/scoped_nodes.py", line 249, in file_stream
return file(self.file)
NameError: global name 'file' is not defined
If you are using a .vvv virtualenv:
cd ~/.vvv
source pylint/pylint-virtualenv/bin/activate
hg clone http://hg.logilab.org/logilab/astng
cd astng
python setup.py install
If you are using host-python-env option:
source YOURVIRTUALENV/bin/activate
hg clone http://hg.logilab.org/logilab/astng
cd astng
python setup.py install
After this re-run vvv and everything should go ok.
Validator name:: pdb
Do not allow Python pdb breakpoints in the committed files.
E.g. this will fail:
def foo(self):
import pdb ; pdb.set_trace()
The validator match for pdb.set_trace() in uncommented lines.
*.py
No options.
Validator name: css
Validate CSS files against W3C CSS validator.
Your system must have Java installed and support and java command.
Please see prerequisites.
CSS validator is Java executable and bunch of JAR files which are downloaded and installed automatically.
If you get error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/tools/resources/ProtocolException
Caused by: java.lang.ClassNotFoundException: org.w3c.tools.resources.ProtocolException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
It is probably caused by a broken automatic W3C validator installation and you can fix it with:
rm -rf ~/.vvv/css
Validator name: rst
Check that .rst files do not contain syntax errors using docutils. Restructured format is used by Sphinx documentatio tool and also supported by Github README files.
Note
Unknown restructured directives errors are ignored, mainly because systems like Sphinx add their own directives.
Works out of the box.
None.