summaryrefslogtreecommitdiff
path: root/pkg/scripts/check_code.sh
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-03-21 17:23:45 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-03-26 12:16:27 -0300
commit114857f4d31697ee58e0b1417013412fd6132efa (patch)
treecfc72f928661c7f8df081c7d61263452c0a362b3 /pkg/scripts/check_code.sh
parentc9b7206c3fc7c6e17bc4d8a733aa1f20475e86bf (diff)
Add script to quickly verify some code rules.
Diffstat (limited to 'pkg/scripts/check_code.sh')
-rwxr-xr-xpkg/scripts/check_code.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/pkg/scripts/check_code.sh b/pkg/scripts/check_code.sh
new file mode 100755
index 00000000..7bbd91f6
--- /dev/null
+++ b/pkg/scripts/check_code.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Escape code
+esc=`echo -en "\033"`
+
+# Set colors
+cc_green="${esc}[0;32m"
+cc_red="${esc}[0;31m"
+cc_normal=`echo -en "${esc}[m\017"`
+
+
+[[ -z "$1" ]] && WHERE='src/leap/bitmask' || WHERE=$1
+
+PEP8="pep8 --ignore=E202,W602 --exclude=*_rc.py,ui_*,_version.py $WHERE"
+echo "${cc_green}$PEP8${cc_normal}"
+$PEP8
+
+echo
+FLAKE8="flake8 --ignore=E202,W602 --exclude=*_rc.py,ui_*,_version.py $WHERE"
+echo "${cc_green}$FLAKE8${cc_normal}"
+$FLAKE8
+
+echo
+echo "${cc_green}Looking for 'print's, no prints in code, use logging/twisted.log.${cc_normal}"
+echo `git grep -n "print " | wc -l` 'coincidences.'
+
+echo
+echo "${cc_green}Grepping for 'pdb' code left behind.${cc_normal}"
+git grep -n "pdb"
+
+echo
+echo "${cc_green}Grepping for 'XXX|TODO|FIXME|NOTE|HACK'.${cc_normal}"
+echo `git grep -E "XXX|TODO|FIXME|NOTE|HACK" | wc -l` 'coincidences.'