From 570f31c908a07699edb96dd1637c4ead32e3eadb Mon Sep 17 00:00:00 2001 From: Ahmed Aly Date: Mon, 13 Nov 2017 16:38:20 +0100 Subject: [PATCH] pylint added --- dev/pylint/pre-commit | 2 ++ dev/pylint/pylintrc | 3 +++ dev/pylint/setup_pylint_hook | 24 ++++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100755 dev/pylint/pre-commit create mode 100644 dev/pylint/pylintrc create mode 100755 dev/pylint/setup_pylint_hook diff --git a/dev/pylint/pre-commit b/dev/pylint/pre-commit new file mode 100755 index 00000000..d76de08e --- /dev/null +++ b/dev/pylint/pre-commit @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +git-pylint-commit-hook --suppress-report diff --git a/dev/pylint/pylintrc b/dev/pylint/pylintrc new file mode 100644 index 00000000..815832d6 --- /dev/null +++ b/dev/pylint/pylintrc @@ -0,0 +1,3 @@ +[MASTER] +# Specify a configuration file. +rcfile=/home/aaly/gitrepos/dp-int/pylintrc diff --git a/dev/pylint/setup_pylint_hook b/dev/pylint/setup_pylint_hook new file mode 100755 index 00000000..c1ed7119 --- /dev/null +++ b/dev/pylint/setup_pylint_hook @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +if python -c "pylint_odoo" &> /dev/null; then + echo 'The pylint module "pylint-odoo" is not installed and is going to be installed now!' + sudo pip install --upgrade git+https://github.com/oca/pylint-odoo.git +else + echo 'The pylint module "pylint-odoo" is already installed. Continue ...' +fi + +if python -c "git_pylint_commit_hook" &> /dev/null; then + echo 'git-pylint-commit-hook is not insalled and is going to be isntalled now!' + sudo pip install git-pylint-commit-hook +else + echo 'git-pylint-commit-hook is already installed. Continue ...' +fi + +if [ ! -f ~/gitrepos/dp-int/pylintrc ]; then + echo "The pylintrc file can't be found in ~/gitrepos/dp-int/!" + echo "Please clone the git repository dp-int" +fi + +cd $(git rev-parse --show-toplevel) +ln -s -f ~/gitrepos/dp-int/pylintrc ~/.pylintrc +ln -s -f $(git rev-parse --show-toplevel)/dev/pylint/pre-commit $(git rev-parse --show-toplevel)/.git/hooks/pre-commit +echo 'pre-commit hook created!'