Add pylint configuration file (pylintrc) and do_pylint.sh script which runs pylint checkers on Melange code using pylintrc file as config. do_pylint.sh as default shows additional information like reports, TODOs, code similarities and unused imports, but you can run it in silent mode (--silent) which disables all of that. The only problem with unused imports in pylint right now is that it doesn't work in the situation described in last example at http://code.google.com/p/soc/wiki/PythonStyleGuide#Packages, so sometimes we get unused import soc when we actually shouldn't. However this can be fixed by writing pylint plugins (our own checkers) in future.
Patch by: Pawel Solyga
Review by: to-be-reviewed
from django.conf import settings
# function that will pass a test.
def pass_test(*args): return
def no_backend(test_func, backend):
"Use this decorator to disable test on specified backend."
if settings.DATABASE_ENGINE == backend:
return pass_test
else:
return test_func
# Decorators to disable entire test functions for specific
# spatial backends.
def no_oracle(func): return no_backend(func, 'oracle')
def no_postgis(func): return no_backend(func, 'postgresql_psycopg2')
def no_mysql(func): return no_backend(func, 'mysql')
# Shortcut booleans to omit only portions of tests.
oracle = settings.DATABASE_ENGINE == 'oracle'
postgis = settings.DATABASE_ENGINE == 'postgresql_psycopg2'
mysql = settings.DATABASE_ENGINE == 'mysql'