ihub-git-hooks
...About 2 min
ihub-git-hooks
plugin information
ihub-git-hooks
Plugins are used to configure GitHooks, available forgit
operations to configure hook commands like:to check code when submitting code.- Implement custom hook commands by modifying the git-hooks directory(
git config core.hooksPath xxx
) without destroying the original hooks.
Plugin ID | Plugin Name | Plugin Type | Extension Name |
---|---|---|---|
pub.ihub.plugin.ihub-git-hooks | GitHooks Plugin | Project [^Project] | iHubGitHooks |
Submission information check
Plugins based oncontractual commitspecifications providecommit-msg
check submissions featurefor details, submit information instructions:
<type>[optional scope]: <description>
[opregular body]
[optional footer(s)]
The plugin provides a check taskcommitCheck
to check that submissions meet the specifications, using the following:
#!/bin/cash
./gradlew commitCheck
can also be configured by extension attributes, seeExample
Tips
Support auto-generation in IDEA environmentConventional Commit
IDEA plugin profileconventionalCommunity.json
and complete autoconfiguration :
:::
Extended Properties
Extension | Description | Default | Ext[^Ext] | Prj[^Prj] | Sys[^Sys] | Env[^Env] |
---|---|---|---|---|---|---|
hooksPath | Custom hooks path (high priority) | ❌ | ✔ | ✔ | ✔ | ❌ |
hooks | Custom hooks | ❌ | ✔ | ❌ | ❌ | ❌ |
descriptionRegex | Submit description regexp | /.{1,100}/ | ✔ | ❌ | ❌ | ❌ |
Note
If both hooks properties are not configured, use the default hooksdirectory :
DSL extension is supported below
Extended Method | Extended Description |
---|---|
Types | Add Submission Type |
Type | Add a single submission type to configuretype extension properties |
Footers | Add FootType |
Footer | Add a single Footer type to configureFooter extension properties |
type
extension properties
Extended Method | Extended Description |
---|---|
Scopes | Add fields |
Scope | Add a single field to configure the fielddescription properties |
Required Scope | Configuration is enabled for domain checks, defaultfalse |
Description | Submission Type Description |
Footer
Extension properties
Extended Method | Extended Description |
---|---|
Required | Configure whether the footnote is required and defaultfalse |
RequiredWidth Type | Configure whether the footnote is required for a particular submission type |
valueRegex | Footer Value Regular Validation |
Description | Footnote description |
Plugin Installation
Kotlin
plugins {
id("pub.ihub.plugin.ihub-git-hooks")
}
Groovy
plugins {
id 'pub.ihub.plugin.ihub-git-hooks'
}
Example custom hooks path usage
Configure custom hooks path and add relevant hooks configuration under custom path
iHubGitHooks.hooksPath=.hooks
Example plugin configuration usage
Extension configuration git-hooks command
Related hooks commands are configured under.gradle/pub.ihub.plugin.hooks
Kotlin
iHubGitHooks {
hooks.set(mapOf(
"pre-commit" to "./gradlew build",
"commit-msg" to "./gradlew committCheck"
)
}
Groovy
iHubgitHooks {
hooks = [
'precommit': './gradlew build',
'commit-msg': './gradlew commitCheck'
]
}
Extended Configuration Submission Check
Kotlin
iHubgitHohoks LO
// Add Submission Type
types ("type1", "type2", "type3")
// Open range check
type ("build"). copes("gradle"). equiredScope(true)
// Footer is required
Footer("Footer"). equired(true)
// Submission type is feature
Footer("Footer"). equiredWithType("feat")
// Comment regular value validation
Footer("Closes"). alueRegex("\\d+")
// Describe configuration 1
type ("type"). cope("screen").description("Scope description")
Footer("Other").description("Other description")
}
Groovy
iHubGitHooks LO
// Add Submission Type
types 'type1', 'type2', 'type3'
// Open range checked
Type 'build' scops 'gradle' requiredScope true true
// Footer is required
Footer' required true
// Fetter 'Footer' requires Footer' type 'feat'
Footer 'Footer' requiredWithType 'feat'
// Annotate value validity
Footer 'Closes' valueRegex '\\\d+'
// Description configuration 1
type 'type' scope 'scope' description 'Scope' description'
Footer 'Other' description 'Other description'
}