mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:17:35 +00: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
|
- cd ../Kernel
|
||||||
- ./makeall.sh
|
- ./makeall.sh
|
||||||
- ../Meta/lint-shell-scripts.sh
|
- ../Meta/lint-shell-scripts.sh
|
||||||
|
- ../Meta/check-license-headers.sh
|
||||||
- ../Meta/Lagom/build-js.sh
|
- ../Meta/Lagom/build-js.sh
|
||||||
- cd ../Libraries/LibJS/Tests
|
- cd ../Libraries/LibJS/Tests
|
||||||
- ./run-tests
|
- ./run-tests
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
|
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
|
||||||
* All rights reserved.
|
* 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…
Add table
Add a link
Reference in a new issue