Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-23.2: license lint: make license header linter accept CockroachDB Software License #131873

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions pkg/testutils/lint/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ func TestLint(t *testing.T) {
// the License. You may obtain a copy of the License at
//
// https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt
`)

cslHeader := regexp.MustCompile(`// Copyright 20\d\d The Cockroach Authors.
//
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.
`)

apacheHeader := regexp.MustCompile(`// Copyright 20\d\d The Cockroach Authors.
Expand Down Expand Up @@ -287,16 +293,16 @@ func TestLint(t *testing.T) {
isApache := strings.HasPrefix(filename, "obsservice")
switch {
case isCCL:
if cclHeader.Find(data) == nil {
t.Errorf("did not find expected CCL license header in %s", filename)
if cclHeader.Find(data) == nil && cslHeader.Find(data) == nil {
t.Errorf("did not find expected CCL or CSL license header in %s", filename)
}
case isApache:
if apacheHeader.Find(data) == nil {
t.Errorf("did not find expected Apache license header in %s", filename)
}
default:
if bslHeader.Find(data) == nil {
t.Errorf("did not find expected BSL license header in %s", filename)
if bslHeader.Find(data) == nil && cslHeader.Find(data) == nil {
t.Errorf("did not find expected BSL or CSL license header in %s", filename)
}
}
}); err != nil {
Expand Down