From 5dd4466ab32d55f1369ad6a30670b3559ff41e11 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 25 Oct 2017 11:33:19 -0500 Subject: add missing license headers, test to makefile (#7711) --- scripts/license-check.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 scripts/license-check.sh (limited to 'scripts/license-check.sh') diff --git a/scripts/license-check.sh b/scripts/license-check.sh new file mode 100755 index 000000000..be3b62508 --- /dev/null +++ b/scripts/license-check.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -e +IFS=$'\n' +count=0 +for fileType in GoFiles; do + for file in `go list -f $'{{range .GoFiles}}{{$.Dir}}/{{.}}\n{{end}}' "$@"`; do + case $file in + */utils/lru.go) + # Third-party, doesn't require a header. + ;; + *) + if ! grep 'Mattermost, Inc. All Rights Reserved.' $file -q; then + >&2 echo "FAIL: $file is missing a license header." + ((count++)) + fi + esac + done +done +if [ $count -eq 0 ]; then + exit 0 +fi + +if [ $count -gt 1 ]; then + >&2 echo "$count files are missing license headers." +else + >&2 echo "$count file is missing a license header." +fi +exit 1 -- cgit v1.2.3-1-g7c22