Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please make copyright header check better #492

Open
hostep opened this issue Mar 5, 2025 · 1 comment
Open

Please make copyright header check better #492

hostep opened this issue Mar 5, 2025 · 1 comment
Labels
enhancement Improvements to existing rules

Comments

@hostep
Copy link
Contributor

hostep commented Mar 5, 2025

Description

The new requirements for the copyright header as of a few months are:

/**
 * Copyright [first year code created] Adobe
 * All rights reserved.
 */

(in various formats, depending on the file type: php, xml, less, js, ...)

Currently we only check with a regex on /Copyright (\d{4}) Adobe/, the second line is not being checked and also if anybody cares to add more lines above or below this one line, we also don't check on it.
Example here: magento/magento2-page-builder@33377b4:

  • ADOBE CONFIDENTIAL shouldn't be there
  • that whole section that starts with NOTICE: All information contained ... shouldn't be there

At the moment - due to technical limitations, or so I understood - the year a file was generated can't be detected in the pipelines checks that run on github, so that's hard to automate, even though it would be a nice bonus. I constantly see people adding wrong years to the copyright header.

Also, when the static test fails, we get this error "Copyright is missing or Copyright content/year is not valid" that doesn't help at all, there's no explanation in what is expected exactly and what is wrong. So the output should be more helpful by explicitly saying what needs to happen, or link to some documentation that explains this.

Expected behavior

Ideally, we should check for the copyright header to contain 2 lines as mentioned above, nothing more, nothing less.

Bonus: figure out a technical solution to determine the year a file was first added in git and enforce that year to be used in the copyright header.

Benefits

Stop having Adobe developers from not following the correct instructions, and help outside contributors from not being confused when they get the error "Copyright is missing or Copyright content/year is not valid" to tell them exactly what to implement.

Additional information

@hostep hostep added the enhancement Improvements to existing rules label Mar 5, 2025
Copy link

m2-assistant bot commented Mar 5, 2025

Hi @hostep. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to existing rules
Projects
None yet
Development

No branches or pull requests

1 participant