Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Tested-by: Titouan Christophe <titouan.christophe@railnova.eu>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
return ["{}:{}: line contains trailing whitespace"
.format(self.filename, lineno),
text]
+
+class Utf8Characters(_CheckFunction):
+ def is_ascii(self, s):
+ try:
+ return all(ord(c) < 128 for c in s)
+ except TypeError:
+ return False
+
+ def check_line(self, lineno, text):
+ if not self.is_ascii(text):
+ return ["{}:{}: line contains UTF-8 characters"
+ .format(self.filename, lineno),
+ text]
from checkpackagelib.lib import EmptyLastLine # noqa: F401
from checkpackagelib.lib import NewlineAtEof # noqa: F401
from checkpackagelib.lib import TrailingSpace # noqa: F401
+from checkpackagelib.lib import Utf8Characters # noqa: F401
# used in more than one check
start_conditional = ["ifdef", "ifeq", "ifndef", "ifneq"]