adds boilerplate test to verify; cleanup boilerplate on a few files

Signed-off-by: Mike Brown <brownwm@us.ibm.com>
This commit is contained in:
Mike Brown 2017-04-21 12:44:25 -05:00
parent 07ad470bde
commit f9e02affcc
5 changed files with 28 additions and 9 deletions

View File

@ -1,3 +1,17 @@
# Copyright 2017 The Kubernetes Authors.
#
# 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.
GO ?= go GO ?= go
EPOCH_TEST_COMMIT ?= f2925f58acc259c4b894353f5fc404bdeb40028e EPOCH_TEST_COMMIT ?= f2925f58acc259c4b894353f5fc404bdeb40028e
PROJECT := github.com/kubernetes-incubator/cri-containerd PROJECT := github.com/kubernetes-incubator/cri-containerd
@ -25,7 +39,7 @@ ifndef GOPATH
$(error GOPATH is not set) $(error GOPATH is not set)
endif endif
verify: lint gofmt verify: lint gofmt boiler
lint: check-gopath lint: check-gopath
@echo "checking lint" @echo "checking lint"
@ -35,6 +49,10 @@ gofmt:
@echo "checking gofmt" @echo "checking gofmt"
@./hack/verify-gofmt.sh @./hack/verify-gofmt.sh
boiler:
@echo "checking boilerplate"
@./hack/repo-infra/verify/verify-boilerplate.sh
cri-containerd: check-gopath cri-containerd: check-gopath
$(GO) build -o $(BUILD_DIR)/$@ \ $(GO) build -o $(BUILD_DIR)/$@ \
$(PROJECT)/cmd/cri-containerd $(PROJECT)/cmd/cri-containerd
@ -72,6 +90,7 @@ install.tools: .install.gitvalidation .install.gometalinter
.PHONY: \ .PHONY: \
binaries \ binaries \
boiler \
clean \ clean \
default \ default \
gofmt \ gofmt \

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2017 The Kubernetes Authors All rights reserved. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2017 The Kubernetes Authors All rights reserved. Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -11,7 +11,7 @@
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License.#!/usr/bin/env bash # limitations under the License.
set -o errexit set -o errexit
set -o nounset set -o nounset

View File

@ -32,13 +32,13 @@ parser.add_argument(
help="list of files to check, all files if unspecified", help="list of files to check, all files if unspecified",
nargs='*') nargs='*')
# Rootdir defaults to the directory **above** the repo-infra dir. # Rootdir defaults to the directory **above** the hack/repo-infra dir.
rootdir = os.path.dirname(__file__) + "/../../../" rootdir = os.path.dirname(__file__) + "/../../../../"
rootdir = os.path.abspath(rootdir) rootdir = os.path.abspath(rootdir)
parser.add_argument( parser.add_argument(
"--rootdir", default=rootdir, help="root directory to examine") "--rootdir", default=rootdir, help="root directory to examine")
default_boilerplate_dir = os.path.join(rootdir, "repo-infra/verify/boilerplate") default_boilerplate_dir = os.path.join(rootdir, "hack/repo-infra/verify/boilerplate")
parser.add_argument( parser.add_argument(
"--boilerplate-dir", default=default_boilerplate_dir) "--boilerplate-dir", default=default_boilerplate_dir)
@ -131,9 +131,9 @@ def file_passes(filename, refs, regexs):
def file_extension(filename): def file_extension(filename):
return os.path.splitext(filename)[1].split(".")[-1].lower() return os.path.splitext(filename)[1].split(".")[-1].lower()
skipped_dirs = ['Godeps', 'third_party', '_gopath', '_output', '.git', skipped_dirs = ['Godeps', 'third_party', '_gopath', '_output', '.git',
'cluster/env.sh', 'vendor', 'test/e2e/generated/bindata.go', 'cluster/env.sh', 'vendor', 'test/e2e/generated/bindata.go',
'repo-infra/verify/boilerplate/test', '.glide'] 'hack/repo-infra/verify/boilerplate/test', '.glide']
def normalize_files(files): def normalize_files(files):
newfiles = [] newfiles = []