From eeb93327af2df95bd377ca8206a22a648d3a9032 Mon Sep 17 00:00:00 2001 From: braydonk Date: Fri, 3 May 2024 15:08:38 +0000 Subject: [PATCH] Add license headers I have been neglecting to add license headers for a while. Added a check in CI so I stop forgetting. Signed-off-by: braydonk --- .github/workflows/ci.yaml | 7 +++++-- .github/workflows/release.yaml | 14 ++++++++++++++ .pre-commit-hooks.yaml | 14 ++++++++++++++ Makefile | 6 +++++- cmd/yamlfmt/config.go | 14 ++++++++++++++ content_analyzer.go | 14 ++++++++++++++ content_analyzer_test.go | 14 ++++++++++++++ engine.go | 14 ++++++++++++++ engine/output.go | 14 ++++++++++++++ formatter.go | 14 ++++++++++++++ formatters/basic/errors.go | 14 ++++++++++++++ integrationtest/command/command_test.go | 14 ++++++++++++++ integrationtest/command/testcase.go | 14 ++++++++++++++ internal/assert/assert.go | 14 ++++++++++++++ internal/assert/assert_test.go | 14 ++++++++++++++ internal/collections/errors.go | 14 ++++++++++++++ internal/collections/errors_test.go | 14 ++++++++++++++ internal/collections/set.go | 14 ++++++++++++++ internal/collections/slice.go | 14 ++++++++++++++ internal/logger/debug.go | 14 ++++++++++++++ internal/multilinediff/multilinediff.go | 14 ++++++++++++++ internal/tempfile/golden.go | 14 ++++++++++++++ internal/tempfile/path.go | 14 ++++++++++++++ linebreak.go | 14 ++++++++++++++ metadata.go | 14 ++++++++++++++ metadata_test.go | 14 ++++++++++++++ path_collector.go | 14 ++++++++++++++ path_collector_test.go | 14 ++++++++++++++ 28 files changed, 374 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 96be6fa..1789d2e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -32,13 +32,16 @@ jobs: with: go-version: ${{ matrix.go }} cache: true - + + - name: Check license headers + run: make addlicense_check + - name: Go Mod Tidy run: go mod tidy - name: Go Vet run: go vet - + - name: Test run: go test -v ./... diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5bd0786..15400aa 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# 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. + name: Github Actions for Releases on: diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index a3d0e1c..e3319d8 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,3 +1,17 @@ +# Copyright 2024 Google LLC +# +# 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. + - id: yamlfmt name: yamlfmt description: This hook uses github.com/google/yamlfmt to format yaml files. Requires golang >1.18 to be installed. diff --git a/Makefile b/Makefile index 283c810..69d08ff 100644 --- a/Makefile +++ b/Makefile @@ -51,4 +51,8 @@ install_tools: .PHONY: addlicense addlicense: - addlicense -c "Google LLC" -l apache . + addlicense -ignore "**/testdata/**" -c "Google LLC" -l apache . + +.PHONY: addlicense_check +addlicense_check: + addlicense -check -ignore "**/testdata/**" -c "Google LLC" -l apache . diff --git a/cmd/yamlfmt/config.go b/cmd/yamlfmt/config.go index 544f899..27e4ddf 100644 --- a/cmd/yamlfmt/config.go +++ b/cmd/yamlfmt/config.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 main import ( diff --git a/content_analyzer.go b/content_analyzer.go index 10da3de..4083e6b 100644 --- a/content_analyzer.go +++ b/content_analyzer.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 yamlfmt import ( diff --git a/content_analyzer_test.go b/content_analyzer_test.go index 0c966a5..d3f524d 100644 --- a/content_analyzer_test.go +++ b/content_analyzer_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 yamlfmt_test import ( diff --git a/engine.go b/engine.go index d6624be..da66578 100644 --- a/engine.go +++ b/engine.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 yamlfmt import ( diff --git a/engine/output.go b/engine/output.go index b00c833..383f425 100644 --- a/engine/output.go +++ b/engine/output.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 engine import ( diff --git a/formatter.go b/formatter.go index b143185..52b3f5c 100644 --- a/formatter.go +++ b/formatter.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 yamlfmt import "fmt" diff --git a/formatters/basic/errors.go b/formatters/basic/errors.go index 8a2fdd4..02c0a89 100644 --- a/formatters/basic/errors.go +++ b/formatters/basic/errors.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 basic import "fmt" diff --git a/integrationtest/command/command_test.go b/integrationtest/command/command_test.go index 9030b4a..86f33df 100644 --- a/integrationtest/command/command_test.go +++ b/integrationtest/command/command_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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:build integration_test package command diff --git a/integrationtest/command/testcase.go b/integrationtest/command/testcase.go index 43a4319..6868f26 100644 --- a/integrationtest/command/testcase.go +++ b/integrationtest/command/testcase.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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:build integration_test package command diff --git a/internal/assert/assert.go b/internal/assert/assert.go index 4372a15..f3f93f0 100644 --- a/internal/assert/assert.go +++ b/internal/assert/assert.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 assert var ( diff --git a/internal/assert/assert_test.go b/internal/assert/assert_test.go index a16395a..7e24c79 100644 --- a/internal/assert/assert_test.go +++ b/internal/assert/assert_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 assert_test import ( diff --git a/internal/collections/errors.go b/internal/collections/errors.go index 719079e..c800700 100644 --- a/internal/collections/errors.go +++ b/internal/collections/errors.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 collections import "errors" diff --git a/internal/collections/errors_test.go b/internal/collections/errors_test.go index 6f0988e..bf62127 100644 --- a/internal/collections/errors_test.go +++ b/internal/collections/errors_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 collections_test import ( diff --git a/internal/collections/set.go b/internal/collections/set.go index 2cae536..97f70bc 100644 --- a/internal/collections/set.go +++ b/internal/collections/set.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 collections type Set[T comparable] map[T]struct{} diff --git a/internal/collections/slice.go b/internal/collections/slice.go index 554715a..b4a9f3b 100644 --- a/internal/collections/slice.go +++ b/internal/collections/slice.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 collections func SliceContains[T comparable](haystack []T, needle T) bool { diff --git a/internal/logger/debug.go b/internal/logger/debug.go index c1d8bfd..a75463c 100644 --- a/internal/logger/debug.go +++ b/internal/logger/debug.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 logger import ( diff --git a/internal/multilinediff/multilinediff.go b/internal/multilinediff/multilinediff.go index a6e137f..dea8cc6 100644 --- a/internal/multilinediff/multilinediff.go +++ b/internal/multilinediff/multilinediff.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 multilinediff import ( diff --git a/internal/tempfile/golden.go b/internal/tempfile/golden.go index 0593ef1..b14b46b 100644 --- a/internal/tempfile/golden.go +++ b/internal/tempfile/golden.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 tempfile import ( diff --git a/internal/tempfile/path.go b/internal/tempfile/path.go index 63f82ad..777ff69 100644 --- a/internal/tempfile/path.go +++ b/internal/tempfile/path.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 tempfile import ( diff --git a/linebreak.go b/linebreak.go index a34c066..2012aab 100644 --- a/linebreak.go +++ b/linebreak.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 yamlfmt import "fmt" diff --git a/metadata.go b/metadata.go index deea91a..82abfc9 100644 --- a/metadata.go +++ b/metadata.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 yamlfmt import ( diff --git a/metadata_test.go b/metadata_test.go index 9b0c6f1..0c3fc7f 100644 --- a/metadata_test.go +++ b/metadata_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 yamlfmt_test import ( diff --git a/path_collector.go b/path_collector.go index b644650..09da92b 100644 --- a/path_collector.go +++ b/path_collector.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 yamlfmt import ( diff --git a/path_collector_test.go b/path_collector_test.go index 2963213..9d6d90f 100644 --- a/path_collector_test.go +++ b/path_collector_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// 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 yamlfmt_test import (