tisonkun opened a new issue, #10223:
URL: https://github.com/apache/skywalking/issues/10223

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) 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":
   
   ```go
   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](https://github.com/mathieucarbou/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 history
   * `license.git.copyrightYears` - the combination of `project.inceptionYear` 
and `license.git.copyrightLastYear` delimited by a dash (`-`), or just 
`project.inceptionYear` if `project.inceptionYear` is equal to 
`license.git.copyrightLastYear`
   * `license.git.CreationAuthorName` and `license.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 history
   * `license.git.copyrightExistenceYears` - Similar to 
`license.git.copyrightYears` but using `license.git.copyrightCreationYear` for 
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
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to