1 # See support/scripts/check-package.txt before editing this file.
3 from checkpackagebase import _CheckFunction
6 class ConsecutiveEmptyLines(_CheckFunction):
8 self.lastline = "non empty"
10 def check_line(self, lineno, text):
11 if text.strip() == "" == self.lastline.strip():
12 return ["{}:{}: consecutive empty lines"
13 .format(self.filename, lineno)]
17 class EmptyLastLine(_CheckFunction):
20 self.lastline = "non empty"
22 def check_line(self, lineno, text):
23 self.lastlineno = lineno
27 if self.lastline.strip() == "":
28 return ["{}:{}: empty line at end of file"
29 .format(self.filename, self.lastlineno)]
32 class NewlineAtEof(_CheckFunction):
37 def check_line(self, lineno, text):
38 self.lastlineno = lineno
42 if self.lastline == self.lastline.rstrip("\r\n"):
43 return ["{}:{}: missing newline at end of file"
44 .format(self.filename, self.lastlineno),
48 class TrailingSpace(_CheckFunction):
49 def check_line(self, lineno, text):
50 line = text.rstrip("\r\n")
51 if line != line.rstrip():
52 return ["{}:{}: line contains trailing whitespace"
53 .format(self.filename, lineno),