--- a/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py Sun Mar 11 15:40:15 2018 +0100 +++ b/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py Sun Mar 11 16:11:31 2018 +0100 @@ -35,6 +35,7 @@ "M651", "M652", "M653", "M654", "M655", "M701", "M702", + "M711", "M801", "M811", @@ -111,6 +112,7 @@ "M631", "M632")), (self.__checkLogging, ("M651", "M652", "M653", "M654", "M655")), (self.__checkFuture, ("M701", "M702")), + (self.__checkGettext, ("M711",)), (self.__checkPrintStatements, ("M801",)), (self.__checkTuple, ("M811", )), (self.__checkMutableDefault, ("M821", "M822")), @@ -655,6 +657,16 @@ visitor.visit(self.__tree) for node, reason in visitor.violations: self.__error(node.lineno - 1, node.col_offset, reason) + + def __checkGettext(self): + """ + Private method to check the 'gettext' import statement. + """ + for node in ast.walk(self.__tree): + if isinstance(node, ast.ImportFrom) and \ + any(name.asname == '_' for name in node.names): + self.__error(node.lineno - 1, node.col_offset, "M711", + node.names[0].name) class TextVisitor(ast.NodeVisitor):