Lint : a code quality tool for your development environment

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.

Install pylint

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.

install jslint

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

https://github.com/reid/node-jslint

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 :

#!/usr/bin/env bash
./tools/pre-commit

In the root folder of your repository, make sure that you have the following files :

.jshintrc

//http://www.jshint.com/docs/options/
//http://jslinterrors.com/
{
  "asi": false,
  "expr": true,
  "loopfunc": true,
  "curly": false,
  "evil": true,
  "white": true,
  "undef": true,
  "node": true,
  "camelcase": false,
  "eqeqeq": true,
  "indent": 4,
  "quotmark": "double",
  "unused": false,
  "trailing": true,
  "maxlen": 100,
  "white": true,
  "globals": {
    "$": false,
    "jQuery": false,
    "angular": false,
    "console": false,
    "require": false
  }
}

.jshintignore

node_modules
cpwp/cwp/public/lib

.pylintrc

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

Capture du 2014-04-14 15:13:02

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

Listening for peace

In this TED Talk, the presenter tells us how important listening is. In our world we are not listening enough to our pairs. We are focused, concentrated, deconcetrated, multi-tasking all the time. But the consequence of that is misunderstanding, which can lead to violence and pain.

Recently I felt frustrated because I wanted to tell someone what I was thinking about something he did. My aim was to help him to improve but he was not really listening … even if he was saying « yes, yes, yes ». I felt bad afterwards and in the end I was almost angry of not being listened to. So in this little life experience, I felt how it is important to give your attention to others.

In the following talk, you’ll receive 5 little exercises to improve your ability to listen. Starting from now, I’ll try to apply them ! If you wish to join the effort, I added the list of exercises on the bottom of this articles.

5 exercises :

  • Silence : 3 minutes of silence a day to recalibrate and be able to listen to silence again
  • The Mixer : listen to how many channels of noise you can hear in a noisy environment
  • Savouring : listen to everyday sounds to find out the hidden choir
  • Listening positions : adapt your listening position according to what you are listening to and playing with those filters :
    • Active / Passive
    • Reductive / Expansive
    • Critical / Empathic
  • RASA : if you are leader, spouse, friend, parent, teacher :
    • Recieve : pay attention to the person
    • Appreciate : making little noises like « hmm », « ah », « ok »
    • Summarize : Using the word « so, you said that … », « if I’m right you think that … »
    • Ask : To make sure you understood well

Good listening 😉

Getting to FOSDEM 2014

Begin february I went to the annually biggest european conference on Free Software in Brussels, the FOSDEM. It was the opportunity to get in touch with the developper’s world and to listen to some conferences presenting libraries or tools that I may use in my project.

Since I’m developping a python web application I wanted to go to the javascript and python rooms to listen to their talks. I was surprised to see how small those rooms were. The rooms were completely full and it was almost impossible to get into it. I had to abandon the idea to listen to javascript talks. I was feeling frustrated because lots of javascript talks sounds very interesing. Fortunately the talks will be available on the web later.

In the python room I could listen to some interesting talks. Here is a little overview of the subjects :

Eve Framework

The Eve framework is a new web application framework that provides a quick tool to develop rest API. Powered by Flask, MongoDB, Redis and good intentions Eve allows to effortlessly build and deploy highly customizable, fully featured RESTful Web Services. You can also find more information on their blog.

Debugging

  • Sentry is a tool to manage the errors generated by a production application. When you application run into an exception you will get notified on sentry and it will generate a ticket. Sentry can also be connecter to any task management system like Jira.
  • Pyrasite is a module that allows you to execute code in your application during its execution. It is a tool for injecting code into running Python processes.
  • New Relic is a powerful tool to profile the thread of your application and determine which part of your code is the most heavily loaded anytime. The Thread Profiler is a low-impact profiling tool used to identify app bottlenecks in your production environments

Alembic

Alembic is a tool for database migration.

Python Fibers

Fibers is another implementation of eventlets. Eventlets are event-based threads that can be executed in a single process.

Databases

Couchbase is a document based database, so it is an interesting alternative for mongoDB for some specific cases.

We also got an interesting talk about how the New York Times decided to setup Cassandra in their software architecture.

But the last talk I heard was about mongoDB and gave some tips to switch from SQL to NoSQL : How mongodb can tackle most of your problems.