RFR: 1357: Add Oracle copyright header format check to jcheck [v3]
Erik Joelsson
erikj at openjdk.org
Tue Dec 10 20:58:31 UTC 2024
On Tue, 10 Dec 2024 20:36:12 GMT, Zhao Song <zsong at openjdk.org> wrote:
>> This patch introduces a copyright format jcheck.
>> For pull requests, this check checks the format of copyright header in all modified files(if the file name matches the regex in .jcheck/conf)
>>
>> To enable the new copyrightFormat jcheck, proper configurations are needed in .jcheck/conf. A locator, a validator are needed in the .jcheck/conf file. The locator is only used to locate the copyright line, so the regex is easier to match. If the locator could find the copyright line, then validator will be used to validate the format of the line. There is also an optional parameter "required", it indicates whether a copyright is required for each file, if true, the check will fail if the copyright is missing.
>>
>> For example, if we want to enable a copyright format check for oracle.
>> We can define the configuration like this
>>
>> oracle_locator=.*Copyright (c)(.*)Oracle and/or its affiliates. All rights reserved.
>> oracle_validator=.*Copyright (c) (\d{4})(?:, (\d{4}))?, Oracle and/or its affiliates. All rights reserved.
>> oracle_required=true
>
> Zhao Song has updated the pull request incrementally with one additional commit since the last revision:
>
> review comment
jcheck/src/main/java/org/openjdk/skara/jcheck/CopyrightFormatConfiguration.java line 33:
> 31: public class CopyrightFormatConfiguration {
> 32:
> 33: public static class CopyrightConfiguration {
Did you consider making this a record? Looks like a good fit.
-------------
PR Review Comment: https://git.openjdk.org/skara/pull/1702#discussion_r1878840860
More information about the skara-dev
mailing list