Last active
December 27, 2015 08:59
-
-
Save mdornseif/7299945 to your computer and use it in GitHub Desktop.
Makefile snippet to ensure python code quality
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dateien, die wir strenger checken. | |
STRICT_LINT_FILES= views/admin.py modules/beliza | |
# Alle Projektdateien | |
LINT_FILES= $(STRICT_LINT_FILES) *.py controllers/ modules/ views/ bin/import_rechnung.py | |
LINT_LINE_LENGTH= 110 | |
LINT_FLAKE8_ARGS= --max-complexity=18 --builtins=_ --max-line-length=$(LINT_LINE_LENGTH) | |
GOOD_NAMES=_,setUp,application,fd,gaetk_replication_SQL_INSTANCE_NAME,gaetk_replication_SQL_DATABASE_NAME,gaetk_replication_SQL_QUEUE_NAME | |
# pyLint | |
# W0142 = *args and **kwargs support | |
# Pointless whinging | |
# W0603 = Using the global statement | |
# R0201 = Method could be a function | |
# W0212 = Accessing protected attribute of client class | |
# W0232 = Class has no __init__ method | |
# W0212 = Access to a protected member _rev of a client class | |
# Mistakes in Parsing the AppEngine Source | |
# E1103: %s %r has no %r member (but some types could not be inferred) | |
# Usually makes sense for webapp.Handlers & Friends. | |
# W0221 Arguments number differs from %s method | |
# In Python versions < 2.6 all Exceptions inherited from Exception. py2.6 introduced BaseException | |
# On AppEngine we do not care much about the "serious" Exception like KeyboardInterrupt etc. | |
# W0703 Catch "Exception" | |
# R0903 Too few public methods - pointless for db.Models | |
# Pylint wirft folgenden Fehler nach keinem erkennbaren System. | |
# W0404: 24: Reimport 'views.wufoo' (imported line 27) | |
# Other | |
# R0924 Badly implemented Container - wtf_forms ist da der Übeltäter | |
# R0922 'Abstract class is only referenced 1 times' | |
# Unused Reports | |
# RP0401 External dependencies | |
# RP0402 Modules dependencies graph | |
# RP0101 Statistics by type | |
# RP0701 Raw metrics | |
# RP0801 Duplication | |
GOOD_NAMES=app,application | |
PYLINT_ARGS= --output-format=parseable -rn --ignore=config.py \ | |
--deprecated-modules=regsub,string,TERMIOS,Bastion,rexec,husoftm,hujson \ | |
--ignored-classes=Struct,Model,google.appengine.api.memcache,google.appengine.api.files \ | |
--dummy-variables-rgx="_|dummy|abs_url" \ | |
--good-names=$(GOOD_NAMES) \ | |
--generated-members=request,response,data,_fields,errors \ | |
--no-docstring-rgx="(__.*__|get|post)" \ | |
--function-rgx='"[a-z_][a-z0-9_]\{2,50\}$]"' \ | |
--method-rgx='"[a-z_][a-z0-9_]\{2,50\}$]"' \ | |
--additional-builtins=_ \ | |
--max-line-length=$(LINT_LINE_LENGTH) \ | |
--max-attributes=8 \ | |
--max-locals=25 \ | |
--max-public-methods=30 \ | |
--max-attributes=15 \ | |
--min-similarity-lines=6 \ | |
--disable=W0142 \ | |
--disable=W0603 \ | |
--disable=R0201 \ | |
--disable=W0212 \ | |
--disable=W0232 \ | |
--disable=W0212 \ | |
--disable=E1103 \ | |
--disable=W0221 \ | |
--disable=W0703 \ | |
--disable=R0924 \ | |
--disable=R0903 \ | |
--disable=W0404 \ | |
--disable=R0922 \ | |
--disable=I0011,W0201,W0403 \ | |
--disable=RP0401,RP0402,RP0101,RP0701,RP0801 | |
# --class-rgx=\(ab_\|audit_\|aui_\|bi_\|e_\|ent_\|fk_\|gs_\|ic_\|k_\|kui\|p_\|pr_\|sui_\)?[A-Z_][a-zA-Z0-9]+ \ | |
MYPYTHONPATH=./lib/google_appengine/lib/webapp2-2.5.1/:./lib/google_appengine/lib/jinja2-2.6 | |
checknodeps: | |
flake8 $(LINT_FLAKE8_ARGS) $(STRICT_LINT_FILES) $(LINT_FILES) | |
sh -c 'LC_ALL=en_US.UTF-8 PYTHONPATH=`python config.py`:$(MYPYTHONPATH) pylint $(PYLINT_ARGS) $(STRICT_LINT_FILES)' | |
@# der erste Durchlauf zeigt alle Probleme inkl. TODOs an | |
-sh -c 'LC_ALL=en_US.UTF-8 PYTHONPATH=`python config.py`:$(MYPYTHONPATH) pylint $(PYLINT_ARGS) $(LINT_FILES)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment