From 7f3903c38aca839347f4ec635c4f6b242ea8e3ba Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Sat, 3 Oct 2020 22:23:13 +0200 Subject: [PATCH] refactor: replace license script with licensei Signed-off-by: Mark Sagi-Kazar --- .licensei.toml | 15 +++++++++++++++ Makefile | 8 ++++---- scripts/check-header.sh | 35 ----------------------------------- 3 files changed, 19 insertions(+), 39 deletions(-) delete mode 100755 scripts/check-header.sh diff --git a/.licensei.toml b/.licensei.toml index d010942..c348e88 100644 --- a/.licensei.toml +++ b/.licensei.toml @@ -19,3 +19,18 @@ ignored = [ "sigs.k8s.io/structured-merge-diff/v4", "google.golang.org/protobuf", ] + +[header] +template = """// Copyright © :YEAR: Banzai Cloud +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License.""" diff --git a/Makefile b/Makefile index ff2df6c..ebf5b92 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ -LICENSEI_VERSION = 0.1.0 +LICENSEI_VERSION = 0.3.1 GOLANGCI_VERSION = 1.16.0 all: license fmt vet test .PHONY: license -license: - ./scripts/check-header.sh +license: bin/licensei + bin/licensei header # Run go fmt against code fmt: @@ -32,7 +32,7 @@ bin/licensei-${LICENSEI_VERSION}: .PHONY: license-check license-check: bin/licensei ## Run license check bin/licensei check - ./scripts/check-header.sh + bin/licensei header .PHONY: license-cache license-cache: bin/licensei ## Generate license cache diff --git a/scripts/check-header.sh b/scripts/check-header.sh deleted file mode 100755 index 75b8239..0000000 --- a/scripts/check-header.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -read -r -d '' EXPECTED </dev/null; then - # Replace the actual year with DATE so we can ignore the year when - # checking for the license header. - HEADER=$(head -n 13 $FILE | sed -E -e 's/Copyright © [0-9]+/Copyright © DATE/') - if [ "$HEADER" != "$EXPECTED" ]; then - echo "incorrect license header: $FILE" - STATUS=1 - fi - fi -done - -exit $STATUS