Skip to content

[Bug] The License header license-eyes fixed breaks linter rule: EXC0013 revive #8529

@JohnNiang

Description

@JohnNiang

Search before asking

  • I had searched in the issues and found no similar issues.

Apache SkyWalking Component

License Tools (apache/skywalking-eyes)

What happened

# EXC0013 revive: Annoying issue about not having a comment. The rare codebase has such comments
- package comment should be of the form "(.+)...

When I fixed License header using license-eyes -c .licenserc.yaml header fix, but I got some lint issues as below when I checked code style using golangci-lint.

  Running [/home/runner/golangci-lint-1.41.1-linux-amd64/golangci-lint run --out-format=github-actions] in [] ...
  Warning: package-comments: package comment should be of the form "Package devops ..." (revive)
  Warning: package-comments: package comment should be of the form "Package common ..." (revive)
  Warning: package-comments: package comment should be of the form "Package template ..." (revive)
  Warning: package-comments: package comment should be of the form "Package template ..." (revive)
  Warning: package-comments: package comment should be of the form "Package v1alpha1 ..." (revive)

BTW, the result snippet license-eyes fixed is as follows:

// Copyright 2022 KubeSphere 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 mypkg

What you expected to happen

The result snippet license-eyes fixed should be as follows:

// Copyright 2022 KubeSphere 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 mypkg is great
package mypkg

or

// Copyright 2022 KubeSphere 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 mypkg is great
package mypkg

How to reproduce

  1. Create main.go

    go mod init test
    go mod tidy
    // Package test is awesome
    package test
    
    import "fmt"
    
    func main() {
      fmt.Println(Hello World)
    }
  2. Header fix

    go install github.com/apache/skywalking-eyes/cmd/license-eye@latest
    license-eyes header fix
  3. Got the unexpected result

    // 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 test is awesome
    package test
    
    import "fmt"
    
    func main() {
      fmt.Println(Hello World)
    }
  4. Lint code

    go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.44.0
    golangci-lint run -E revive --exclude-use-default=false ./...
  5. See error

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't working and you are sure it's a bug!license eye

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions