Skip to content

[Bug] skyWalking-eyes checks header should not require to match this year #10223

@tisonkun

Description

@tisonkun

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 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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working and you are sure it's a bug!license eye

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions