Commits

Markus Zapke-Gründemann committed f1139f8

Removed .sh extension.

  • Participants
  • Parent commits 1f30c46

Comments (0)

Files changed (3)

-*********
-pyanalyze
-*********
+********
+pynalyze
+********
 
-pyanalyze is a small Python code analyzer. It is a shell wrapper around SLOCCount_ and flake8_.
+pynalyze is a small Python code analyzer. It is a shell wrapper around SLOCCount_ and flake8_.
 
 Usage::
 
-    $ pyanalyze directory
+    $ pynalyze directory
 
-pyanalyze will generate a short report with all PEP8 violations and a rating of the code.
+pynalyze will generate a short report with all PEP8 violations and a rating of the code.
 
 .. _SLOCCount: http://www.dwheeler.com/sloccount/
 .. _flake8: https://pypi.python.org/pypi/flake8
+#!/bin/sh
+#
+# Python Code Analyser
+#
+# pynalyze is a small wrapper around SLOCCount and flake8.
+#
+# Copyright Markus Zapke-Gründemann <markus@keimlink.de>, All Rights Reserved
+#
+
+if [ ! $1 ]; then
+    echo "Usage: $0 directory"
+    exit 1
+fi
+
+# Names of directories and files to be excluded.
+# ack accepts regular expressions, flake8 does not.
+EXCLUDE_ACK='(?!.*migrations|.*docs|.*run(\-)*tests\.py)'
+EXCLUDE_FLAKE8='migrations,docs,run-tests.py,runtests.py'
+echo "Excluding: $EXCLUDE_FLAKE8"
+
+# Collect and display all PEP8 violations.
+VIOLATIONS=$(flake8 --exclude=$EXCLUDE_FLAKE8 $1)
+echo
+echo "PEP8 violations"
+echo "$VIOLATIONS"
+
+# Display PEP8 violation statistics.
+echo
+echo "$VIOLATIONS" | ack -o "[EW]\d{1,3}.*" | sort | uniq -c
+
+# Compute and display number of errors, warnings and total PEP8 violations.
+ERRORS=$(echo "$VIOLATIONS" | ack -co 'E\d+')
+WARNINGS=$(echo "$VIOLATIONS" | ack -co 'W\d+')
+TOTAL=$(echo "$ERRORS+$WARNINGS" | bc)
+echo
+echo "PEP8 errors: $ERRORS"
+echo "PEP8 warnings: $WARNINGS"
+echo "Total PEP8 violations: $TOTAL"
+
+# Collect SLOC for all Python files which are not excluded.
+SLOC=$(sloccount --details $1 | ack "^[1-9]\d*(?=.*py|)$EXCLUDE_ACK" -o | paste -sd+ - | bc -l)
+echo "Python SLOC: $SLOC"
+
+# Compute and display rating (maximum is 10 points) and smilie.
+# Warnings inflict double damage.
+RATING=$(echo "10-10*($ERRORS+($WARNINGS*2))/$SLOC" | bc -l)
+if [ "${RATING/\.*}" -ge "9" ]; then
+    SMILIE=':)'
+elif [ "${RATING/\.*}" -ge "7" ]; then
+    SMILIE=':|'
+else
+    SMILIE=':('
+fi
+printf "\nPoints: %.2f %s\n" $RATING $SMILIE

File pynalyze.sh

-#!/bin/sh
-#
-# Python Code Analyzer
-#
-# pyanalyze is a small wrapper around SLOCCount and flake8.
-#
-# Copyright Markus Zapke-Gründemann <markus@keimlink.de>, All Rights Reserved
-#
-
-if [ ! $1 ]; then
-    echo "Usage: $0 directory"
-    exit 1
-fi
-
-# Names of directories and files to be excluded.
-# ack accepts regular expressions, flake8 does not.
-EXCLUDE_ACK='(?!.*migrations|.*docs|.*run(\-)*tests\.py)'
-EXCLUDE_FLAKE8='migrations,docs,run-tests.py,runtests.py'
-echo "Excluding: $EXCLUDE_FLAKE8"
-
-# Collect and display all PEP8 violations.
-VIOLATIONS=$(flake8 --exclude=$EXCLUDE_FLAKE8 $1)
-echo
-echo "PEP8 violations"
-echo "$VIOLATIONS"
-
-# Display PEP8 violation statistics.
-echo
-echo "$VIOLATIONS" | ack -o "[EW]\d{1,3}.*" | sort | uniq -c
-
-# Compute and display number of errors, warnings and total PEP8 violations.
-ERRORS=$(echo "$VIOLATIONS" | ack -co 'E\d+')
-WARNINGS=$(echo "$VIOLATIONS" | ack -co 'W\d+')
-TOTAL=$(echo "$ERRORS+$WARNINGS" | bc)
-echo
-echo "PEP8 errors: $ERRORS"
-echo "PEP8 warnings: $WARNINGS"
-echo "Total PEP8 violations: $TOTAL"
-
-# Collect SLOC for all Python files which are not excluded.
-SLOC=$(sloccount --details $1 | ack "^[1-9]\d*(?=.*py|)$EXCLUDE_ACK" -o | paste -sd+ - | bc -l)
-echo "Python SLOC: $SLOC"
-
-# Compute and display rating (maximum is 10 points) and smilie.
-# Warnings inflict double damage.
-RATING=$(echo "10-10*($ERRORS+($WARNINGS*2))/$SLOC" | bc -l)
-if [ "${RATING/\.*}" -ge "9" ]; then
-    SMILIE=':)'
-elif [ "${RATING/\.*}" -ge "7" ]; then
-    SMILIE=':|'
-else
-    SMILIE=':('
-fi
-printf "\nPoints: %.2f %s\n" $RATING $SMILIE