RFR: 1236: Add jcheck option to check for large binary files [v3]

Guoxiong Li gli at openjdk.java.net
Thu Dec 2 06:42:27 UTC 2021


On Thu, 2 Dec 2021 06:28:08 GMT, Guoxiong Li <gli at openjdk.org> wrote:

>> Hi all,
>> 
>> This patch adds the large binary file check to the jcheck.
>> 
>> The corresponding configuration is like the following code. Each key/value in the `[checks "binary"]` is a mapper. The `key` means the file pattern and the `value` means the limited file size. For example, `.*\.bin=200B` means the file which ends with `.bin` should not exceed 200 Bytes.
>> 
>> 
>> [checks]
>> error = binary
>> 
>> [checks "binary"]
>> .*.bin=200B
>> .*.o=1k
>> 
>> 
>> The limited file size can use one of these several units:  b(Byte), kb(KiloByte), mb(MegaByte), gb(GigaByte). The units is case insensitive, which means the `Kb`, `kB` and `KB` are equals to `kb(KiloByte)`. If the unit is not provided, it defauts to `b(Byte)`. And these is no a unit called `bit`.
>> 
>> The corresponding test cases are added.
>> 
>> Best Regards,
>> -- Guoxiong
>
> Guoxiong Li has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix copyright.

I updated the code just now. The change is listed below.

1. Use the simple config `max-size`. If the `max-size` is not set or is set to zero, the binary file is not allowed, or the BinaryIssue is raised. If the `max-size` is set and is not zero, the binary file can't be larger than `max-size`, or the BinaryFileTooLargeIssue is raised.
2. Restore the BinaryIssue, which was removed mistakenly.
3. Only check the newly added or copied files. The modified or renamed  binary files won't be checked.
4. Fix the bug that the binary check is not enabled.

Thanks for taking the time to review.

-------------

PR: https://git.openjdk.java.net/skara/pull/1247


More information about the skara-dev mailing list