← Back to team overview

savoirfairelinux-openerp team mailing list archive

[Merge] lp:~savoirfairelinux-openerp/lp-community-utils/checkout-pep8 into lp:lp-community-utils

 

Sandy Carter (http://www.savoirfairelinux.com) has proposed merging lp:~savoirfairelinux-openerp/lp-community-utils/checkout-pep8 into lp:lp-community-utils.

Requested reviews:
  OpenERP Community Reviewer/Maintainer (openerp-community-reviewer)

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/lp-community-utils/checkout-pep8/+merge/211098

A tool I use to quickly check pep8 on MPs.

A few people have asked what tool I use, so I though I would put it up here.

The command I use is:
./checkout-flake8.sh lp:launchpad_openerp_repo module_name
for example:
./checkout-flake8.sh lp:~savoirfairelinux-openerp/partner-contact-management/user-firstname/+merge/210710 partner_firstname

It checks it out in /tmp and runs flake8 on the module
-- 
https://code.launchpad.net/~savoirfairelinux-openerp/lp-community-utils/checkout-pep8/+merge/211098
Your team Savoir-faire Linux' OpenERP is subscribed to branch lp:~savoirfairelinux-openerp/lp-community-utils/checkout-pep8.
=== added file 'checkout-flake8.sh'
--- checkout-flake8.sh	1970-01-01 00:00:00 +0000
+++ checkout-flake8.sh	2014-03-14 17:08:06 +0000
@@ -0,0 +1,47 @@
+#!/usr/bin/bash
+
+# Check if flake8 and bzr exists
+which flake8 > /dev/null || exit 1
+which bzr > /dev/null || exit 1
+# Check that only one parametter was sent
+if [ "$#" -lt "1" ] || [ "$#" -gt "2" ]
+    then
+        echo "Usage:"
+        echo "$0 lp:repository [SUBDIRECTORY]"
+        echo "$0 https://code.launchpad.net/~group/repository/branch/+merge/0000000 [SUBDIRECTORY]"
+	exit 1
+fi
+SUBDIR='.'
+# Subdirectory defined
+if [ "$#" -eq 2 ]
+    then
+        SUBDIR="$2"
+fi
+# Check that parameters are actually a bazaar branch
+bzr info "$1" > /dev/null || exit 1
+
+echo "Making a temp directory"
+mkdir -p "/tmp/checkout-flake/" || exit 1
+cd "/tmp/checkout-flake/" || exit 1
+SRCBRANCH=$(echo "${1}" | sed 's,/+merge/[0-9]*$,,g')
+TODIR=$SRCBRANCH
+TODIR="${TODIR#lp:}"
+TODIR="${TODIR#http://}";
+TODIR="${TODIR#https://}";
+TODIR="${TODIR////.}"
+echo branching to $(pwd)/$TODIR
+if [ -d "$TODIR" ]
+    then
+        rm -rf "$TODIR"
+fi
+mkdir "$TODIR" || exit 1
+bzr branch "$SRCBRANCH" --use-existing-dir "$TODIR"
+cd "$TODIR"
+echo
+flake8 "$SUBDIR" --filename __init__.py --ignore F401,E501
+flake8 "$SUBDIR" --exclude __init__.py --ignore E501
+echo 
+flake8 "$SUBDIR" --select E501
+echo
+
+echo "Done"


Follow ups