Skip to content

Commit

Permalink
Meta: Add script to enforce license headers & run it on Travis
Browse files Browse the repository at this point in the history
  • Loading branch information
linusg authored and awesomekling committed May 9, 2020
1 parent 60024ab commit 3586945
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion DevTools/HackStudio/Debugger/Debugger.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
* Copyright (c) 2020, Itamar S. <[email protected]>
* All rights reserved.
Expand Down
Empty file removed Libraries/LibC/netinet/tcp.h
Empty file.
30 changes: 30 additions & 0 deletions Meta/check-license-headers.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3586945

Please sign in to comment.