--- a/Plugins/CheckerPlugins/Tabnanny/Tabnanny.py Sat Mar 22 09:12:19 2014 +0100 +++ b/Plugins/CheckerPlugins/Tabnanny/Tabnanny.py Sat Mar 22 09:45:56 2014 +0100 @@ -49,14 +49,21 @@ except (ImportError): import io # __IGNORE_WARNING__ -import Utilities - if not hasattr(tokenize, 'NL'): raise ValueError("tokenize.NL doesn't exist -- tokenize module too old") __all__ = ["check", "NannyNag", "process_tokens"] +def initService(): + """ + Initialize the service and return the entry point. + + @return the entry point for the background client (function) + """ + return check + + class NannyNag(Exception): """ Class implementing an exception for indentation issues. @@ -114,34 +121,29 @@ global indents, check_equal indents = [Whitespace("")] check_equal = 0 - if not text: - try: - text = Utilities.readEncodedFile(file)[0] - text = Utilities.normalizeCode(text) - except (UnicodeError, IOError) as msg: - return (True, file, "1", "Error: {0}".format(str(msg))) + return (True, "1", "Error: source code missing.") source = io.StringIO(text) try: process_tokens(tokenize.generate_tokens(source.readline)) except tokenize.TokenError as msg: - return (True, file, "1", "Token Error: {0}".format(str(msg))) + return (True, "1", "Token Error: {0}".format(str(msg))) except IndentationError as err: - return (True, file, err.lineno, + return (True, str(err.lineno), "Indentation Error: {0}".format(str(err.msg))) except NannyNag as nag: badline = nag.get_lineno() line = nag.get_line() - return (True, file, str(badline), line) + return (True, str(badline), line) except Exception as err: - return (True, file, "1", "Unspecific Error: {0}".format(str(err))) + return (True, "1", "Unspecific Error: {0}".format(str(err))) - return (False, None, None, None) + return (False, None, None) class Whitespace(object):