skywalking icon indicating copy to clipboard operation
skywalking copied to clipboard

[Bug] Unhelpful error for misconfigured .licenserc.yaml file

Open jsoref opened this issue 2 years ago • 3 comments

Search before asking

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

Apache SkyWalking Component

License Tools (apache/skywalking-eyes)

What happened

WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 

What you expected to happen

  1. If there's a very finite list of available licenses, the list of available licenses should be mentioned
    • if the list is variable/dynamic, then a link to the available licenses should be provided (especially if there's a specific branch that's relevant...)
  2. the specific license id being checked should be clearly identified -- if the id is '' then use 's around the empty string to clarify that it's an empty string
    • to the extent possible, the source of an empty string should be identified

How to reproduce

  1. create a repository (with actions enabled...) with a workflow with steps similar to:

    steps:
      - name: Checkout
        uses: actions/checkout@v4
    
      - name: Fix License Header
        uses: apache/skywalking-eyes/[email protected]
        with:
          mode: fix
    
  2. create .licenserc.yaml file with:

    header:
      spdx-id: BSD-3-Clause
      copyright-owner: Unknown
      software-name: unknown
      content: |
        Copyright (c) Unknown
        Distributed under the terms of the Modified BSD License.
    
      paths-ignore:
        - '**/.*'
    
  3. Add a file that skywalking will try to "fix".

  4. Push the repository to GitHub

Anything else

INFO Loading configuration from file: .licenserc.yaml 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
WARNING failed to find a license template for spdx id , open header-templates/.txt: file does not exist 
INFO Totally checked 96 files, valid: 0, invalid: 4, ignored: 92, fixed: 4

Are you willing to submit a pull request to fix on your own?

  • [X] Yes I am willing to submit a pull request on my own!

Code of Conduct

jsoref avatar Dec 13 '23 04:12 jsoref

BSD-3-Clause is supported, you wrote the configuration file wrong, it's header/license/spdx-id, not header/spdx-id, please read the doc carefully

https://github.com/apache/skywalking-eyes/blob/ee81ff786927ea6ffa48b1e29c48e5289f4753aa/README.md?plain=1#L596-L600

kezhenxu94 avatar Dec 13 '23 13:12 kezhenxu94

Ah. I see. Sorry. I was trying to reduce a larger file to feed into something fairly unrelated -- I'm not trying to set up skywalking for use...

That said, the thrust of this ticket is not about whether or not bsd-3-clause is supported, but that the error reporting isn't great when the tool can't find what the user has (poorly) asked it to find.

When I went looking trying to find things, I found this directory which didn't have bsd-3-clause: https://github.com/apache/skywalking-eyes/tree/main/assets/header-templates

OTOH, apparently it is present in this directory: https://github.com/apache/skywalking-eyes/tree/main/assets/lcs-templates

But as the error message said header-templates/, it didn't occur to me to look in a directory named lcs-templates/, hence the request that the tool explain where it was looking and what/why it was looking for it.

jsoref avatar Dec 13 '23 13:12 jsoref

Ah. I see. Sorry. I was trying to reduce a larger file to feed into something fairly unrelated -- I'm not trying to set up skywalking for use...

That said, the thrust of this ticket is not about whether or not bsd-3-clause is supported, but that the error reporting isn't great when the tool can't find what the user has (poorly) asked it to find.

When I went looking trying to find things, I found this directory which didn't have bsd-3-clause: https://github.com/apache/skywalking-eyes/tree/main/assets/header-templates

OTOH, apparently it is present in this directory: https://github.com/apache/skywalking-eyes/tree/main/assets/lcs-templates

But as the error message said header-templates/, it didn't occur to me to look in a directory named lcs-templates/, hence the request that the tool explain where it was looking and what/why it was looking for it.

OK sounds reasonable to me. Let me reopen the issue and polish the error logs later.

kezhenxu94 avatar Dec 13 '23 15:12 kezhenxu94