diff options
author | Linus Groh <mail@linusgroh.de> | 2020-05-09 18:15:45 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-09 23:55:58 +0200 |
commit | 358694567f3a3076c50555761f221018cd045cd0 (patch) | |
tree | 41d3fb036a981445d77afc1e65f7a8b303dbbee5 /Meta | |
parent | 60024ab574e506f924515fec18591313c556fbb4 (diff) | |
download | serenity-358694567f3a3076c50555761f221018cd045cd0.zip |
Meta: Add script to enforce license headers & run it on Travis
Diffstat (limited to 'Meta')
-rwxr-xr-x | Meta/check-license-headers.sh | 30 |
1 files changed, 30 insertions, 0 deletions
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 |