diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/check-header.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/check-header.py b/scripts/check-header.py new file mode 100755 index 0000000..67aea38 --- /dev/null +++ b/scripts/check-header.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +import sys +import re + +line_re = [ + r'^\/\/\={69}$', + r'^\/\/ \w+', + r'^\/\/ spdx-license-identifier: (ISC)', + r'^\/\/ description: \w+' +] + +if __name__ == '__main__': + errors = 0 + + with open(sys.argv[1]) as f: + for i in range(len(line_re)): + if re.search(line_re[i], f.readline()) == None: + print(f'wrong license header: {sys.argv[1]}:{i}') + errors += 1 + + if errors != 0: + sys.exit(1) |