diff --git a/.asf.yaml b/.asf.yaml index 05e8ef3f2f..246ec81885 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -1,4 +1,3 @@ -# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -15,7 +14,6 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# github: description: "Apache Pulsar Go Client Library" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c946b7652..f0c9b63999 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: make lint + - name: Check license header + run: docker run --rm -v $(pwd):/github/workspace ghcr.io/korandoru/hawkeye-native:v3 check + - name: Run golangci-lint + run: make lint integration-tests: runs-on: ubuntu-latest diff --git a/Dockerfile b/Dockerfile index 07eff8ea2d..1c137fc096 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,3 @@ -# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -15,7 +14,6 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# # Explicit version of Pulsar and Golang images should be # set via the Makefile or CLI diff --git a/integration-tests/certs/generate.sh b/integration-tests/certs/generate.sh index 9294e0342c..ea365c1d9f 100755 --- a/integration-tests/certs/generate.sh +++ b/integration-tests/certs/generate.sh @@ -1,5 +1,4 @@ #!/bin/bash -# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -16,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# + export CA_HOME=$(pwd) echo $CA_HOME diff --git a/integration-tests/license_test.go b/integration-tests/license_test.go deleted file mode 100644 index ac89eb4dc2..0000000000 --- a/integration-tests/license_test.go +++ /dev/null @@ -1,118 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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 license_test - -import ( - "os" - "path/filepath" - "regexp" - "testing" -) - -var goFileCheck = regexp.MustCompile(`// Licensed to the Apache Software Foundation \(ASF\) under one -// or more contributor license agreements\. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership\. The ASF licenses this file -// to you 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\. - -`) - -var otherCheck = regexp.MustCompile(`# -# Licensed to the Apache Software Foundation \(ASF\) under one -# or more contributor license agreements\. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership\. The ASF licenses this file -# to you 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\. -# -`) - -var skip = map[string]bool{ - "../pulsar/internal/pulsar_proto/PulsarApi.pb.go": true, - "../.github/workflows/bot.yaml": true, - "../integration-tests/pb/hello.pb.go": true, - "../integration-tests/.htpasswd": true, -} - -func TestLicense(t *testing.T) { - err := filepath.Walk("../.", func(path string, fi os.FileInfo, err error) error { - if skip[path] { - return nil - } - - if err != nil { - return err - } - - switch filepath.Ext(path) { - case ".go": - src, err := os.ReadFile(path) - if err != nil { - return nil - } - - // Find license - if !goFileCheck.Match(src) { - t.Errorf("%v: license header not present", path) - return nil - } - case ".yaml": - fallthrough - case ".conf": - src, err := os.ReadFile(path) - if err != nil { - return nil - } - - // Find license - if !otherCheck.Match(src) { - t.Errorf("%v: license header not present", path) - return nil - } - - default: - return nil - } - - return nil - }) - if err != nil { - t.Fatal(err) - } -} diff --git a/integration-tests/pb/build.sh b/integration-tests/pb/build.sh index e1924581d0..651147287a 100755 --- a/integration-tests/pb/build.sh +++ b/integration-tests/pb/build.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash -# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -16,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# + PROJECT_DIR=$(git rev-parse --show-toplevel) SOURCE_PATH="$PROJECT_DIR/integration-tests/pb" diff --git a/integration-tests/pb/hello.proto b/integration-tests/pb/hello.proto index ca6a4ff9e8..5b33a52f5c 100644 --- a/integration-tests/pb/hello.proto +++ b/integration-tests/pb/hello.proto @@ -1,4 +1,4 @@ -/** +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + syntax = "proto3"; package prototest; diff --git a/integration-tests/pb/hi.proto b/integration-tests/pb/hi.proto index f5a401a54d..2f50ce31c9 100644 --- a/integration-tests/pb/hi.proto +++ b/integration-tests/pb/hi.proto @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + syntax = "proto3"; package prototest; diff --git a/licenserc.toml b/licenserc.toml new file mode 100644 index 0000000000..4ca4e14faf --- /dev/null +++ b/licenserc.toml @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +headerPath = "Apache-2.0-ASF.txt" + +excludes = [ + "*.txt", +] + +[mapping.DOUBLESLASH_STYLE] +extensions = ["go"] diff --git a/pulsar/internal/pulsar_proto/PulsarApi.proto b/pulsar/internal/pulsar_proto/PulsarApi.proto index 0c72361c7f..8bd75729c8 100644 --- a/pulsar/internal/pulsar_proto/PulsarApi.proto +++ b/pulsar/internal/pulsar_proto/PulsarApi.proto @@ -1,4 +1,4 @@ -/** +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + syntax = "proto2"; package pulsar.proto; diff --git a/scripts/pulsar-test-service-start.sh b/scripts/pulsar-test-service-start.sh index ed90b0660a..1f62558a52 100755 --- a/scripts/pulsar-test-service-start.sh +++ b/scripts/pulsar-test-service-start.sh @@ -1,5 +1,4 @@ #!/bin/bash -# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -16,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# + set -e diff --git a/scripts/pulsar-test-service-stop.sh b/scripts/pulsar-test-service-stop.sh index eafccd98f9..fffcd8b3f6 100755 --- a/scripts/pulsar-test-service-stop.sh +++ b/scripts/pulsar-test-service-stop.sh @@ -1,5 +1,4 @@ #!/bin/bash -# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -16,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# + set -e diff --git a/scripts/run-ci.sh b/scripts/run-ci.sh index 8eebdec271..cc4f6a1e74 100755 --- a/scripts/run-ci.sh +++ b/scripts/run-ci.sh @@ -1,5 +1,4 @@ #!/bin/bash -# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -16,7 +15,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -# + set -e -x