Configuring Project-Level Commit Rules
Overview of Commit Rules
CodeArts Repo supports verification and restriction rules for high-quality code commits.
The following describes how to configure project-level commit rules and use common regular expressions.
Configuring Project-Level Commit Rules
On the CodeArts Repo homepage, go to the project homepage, choose Settings > Policy Settings > Commit Rules, and click Create Commit Rule. For details, see Table 1.
Parameter |
Description |
---|---|
Rule Name |
Mandatory. Custom rule name. |
Branch |
Enter a complete rule name or create a regular expression. This parameter is mandatory. The input needs to be verified, including the branch name and regular expression. |
Commit Rule |
Optional.
|
Basic Attributes |
Optional.
NOTE:
When a repository is created, the max. size of a single file in the default commit rule is 50 MB for recommendation. The max. file size is 200 MB. |
Binary Rules |
Optional. This is not selected by default. Do not allow new binary files (privileged users excepted) is selected by default. After Allow changes to binary files is selected, binary files in the modify state will not be intercepted and can be directly uploaded. Binary files can be deleted without binary check.
|
Effective Date |
Optional. Before being committed, all commits created after the effective date must match the hook settings. If this parameter is left empty, all commits are checked regardless of the commit date. |
Common Regular Expression Examples
Common regular expression examples are listed below.
Rule |
Example |
---|---|
Single a, b, or c |
[abc] |
Characters other than a, b, or c |
[^abc] |
Lowercase letters ranging from a to z |
[a-z] |
Characters other than the range of a to z |
[^a-z] |
Uppercase and lowercase letters in the range of a to z or A to Z |
[a-zA-Z] |
Any single character |
. |
Either a or b |
a|b |
Any blank character |
\s |
Non-blank character |
\S |
Arabic numeral character |
\d |
Non-Arabic numeral characters |
\D |
Letters, digits, or underscores (_) |
\w |
Characters other than letters, digits, or underscores (_) |
\W |
Match the content in parentheses (not capture) |
(?:...) |
Match and capture the content in parentheses |
(...) |
No or one a |
a? |
No or more a's |
a* |
One or more a's |
a+ |
Three a's |
a{3} |
More than three a's |
a{3,} |
3 to 6 a's |
a{3,6} |
Beginning of text |
^ |
End of text |
$ |
Word boundary |
\b |
Non-word boundary |
\B |
Line breaker |
\n |
Carriage return character |
\r |
Tab key |
\t |
Null string |
\0 |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot