Index: .arclint =================================================================== --- .arclint +++ .arclint @@ -14,6 +14,24 @@ "3": "disabled", "5": "disabled" } + }, + "cppcheck": { + "type": "cppcheck", + "include": "(\\.cpp$)" + }, + "eslint-regex-based": { + "type": "script-and-regex", + "include": "(\\.js$)", + "exclude": [], + "script-and-regex.script": "eslint -f compact -c build/coala/lint-config/eslintrc.json", + "script-and-regex.regex": "/^(?P.*): line (?P[0-9]*), col (?P[0-9]*), ((?PWarning)|(?PError)) - (?P.*) \\((?P[a-z-\\/]+)\\)$/m" + }, + "licence-years": { + "type": "script-and-regex", + "include": "(\\.cpp$)", + "exclude": [], + "script-and-regex.script": "python3 build/coala/LicenceYear.py", + "script-and-regex.regex": "/^(?Perror);(?P.+);(?P.+)$/m" } } } Index: build/coala/LicenceYear.py =================================================================== --- /dev/null +++ build/coala/LicenceYear.py @@ -0,0 +1,23 @@ +from re import compile +from datetime import date +import sys + +if __name__ == '__main__': + file = sys.argv[1] + line = open(file).readline() + + license_regexp = compile(r'/\* Copyright \([cC]?\) ([\d]+) Wildfire Games') + + match = license_regexp.search(line) + if not match: + sys.exit(0) + + license_year = match.group(1) + if not license_year: + sys.exit(0) + + license_year = int(license_year) + if date.year == license_year: + sys.exit(0) + + print(f"error;{file};Incorrect copyright: year is no longer {license_year}")