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

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

Closed
3 tasks done
JohnNiang opened this issue Feb 10, 2022 · 4 comments · Fixed by apache/skywalking-eyes#94
Closed
3 tasks done
Assignees
Labels
bug Something isn't working and you are sure it's a bug! license eye

Comments

@JohnNiang
Copy link
Contributor

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/[email protected]
    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

@JohnNiang JohnNiang added the bug Something isn't working and you are sure it's a bug! label Feb 10, 2022
@wu-sheng wu-sheng added this to the license-eye 0.3.0 milestone Feb 10, 2022
@wu-sheng
Copy link
Member

Assigned to you, welcome the fix.

@wu-sheng
Copy link
Member

@JohnNiang Are you going to submit a pull request?

@tisonkun
Copy link
Member

According to the discussion on #8657 I'm going to look into this issue :)

@tisonkun
Copy link
Member

I think it's related to trailing newlines. Fixing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working and you are sure it's a bug! license eye
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants