Browse Source

add license header check to the CI

master
Tariq Ibrahim 6 months ago
parent
commit
6ec6e3d88e
No known key found for this signature in database GPG Key ID: DFC94E4A008B908A
6 changed files with 100 additions and 2 deletions
  1. +20
    -2
      Makefile
  2. +16
    -0
      internal/config/config.go
  3. +16
    -0
      internal/testutils/init.go
  4. +16
    -0
      provider/scaleway/interface.go
  5. +16
    -0
      provider/scaleway/scaleway_test.go
  6. +16
    -0
      source/node_test.go

+ 20
- 2
Makefile View File

@ -27,11 +27,29 @@ cover:
cover-html: cover
go tool cover -html cover.out
.PHONY: go-lint
# Run the golangci-lint tool
go-lint:
golangci-lint run --timeout=15m ./...
.PHONY: licensecheck
# Run the licensecheck script to check for license headers
licensecheck:
@echo ">> checking license header"
@licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \
awk 'NR<=5' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
done); \
if [ -n "$${licRes}" ]; then \
echo "license header checking failed:"; echo "$${licRes}"; \
exit 1; \
fi
.PHONY: lint
# Run all the linters
lint:
golangci-lint run --timeout=15m ./...
lint: licensecheck go-lint
# The verify target runs tasks similar to the CI tasks, but without code coverage


+ 16
- 0
internal/config/config.go View File

@ -1,3 +1,19 @@
/*
Copyright 2020 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.
*/
package config
// FastPoll used for fast testing


+ 16
- 0
internal/testutils/init.go View File

@ -1,3 +1,19 @@
/*
Copyright 2020 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.
*/
package testutils
import (


+ 16
- 0
provider/scaleway/interface.go View File

@ -1,3 +1,19 @@
/*
Copyright 2020 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.
*/
package scaleway
import (


+ 16
- 0
provider/scaleway/scaleway_test.go View File

@ -1,3 +1,19 @@
/*
Copyright 2020 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.
*/
package scaleway
import (


+ 16
- 0
source/node_test.go View File

@ -1,3 +1,19 @@
/*
Copyright 2019 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.
*/
package source
import (


Loading…
Cancel
Save