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] [INFRA/EYE] Failing to validate custom content when providing multiple licenses #10746

Closed
2 of 3 tasks
arturo-seijas opened this issue Apr 28, 2023 · 5 comments · Fixed by apache/skywalking-eyes#159
Closed
2 of 3 tasks
Assignees
Labels
bug Something isn't working and you are sure it's a bug! license eye

Comments

@arturo-seijas
Copy link

Search before asking

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

Apache SkyWalking Component

License Tools (apache/skywalking-eyes)

What happened

Hi!

I've provided the following configuration expecting two different header patterns to be recognized, given that I have two different header contents in my source files (note that both configurations work separately):

header:
  - license:
    copyright-owner: Company Ltd.
    content: |
      Copyright [year] [owner]
      Licensed under the Apache2.0. See LICENSE file in charm source for details.
    paths:
      - 'lib/**'
    comment: on-failure
  - license:
    spdx-id: Apache-2.0
    copyright-owner: Company Ltd.
    content: |
      Copyright [year] [owner]
      See LICENSE file for licensing details.
    paths:
      - '**'
    paths-ignore:
      - 'lib/**'
    comment: on-failure

The resulting scan is ignoring the specified content. the tools is also throwing a warning failed to find a license template for spdx id , open header-templates/.txt: file does not exist.

What you expected to happen

The tool should have compared the headers against the content, analogous to what happens when a single license item is set.

How to reproduce

  • Create a new repository with the following files
  1. .licenserc.yaml
header:
  - license:
    copyright-owner: Company Ltd.
    content: |
      Copyright [year] [owner]
      Licensed under the Apache2.0. See LICENSE file in charm source for details.
    paths:
      - 'lib/**'
    comment: on-failure
  - license:
    spdx-id: Apache-2.0
    copyright-owner: Company Ltd.
    content: |
      Copyright [year] [owner]
      See LICENSE file for licensing details.
    paths:
      - '**'
    paths-ignore:
      - 'lib/**'
    comment: on-failure
  1. Add a sample.sh file with the following content
# Copyright 2023 Company Ltd.
# See LICENSE file for licensing details.
  1. Add a lib/samplelib.shfile with the following content
# Copyright 2023 Company Ltd.
# Licensed under the Apache2.0. See LICENSE file in charm source for details.
  • Run the GitHub action with the following configuration
- name: Check license headers
        uses: apache/skywalking-eyes/header@main
        with:
          config: .licenserc.yaml       

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@arturo-seijas arturo-seijas added the bug Something isn't working and you are sure it's a bug! label Apr 28, 2023
@wu-sheng
Copy link
Member

Please provide a suitable title according.

@wu-sheng wu-sheng added this to the license-eye 0.5.0 milestone Apr 28, 2023
@arturo-seijas arturo-seijas changed the title [Bug] [INFRA/EYE] [Bug] [INFRA/EYE] Failing to validate custom content when providing multiple licenses Apr 28, 2023
@arturo-seijas
Copy link
Author

Please provide a suitable title according.

Sorry. Fixed

@kezhenxu94
Copy link
Member

Thanks for reporting the issue and the detailed steps to reproduce. I'll take a look at the issue soon.

@kezhenxu94
Copy link
Member

kezhenxu94 commented Apr 29, 2023

Hi, @arturo-seijas , this turns out to be typos in the doc, please see apache/skywalking-eyes#159 . Note the indentations in the configuration

@arturo-seijas
Copy link
Author

arturo-seijas commented May 2, 2023

HI again!
I've been testing this and, although I'm not getting the warning anymore, The paths and paths-ignore` sections are being ignored:

header:
  - license:
      copyright-owner: Company Ltd.
      content: |
        Copyright [year] [owner]
        Licensed under the Apache2.0. See LICENSE file in charm source for details.
      paths:
        - 'lib/**'
      comment: on-failure
  - license:
      spdx-id: Apache-2.0
      copyright-owner: Company Ltd.
      content: |
        Copyright [year] [owner]
        See LICENSE file for licensing details.
      paths:
        - '**'
      paths-ignore:
        - 'lib/**'
      comment: on-failure

I'll open another ticket

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