os.path.join("mysql-test", "t"), os.path.join("mysql-test", "suite", "experimental", "t"), os.path.join("mysql-test", "suite", "performance", "t"), os.path.join("mysql-test", "suite", "replication", "t"), ) _CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) (_BASE_PATH, _,) = os.path.split(_CURRENT_PATH) if os.path.exists(os.path.join(_BASE_PATH, "internal")): _PACKAGES = _PACKAGES + (os.path.join("internal", "packaging"),) # Add base path and mysql-test to sys.path sys.path.append(_BASE_PATH) sys.path.append(os.path.join(_BASE_PATH, "mysql-test", "mutlib")) if pylint_version.split(".") < _PYLINT_MIN_VERSION.split("."): sys.stdout.write("ERROR: pylint version >= {0} is required to run " "pylint_tests.\n".format(_PYLINT_MIN_VERSION)) sys.exit(1) if pep8_version.split(".") < _PEP8_MIN_VERSION.split("."): sys.stdout.write("ERROR: pep8 version >= {0} is required to run " "pylint_tests.\n".format(_PEP8_MIN_VERSION)) sys.exit(1) class CustomTextReporter(TextReporter): """A reporter similar to TextReporter, but display messages in a custom format. """ name = "custom"
print "Unable to import pylint, it may need to be installed" sys.exit(1) # Classes of errors we ignore on quiet runs IGNORED_ERRORS = 'E1002,E1101,E1103,E1120,F0401,I0011' # By default, complain about all things LINT_VERBOSE = True def set_verbosity(verbose): ''' Changes the verbosity level ''' global LINT_VERBOSE LINT_VERBOSE = verbose major, minor, _ = pylint_version.split('.') pylint_version = float("%s.%s" % (major, minor)) # patch up the logilab module lookup tools to understand autotest.* trash import logilab.common.modutils _ffm = logilab.common.modutils.file_from_modpath def file_from_modpath(modpath, path=None, context_file=None): if modpath[0] == "autotest": if modpath[1:]: return _ffm(modpath[1:], path, context_file) return _ffm(modpath, path, context_file) logilab.common.modutils.file_from_modpath = file_from_modpath import pylint.lint from pylint.checkers import imports
import re import sys import common from autotest_lib.client.common_lib import autotemp, revision_control # Do a basic check to see if pylint is even installed. try: import pylint from pylint.__pkginfo__ import version as pylint_version except ImportError: print("Unable to import pylint, it may need to be installed." " Run 'sudo aptitude install pylint' if you haven't already.") sys.exit(1) major, minor, release = pylint_version.split('.') pylint_version = float("%s.%s" % (major, minor)) # some files make pylint blow up, so make sure we ignore them BLACKLIST = ['/site-packages/*', '/contrib/*', '/frontend/afe/management.py'] # patch up the logilab module lookup tools to understand autotest_lib.* trash import logilab.common.modutils _ffm = logilab.common.modutils.file_from_modpath def file_from_modpath(modpath, path=None, context_file=None): """ Wrapper to eliminate autotest_lib from modpath. @param modpath: name of module splitted on '.'
# Classes of errors we ignore on quiet runs IGNORED_ERRORS = 'E1002,E1101,E1103,E1120,F0401,I0011' # By default, complain about all things LINT_VERBOSE = True def set_verbosity(verbose): ''' Changes the verbosity level ''' global LINT_VERBOSE LINT_VERBOSE = verbose major, minor, _ = pylint_version.split('.') pylint_version = float("%s.%s" % (major, minor)) # patch up the logilab module lookup tools to understand autotest.* trash import logilab.common.modutils _ffm = logilab.common.modutils.file_from_modpath def file_from_modpath(modpath, path=None, context_file=None): if modpath[0] == "autotest": if modpath[1:]: return _ffm(modpath[1:], path, context_file) return _ffm(modpath, path, context_file) logilab.common.modutils.file_from_modpath = file_from_modpath
import os, sys, fnmatch try: import autotest.common as common except ImportError: import common # do a basic check to see if pylint is even installed try: import pylint from pylint.__pkginfo__ import version as pylint_version except ImportError: print "Unable to import pylint, it may need to be installed" sys.exit(1) major, minor, release = pylint_version.split('.') pylint_version = float("%s.%s" % (major, minor)) pylintrc_path = os.path.expanduser('~/.pylintrc') if not os.path.exists(pylintrc_path): open(pylintrc_path, 'w').close() # patch up the logilab module lookup tools to understand autotest_lib.* trash import logilab.common.modutils _ffm = logilab.common.modutils.file_from_modpath def file_from_modpath(modpath, path=None, context_file=None): if modpath[0] == "autotest_lib": return _ffm(modpath[1:], path, context_file) else: return _ffm(modpath, path, context_file) logilab.common.modutils.file_from_modpath = file_from_modpath
os.path.join("mysql-test", "t"), os.path.join("mysql-test", "suite", "experimental", "t"), os.path.join("mysql-test", "suite", "performance", "t"), os.path.join("mysql-test", "suite", "replication", "t"), ) _CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) ( _BASE_PATH, _, ) = os.path.split(_CURRENT_PATH) # Add base path and mysql-test to sys.path sys.path.append(_BASE_PATH) sys.path.append(os.path.join(_BASE_PATH, "mysql-test", "mutlib")) if pylint_version.split(".") < _PYLINT_MIN_VERSION.split("."): sys.stdout.write("ERROR: pylint version >= {0} is required to run " "pylint_tests.\n".format(_PYLINT_MIN_VERSION)) sys.exit(1) if pep8_version.split(".") < _PEP8_MIN_VERSION.split("."): sys.stdout.write("ERROR: pep8 version >= {0} is required to run " "pylint_tests.\n".format(_PEP8_MIN_VERSION)) sys.exit(1) class CustomTextReporter(TextReporter): """A reporter similar to TextReporter, but display messages in a custom format. """ name = "custom"