Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
131781: license lint: only lint on the CockroachDB Software License (CSL) r=celiala,rickystewart a=jlinder

Given all the headers have been updated to use the CockroachDB Software License (CSL), switch to only linting for CSL headers.

Part of RE-658

Release note: none

Co-authored-by: James H. Linder <[email protected]>
  • Loading branch information
craig[bot] and jlinder committed Oct 3, 2024
2 parents 85c6b1d + 336287e commit 7a0d27e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 50 deletions.
35 changes: 6 additions & 29 deletions pkg/testutils/lint/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,6 @@ import (

// Various copyright file headers we lint on.
var (
bslHeader = regexp.MustCompile(`// Copyright 20\d\d The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
`)
cclHeader = regexp.MustCompile(`// Copyright 20\d\d The Cockroach Authors.
//
// Licensed as a CockroachDB Enterprise file under the Cockroach Community
// License \(the "License"\); you may not use this file except in compliance with
// 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
Expand Down Expand Up @@ -330,20 +312,15 @@ func TestLint(t *testing.T) {
}
data = data[0:n]

isCCL := strings.Contains(filename, "ccl/")
isApache := strings.HasPrefix(filename, "obsservice")
switch {
case isCCL:
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 && cslHeader.Find(data) == nil {
t.Errorf("did not find expected BSL or CSL license header in %s", filename)
if cslHeader.Find(data) == nil {
t.Errorf("did not find expected CSL license header in %s", filename)
}
}
}); err != nil {
Expand Down Expand Up @@ -422,11 +399,11 @@ func TestLint(t *testing.T) {
// new code, and is moved from an existing etcd forked file, the
// author may consider it as modified; the linter is liberal enough
// to allow either of these.
assert.True(t, (bslHeader.Find(data) != nil || cslHeader.Find(data) != nil) ||
assert.True(t, (cslHeader.Find(data) != nil) ||
(etcdApacheHeader.Find(data) != nil && cockroachModifiedCopyright.Find(data) != nil),
"did not find expected a) Cockroach BSL license header, b) CockroachDB "+
"Software License header or c) Apache license header and Cockroach "+
"copyright header in %s", filename)
"did not find expected a) CockroachDB Software License header or b) "+
"Apache license header and Cockroach copyright header in %s",
filename)
} else {
assert.NotNilf(t, etcdApacheHeader.Find(data),
"did not find expected Apache license header in %s", filename)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
// Copyright 2024 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.

import { mount, ReactWrapper } from "enzyme";
import moment from "moment";
Expand Down
9 changes: 2 additions & 7 deletions pkg/upgrade/upgrades/v24_3_add_table_metadata_cols.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
// Copyright 2024 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.

package upgrades

Expand Down
9 changes: 2 additions & 7 deletions pkg/upgrade/upgrades/v24_3_add_table_metadata_cols_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
// Copyright 2024 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.

package upgrades_test

Expand Down

0 comments on commit 7a0d27e

Please sign in to comment.