RFR: 1357: Add Oracle copyright header format check to jcheck [v2]
Erik Joelsson
erikj at openjdk.org
Mon Dec 9 22:51:23 UTC 2024
On Mon, 9 Dec 2024 22:47:36 GMT, Zhao Song <zsong at openjdk.org> wrote:
>> This patch introduces a copyright jcheck.
>> For pull requests, the check checks the copyright header in all modified files(if the file name matches the regex in .jcheck/conf)
>
> Zhao Song has updated the pull request incrementally with four additional commits since the last revision:
>
> - add copyright header
> - version 2
> - update
> - review comment
jcheck/src/main/java/org/openjdk/skara/jcheck/CopyrightCheck.java line 67:
> 65: var copyrightFound = false;
> 66: for (String line : lines) {
> 67: if (line.contains("Copyright (c)") && line.contains("Oracle")) {
I think it would be nice if we could work with pairs of regular expressions. One for identifying a line that should match and one that verifies the format. This way we could make it possible to add more variants through configuration.
We could also consider not having any default and put the Oracle config in .jcheck/conf.
jcheck/src/main/java/org/openjdk/skara/jcheck/CopyrightConfiguration.java line 29:
> 27: public class CopyrightConfiguration {
> 28: static final CopyrightConfiguration DEFAULT =
> 29: new CopyrightConfiguration(".*\\.cpp|.*\\.hpp|.*\\.c|.*\\.h|.*\\.java");
I would like to see more filetypes included by default. At least `Makefile`, `*.gmk`, `configure`, `*.m4`, `*.md` and `*.properties`. Probably also `*.cc`, `*.hh` and `*.m`.
We could also consider not defining defaults here and have it all in .jcheck/conf for better visibility.
-------------
PR Review Comment: https://git.openjdk.org/skara/pull/1702#discussion_r1872305344
PR Review Comment: https://git.openjdk.org/skara/pull/1702#discussion_r1872307546
More information about the skara-dev
mailing list