Skip to content

Commit

Permalink
Merge "FAB-3674 add license header check to make checks"
Browse files Browse the repository at this point in the history
  • Loading branch information
mastersingh24 authored and Gerrit Code Review committed May 6, 2017
2 parents 1e1cdbf + 2e479a7 commit 6fd436f
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Makefile
Expand Up @@ -30,6 +30,7 @@
# - behave-deps - ensures pre-requisites are available for running behave manually
# - gotools - installs go tools like golint
# - linter - runs all code checks
# - license - checks go sourrce files for Apache license header
# - native - ensures all native binaries are available
# - docker[-clean] - ensures all docker images are available[/cleaned]
# - peer-docker[-clean] - ensures the peer container is available[/cleaned]
Expand Down Expand Up @@ -94,7 +95,10 @@ include docker-env.mk

all: native docker checks

checks: linter unit-test behave
checks: linter license unit-test behave

license: buildenv
@scripts/check_license.sh

.PHONY: gotools
gotools:
Expand Down
16 changes: 16 additions & 0 deletions bccsp/utils/keys_test.go
@@ -1,3 +1,19 @@
/*
Copyright IBM Corp. 2016 All Rights Reserved.
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.
*/

package utils

import (
Expand Down
17 changes: 16 additions & 1 deletion bddtests/bddtests_test.go
@@ -1,3 +1,19 @@
/*
Copyright IBM Corp. 2016 All Rights Reserved.
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.
*/

package bddtests

import "github.com/DATA-DOG/godog"
Expand Down Expand Up @@ -27,4 +43,3 @@ func FeatureContext(s *godog.Suite) {
s.Step(`^user "([^"]*)" sets ESCC to "([^"]*)" for chaincode spec "([^"]*)"$`, bddCtx.userSetsESCCToForChaincodeSpec)
s.Step(`^user "([^"]*)" sets VSCC to "([^"]*)" for chaincode spec "([^"]*)"$`, bddCtx.userSetsVSCCToForChaincodeSpec)
}

16 changes: 16 additions & 0 deletions core/chaincode/platforms/golang/platform_test.go
@@ -1,3 +1,19 @@
/*
Copyright IBM Corp. 2016 All Rights Reserved.
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.
*/

package golang

import (
Expand Down
16 changes: 16 additions & 0 deletions core/chaincode/platforms/util/utils.go
@@ -1,3 +1,19 @@
/*
Copyright IBM Corp. 2016 All Rights Reserved.
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.
*/

package util

import (
Expand Down
16 changes: 16 additions & 0 deletions core/chaincode/platforms/util/utils_test.go
@@ -1,3 +1,19 @@
/*
Copyright IBM Corp. 2016 All Rights Reserved.
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.
*/

package util

import (
Expand Down
16 changes: 16 additions & 0 deletions peer/channel/list_test.go
@@ -1,3 +1,19 @@
/*
Copyright IBM Corp. 2016 All Rights Reserved.
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.
*/

package channel

import (
Expand Down
10 changes: 10 additions & 0 deletions scripts/check_license.sh
@@ -0,0 +1,10 @@
#!/bin/bash

echo "Checking Go files for license headers ..."
missing=`grep -l -L "Apache License" \`find . -name "*.go"\` | grep -v "./vendor" | grep -v "build/docker/gotools" | grep -v ".pb.go" | grep -v "examples/chaincode/go/utxo/consensus/consensus.go"`
if [ $? -eq 0 ]; then
echo "The following files are missing license headers:"
echo "$missing"
exit 1
fi
echo "All go files have license headers"

0 comments on commit 6fd436f

Please sign in to comment.