summaryrefslogtreecommitdiffstats
path: root/support/scripts/checkpackagelib.py
diff options
context:
space:
mode:
Diffstat (limited to 'support/scripts/checkpackagelib.py')
-rw-r--r--support/scripts/checkpackagelib.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/support/scripts/checkpackagelib.py b/support/scripts/checkpackagelib.py
new file mode 100644
index 0000000000..1a49041839
--- /dev/null
+++ b/support/scripts/checkpackagelib.py
@@ -0,0 +1,19 @@
+# See support/scripts/check-package.txt before editing this file.
+
+from checkpackagebase import _CheckFunction
+
+
+class NewlineAtEof(_CheckFunction):
+ def before(self):
+ self.lastlineno = 0
+ self.lastline = "\n"
+
+ def check_line(self, lineno, text):
+ self.lastlineno = lineno
+ self.lastline = text
+
+ def after(self):
+ if self.lastline == self.lastline.rstrip("\r\n"):
+ return ["{}:{}: missing newline at end of file"
+ .format(self.filename, self.lastlineno),
+ self.lastline]
OpenPOWER on IntegriCloud