From 358694567f3a3076c50555761f221018cd045cd0 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 9 May 2020 18:15:45 +0100 Subject: Meta: Add script to enforce license headers & run it on Travis --- Meta/check-license-headers.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 Meta/check-license-headers.sh (limited to 'Meta') diff --git a/Meta/check-license-headers.sh b/Meta/check-license-headers.sh new file mode 100755 index 0000000000..60cd03151e --- /dev/null +++ b/Meta/check-license-headers.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P) +cd "$script_path/.." || exit 1 + +# We simply check if the file starts with: +# /* +# * Copyright +PATTERN=$'^/\*\n \* Copyright' +ERRORS=() + +while IFS= read -r f; do + if [[ ! $(cat "$f") =~ $PATTERN ]]; then + ERRORS+=("$f") + fi +done < <(git ls-files -- \ +'*.cpp' \ +'*.h' \ +':!:Tests' \ +':!:Base' \ +':!:Kernel/FileSystem/ext2_fs.h' \ +':!:Libraries/LibC/getopt.cpp' \ +':!:Libraries/LibCore/puff.h' \ +':!:Libraries/LibELF/exec_elf.h' \ +) + +if (( ${#ERRORS[@]} )); then + echo "Files missing license headers: ${ERRORS[*]}" + exit 1 +fi -- cgit v1.2.3