You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[skywalking-eye] Add a replace-pattern option for header update.
#14254
Hi! So I was looking at how skywalking-eyes can be used to update license headers in a project. I see that apache/skywalking-eyes#98 added the ability to replace an existing header based on a pattern. But if a file matches either header.license.content or header.license.pattern, the header is considered valid and no fix is performed. It would be useful to add a separate field, e.g. header.license.replace-pattern that, if matched, would get replaced with content. My use-case is relicensing an existing project/folder from license A to B, but I believe this can be used more broadly. When doing so, I'd like to preserve existing copyright year in the new content.
For example, we can have the following configuration:
replace-pattern: | Copyright (?P<year>[0-9]{4}(?:[-, ]+[0-9]{2,4})*) Example Licensed under MIT.\.content: | Copyright [year] Example Licensed under Apache-2.0.
A regex can be used to capture the year, a range, or a comma-separated list. If no year is captured, we can use the configured copyright-year, or the current year. Header check should only accept content | pattern, and reject old headers described in replace-pattern, while fix would replace old headers in place.
I believe this would fix issues such as #12887 and #10972 at the same time.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hi! So I was looking at how
skywalking-eyescan be used to update license headers in a project. I see that apache/skywalking-eyes#98 added the ability to replace an existing header based on a pattern. But if a file matches eitherheader.license.contentorheader.license.pattern, the header is considered valid and no fix is performed. It would be useful to add a separate field, e.g.header.license.replace-patternthat, if matched, would get replaced withcontent. My use-case is relicensing an existing project/folder from license A to B, but I believe this can be used more broadly. When doing so, I'd like to preserve existing copyright year in the new content.For example, we can have the following configuration:
A regex can be used to capture the year, a range, or a comma-separated list. If no year is captured, we can use the configured
copyright-year, or the current year. Headercheckshould only acceptcontent | pattern, and reject old headers described inreplace-pattern, whilefixwould replace old headers in place.I believe this would fix issues such as #12887 and #10972 at the same time.
All reactions