From 40318b49b28968c138592e82d5cb290b72309707 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Fri, 8 Mar 2019 21:05:25 -0800 Subject: [PATCH] Check extensions on changelog fragments. --- test/sanity/code-smell/changelog.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/sanity/code-smell/changelog.py b/test/sanity/code-smell/changelog.py index 13ae97dd512..86b97ad5c95 100755 --- a/test/sanity/code-smell/changelog.py +++ b/test/sanity/code-smell/changelog.py @@ -1,11 +1,21 @@ #!/usr/bin/env python +import os import sys import subprocess def main(): paths = sys.argv[1:] or sys.stdin.read().splitlines() + + allowed_extensions = ('.yml', '.yaml') + + for path in paths: + ext = os.path.splitext(path)[1] + + if ext not in allowed_extensions: + print('%s:%d:%d: extension must be one of: %s' % (path, 0, 0, ', '.join(allowed_extensions))) + cmd = ['packaging/release/changelogs/changelog.py', 'lint'] + paths subprocess.check_call(cmd)