As to ensure the quality of the code that is added to the project, we ask all the developers to setup a code quality tool on their development environment to enhance the overall code.
Make sure you are in the development environment and run :
pip install pylint git-pylint-commit-hook
The command pylint and git-pylint-commit-hook will now be accessible in your system.
For this, you’ll need to have NodeJS installed on you computer as well as NPM (Node Package Management tool).
First you’ll have to install the latest version of NodeJS on your computer :
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install python-software-properties python g++ make nodejs
Then install jslint and jshint
npm config set registry http://registry.npmjs.org/
sudo npm install jslint -g
sudo npm install jshint -g
After running those commands, the jshint binary should be available in the directory /usr/local/bin/jshint
Setup git hook
In your repository, you’ll need to edit the file (or create it) .git/hooks/pre-commit with the following :
In the root folder of your repository, make sure that you have the following files :
Click to see the file : .pylintrc
And this is it. Now with this you should be ready to commit
Setup lint in Eclipse
For python you can enable pylint inside Eclipse to have code assist with usefull tips.
Go in Window > Preferences > PyDev > PyLint
Setup lint in Vim
Here are a few links to setup the Lint environment in Vim :
pylint.vim : compiler plugin for python style checking tool
Jshint2.vim : Lightweight, customizable and functional Vim plugin for JSHint integration.
Syntastic : Syntax checking hacks for vim