-
Notifications
You must be signed in to change notification settings - Fork 6.6k
[Bug] skyWalking-eyes checks header should not require to match this year #10223
Description
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