mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 01:41:59 -05:00
Meta: Add script to enforce license headers & run it on Travis
This commit is contained in:
parent
60024ab574
commit
358694567f
4 changed files with 31 additions and 1 deletions
|
@ -34,6 +34,7 @@ script:
|
|||
- cd ../Kernel
|
||||
- ./makeall.sh
|
||||
- ../Meta/lint-shell-scripts.sh
|
||||
- ../Meta/check-license-headers.sh
|
||||
- ../Meta/Lagom/build-js.sh
|
||||
- cd ../Libraries/LibJS/Tests
|
||||
- ./run-tests
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/*
|
||||
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
|
||||
* All rights reserved.
|
||||
|
|
30
Meta/check-license-headers.sh
Executable file
30
Meta/check-license-headers.sh
Executable file
|
@ -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
|
Loading…
Reference in a new issue