skywalking: [Bug] skyWalking-eyes checks header should not require to match this year
Search before asking
- I had searched in the issues and found no similar issues.
Apache SkyWalking Component
License Tools (apache/skywalking-eyes)
What happened
Now we’re in 2023 and it exposes a bug in the skywalking eyes header checks for license that have a year placeholder: https://github.com/korandoru/zeronos/actions/runs/3815180690/jobs/6490013554
After running the fix step locally, I notice that it’s because the tool require the year placeholder to be resolved as “this year”:
func (config *ConfigHeader) GetLicenseContent() (c string) {
owner, name := config.License.CopyrightOwner, config.License.SoftwareName
defer func() {
c = strings.ReplaceAll(c, "[year]", strconv.Itoa(time.Now().Year()))
c = strings.ReplaceAll(c, "[owner]", owner)
c = strings.ReplaceAll(c, "[software-name]", name)
}()
if c = strings.TrimSpace(config.License.Content); c != "" {
return config.License.Content // Do not change anything in user config
}
c, err := readLicenseFromSpdx(config)
if err != nil {
logger.Log.Warnln(err)
return ""
}
return c
}
What you expected to happen
Check succeeds. Because we should be able to accept license headers to replace the [year] with inceptionYear that <= this year.
How to reproduce
See the CI report above. I think all projects using skywalking eyes with license that has a year placeholder will report more cases later.
Anything else
license-maven-plugin provides a series of year predefines:
license.git.copyrightLastYear- the year of the last change of the present file as seen in git historylicense.git.copyrightYears- the combination ofproject.inceptionYearandlicense.git.copyrightLastYeardelimited by a dash (-), or justproject.inceptionYearifproject.inceptionYearis equal tolicense.git.copyrightLastYearlicense.git.CreationAuthorNameandlicense.git.CreationAuthorEmail- the name and email of the author of the first commit of the present file as seen in git history.license.git.copyrightCreationYear- the year of the first commit of the present file as seen in git historylicense.git.copyrightExistenceYears- Similar tolicense.git.copyrightYearsbut usinglicense.git.copyrightCreationYearfor the first year
This can be an alternative before license-eye fixes the issue. Or users can update the year to this year.
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project’s Code of Conduct
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (14 by maintainers)
Additionally, from an engineer’s perspective, I don’t want to update the licenses of all files once a year. It’s tedious and stupid as well.
… and I submitted it https://issues.apache.org/jira/browse/LEGAL-629.
While in another aspect that
header fixwill add a brand new header instead of modifying in place, which make the “update annually” quick complex to do (UPDATE: Global find-and-replace in editor can help). But it should be another issue.I personally think the users should update the year in license every year, checking the year according to something like git modification time doesn’t make much sense to me.
But if for any reason the license is not applicable to the work since a year, say 2020, I agree we can have a configuration similar to
copyright-owner, let’s call itcopyright-yearsfor now and users should setcopyright-yearsto the fixed year(range).In short, my thought is: if the license is still applicable to the work, the year should be updated annually