├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── LICENSE ├── README.md ├── build.gradle.kts ├── chengelog.md ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── licenses └── LICENSE ├── pic ├── 1.png ├── 2.png ├── Alipay-300.png ├── Alipay.png ├── WeChat-300.png ├── WeChat.png ├── config.png ├── hb-300.png ├── hb.jpg ├── intellij-idea-100.png ├── jetbrains-100.png └── scope.png ├── settings.gradle.kts ├── src ├── main │ ├── java │ │ └── com │ │ │ ├── godfather1103 │ │ │ ├── commit │ │ │ │ ├── CheckCommitMsgStyleFactory.java │ │ │ │ └── CheckCommitMsgStyleHandler.java │ │ │ ├── entity │ │ │ │ ├── ConfigEntity.java │ │ │ │ └── JiraEntity.java │ │ │ ├── settings │ │ │ │ ├── AppSettings.java │ │ │ │ └── AppSettingsConfigurableProvider.java │ │ │ ├── ui │ │ │ │ ├── Settings.form │ │ │ │ └── Settings.java │ │ │ ├── util │ │ │ │ ├── AESUtils.java │ │ │ │ ├── HttpUtils.java │ │ │ │ ├── JiraUtils.java │ │ │ │ ├── NotificationCenter.java │ │ │ │ ├── RuleCheckApp.java │ │ │ │ └── StringUtils.java │ │ │ └── vo │ │ │ │ └── CheckRuleVo.java │ │ │ └── leroymerlin │ │ │ └── commit │ │ │ ├── ChangeType.java │ │ │ ├── CommitDialog.java │ │ │ ├── CommitPanel.form │ │ │ ├── CommitPanel.java │ │ │ └── CreateCommitAction.java │ └── resources │ │ ├── META-INF │ │ ├── plugin.xml │ │ └── pluginIcon.svg │ │ ├── i18n │ │ ├── describe.properties │ │ └── describe_zh_CN.properties │ │ └── icons │ │ └── load.png └── test │ └── java │ └── com │ └── godfather1103 │ └── util │ ├── AESUtilsTest.java │ └── JiraUtilsTest.java ├── template.check.commit.style.rule.json └── tools └── marketplace-zip-signer-cli.jar /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: https://paypal.me/godfather1103?locale.x=zh_XC 13 | 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Android template 3 | # Built application files 4 | *.apk 5 | *.ap_ 6 | .DS_Store 7 | 8 | # Files for the ART/Dalvik VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # Generated files 15 | bin/ 16 | gen/ 17 | out/ 18 | 19 | # Gradle files 20 | .gradle/ 21 | build/ 22 | 23 | # Local configuration file (sdk path, etc) 24 | local.properties 25 | 26 | # Proguard folder generated by Eclipse 27 | proguard/ 28 | 29 | # Log Files 30 | *.log 31 | 32 | # Android Studio Navigation editor temp files 33 | .navigation/ 34 | 35 | # Android Studio captures folder 36 | captures/ 37 | 38 | # IntelliJ 39 | *.iml 40 | .idea/workspace.xml 41 | .idea/tasks.xml 42 | .idea/gradle.xml 43 | .idea/assetWizardSettings.xml 44 | .idea/dictionaries 45 | .idea/libraries 46 | .idea/caches 47 | /.idea/** 48 | 49 | # Keystore files 50 | # Uncomment the following line if you do not want to check your keystore files in. 51 | #*.jks 52 | 53 | # External native build folder generated in Android Studio 2.2 and later 54 | .externalNativeBuild 55 | 56 | # Google Services (e.g. APIs or Firebase) 57 | google-services.json 58 | 59 | # Freeline 60 | freeline.py 61 | freeline/ 62 | freeline_project_description.json 63 | 64 | # fastlane 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots 68 | fastlane/test_output 69 | fastlane/readme.md 70 | ### Gradle template 71 | .gradle 72 | /build/ 73 | 74 | # Ignore Gradle GUI config 75 | gradle-app.setting 76 | 77 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 78 | !gradle-wrapper.jar 79 | 80 | # Cache of project 81 | .gradletasknamecache 82 | 83 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 84 | # gradle/wrapper/gradle-wrapper.properties 85 | ### Eclipse template 86 | 87 | .metadata 88 | tmp/ 89 | *.tmp 90 | *.bak 91 | *.swp 92 | *~.nib 93 | .settings/ 94 | .loadpath 95 | .recommenders 96 | 97 | # External tool builders 98 | .externalToolBuilders/ 99 | 100 | # Locally stored "Eclipse launch configurations" 101 | *.launch 102 | 103 | # PyDev specific (Python IDE for Eclipse) 104 | *.pydevproject 105 | 106 | # CDT-specific (C/C++ Development Tooling) 107 | .cproject 108 | 109 | # CDT- autotools 110 | .autotools 111 | 112 | # Java annotation processor (APT) 113 | .factorypath 114 | 115 | # PDT-specific (PHP Development Tools) 116 | .buildpath 117 | 118 | # sbteclipse plugin 119 | .target 120 | 121 | # Tern plugin 122 | .tern-project 123 | 124 | # TeXlipse plugin 125 | .texlipse 126 | 127 | # STS (Spring Tool Suite) 128 | .springBeans 129 | 130 | # Code Recommenders 131 | .recommenders/ 132 | 133 | # Scala IDE specific (Scala & Java development for Eclipse) 134 | .cache-main 135 | .scala_dependencies 136 | .worksheet 137 | ### Java template 138 | # Compiled class file 139 | 140 | # Log file 141 | 142 | # BlueJ files 143 | *.ctxt 144 | 145 | # Mobile Tools for Java (J2ME) 146 | .mtj.tmp/ 147 | 148 | # Package Files # 149 | *.jar 150 | *.war 151 | *.nar 152 | *.ear 153 | *.zip 154 | *.tar.gz 155 | *.rar 156 | 157 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 158 | hs_err_pid* 159 | ### JetBrains template 160 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 161 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 162 | 163 | # User-specific stuff 164 | .idea/**/workspace.xml 165 | .idea/**/tasks.xml 166 | .idea/**/dictionaries 167 | .idea/**/shelf 168 | 169 | # Sensitive or high-churn files 170 | .idea/**/dataSources/ 171 | .idea/**/dataSources.ids 172 | .idea/**/dataSources.local.xml 173 | .idea/**/sqlDataSources.xml 174 | .idea/**/dynamic.xml 175 | .idea/**/uiDesigner.xml 176 | .idea/**/dbnavigator.xml 177 | 178 | # Gradle 179 | .idea/**/gradle.xml 180 | .idea/**/libraries 181 | 182 | # CMake 183 | cmake-build-debug/ 184 | cmake-build-release/ 185 | 186 | # Mongo Explorer plugin 187 | .idea/**/mongoSettings.xml 188 | 189 | # File-based project format 190 | *.iws 191 | 192 | # IntelliJ 193 | 194 | # mpeltonen/sbt-idea plugin 195 | .idea_modules/ 196 | 197 | # JIRA plugin 198 | atlassian-ide-plugin.xml 199 | 200 | # Cursive Clojure plugin 201 | .idea/replstate.xml 202 | 203 | # Crashlytics plugin (for Android Studio and IntelliJ) 204 | com_crashlytics_export_strings.xml 205 | crashlytics.properties 206 | crashlytics-build.properties 207 | fabric.properties 208 | 209 | # Editor-based Rest Client 210 | .idea/httpRequests 211 | ### SVN template 212 | .svn/ 213 | ### Kotlin template 214 | # Compiled class file 215 | 216 | # Log file 217 | 218 | # BlueJ files 219 | 220 | # Mobile Tools for Java (J2ME) 221 | 222 | # Package Files # 223 | 224 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 225 | 226 | idea-sandbox/** 227 | !tools/*.jar -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Jack Chu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # commit-template-check-plugin (The plugin in jetbrains IDEs) 2 | 3 |

English Readme:

4 |

Create a commit message with the following template,It also provides the operation of checking the format of commit:

5 | 6 |
 7 | <type>(<scope>): <subject>
 8 | <BLANK LINE>
 9 | <body>
10 | <BLANK LINE>
11 | <footer>
12 | 
13 | 14 |

The plug-in is based on Git Commit Template

15 | 16 |

中文说明:

17 |

该插件可以按照如下模板去生成commit的内容,并提供了检测commit的格式的操作:

18 | 19 |
20 | <type>(<scope>): <subject>
21 | <BLANK LINE>
22 | <body>
23 | <BLANK LINE>
24 | <footer>
25 | 
26 | 27 |

该插件是在Git Commit Template的基础上开发完成

28 | 29 | ### 赞助者(Sponsors) 30 | ![IntelliJ IDEA](pic/jetbrains-100.png) ![IntelliJ IDEA](pic/intellij-idea-100.png) 31 | 感谢 [Jetbrains](https://www.jetbrains.com/?from=commit-template-check-plugin) 提供 [IntelliJ IDEA](https://www.jetbrains.com/idea/) 许可证! 32 | Thanks to [Jetbrains](https://www.jetbrains.com/?from=commit-template-check-plugin) provided license for the [IntelliJ IDEA](https://www.jetbrains.com/?from=commit-template-check-plugin)! 33 | 34 | ### 附录(Annex) 35 | commit-template-check-plugin: 36 | [Plugin](https://plugins.jetbrains.com/plugin/14822-git-commit-template-check/) 37 | [Github](https://github.com/godfather1103/commit-template-check-plugin) 38 | [码云](https://gitee.com/godfather1103/commit-template-check-plugin) 39 | 40 | commit-template-idea-plugin: 41 | [Plugin](https://plugins.jetbrains.com/plugin/9861-git-commit-template) 42 | [Code](https://github.com/MobileTribe/commit-template-idea-plugin) 43 | 44 | ### 更新日志(Changelog) 45 | [点击这里(click here)](chengelog.md) 46 | 47 | ### 捐赠(Donate) 48 | 你的馈赠将助力我更好的去贡献,谢谢! 49 | Your gift will help me to contribute better, thank you! 50 | 51 | [PayPal](https://paypal.me/godfather1103?locale.x=zh_XC) 52 | 53 | 支付宝(Alipay) 54 | ![支付宝](pic/hb-300.png) 55 | ![支付宝](pic/Alipay-300.png) 56 | 57 | 微信(WeChat) 58 | ![微信支付](pic/WeChat-300.png) 59 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("org.jetbrains.intellij") version "1.13.3" 3 | } 4 | 5 | group = "${property("pluginGroup")}" 6 | version = "${property("pluginVersion")}" 7 | 8 | repositories { 9 | mavenLocal() 10 | maven { url = uri("https://maven.aliyun.com/nexus/content/groups/public") } 11 | mavenCentral() 12 | } 13 | 14 | java.sourceCompatibility = JavaVersion.VERSION_11 15 | java.targetCompatibility = JavaVersion.VERSION_11 16 | 17 | tasks.compileJava { 18 | options.encoding = "UTF-8" 19 | } 20 | 21 | dependencies { 22 | // https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp 23 | implementation("com.squareup.okhttp3:okhttp:3.12.0") 24 | // https://mvnrepository.com/artifact/com.google.code.gson/gson 25 | implementation("com.google.code.gson:gson:2.10") 26 | implementation("io.vavr:vavr:0.10.4") 27 | testImplementation("junit:junit:4.13.2") 28 | } 29 | val ideaVersion = System.getProperty( 30 | "ideaVersion", 31 | property("ideaVersion") as String 32 | ) 33 | val ideaType = System.getProperty( 34 | "ideaType", 35 | property("ideaType") as String 36 | ) 37 | val publishChannel = project.findProperty("publishChannel") as String 38 | val first = ideaVersion.split("[.-]".toRegex()).first().toInt() 39 | val yearVersion = first.let { if (it > 2000) it % 100 else it / 10 } 40 | val noVersion = if (first < 2000) first % 10 else ideaVersion 41 | .substring(ideaVersion.indexOf(".") + 1) 42 | .toInt() 43 | intellij { 44 | version.set(ideaVersion) 45 | type.set(ideaType) 46 | updateSinceUntilBuild.set(false) 47 | pluginName.set("${property("pluginName")}") 48 | sandboxDir.set("idea-sandbox/${ideaVersion}") 49 | } 50 | tasks { 51 | patchPluginXml { 52 | sinceBuild.set("${yearVersion}${noVersion}.0") 53 | pluginId.set("commit-template-check-plugin") 54 | pluginDescription.set( 55 | """ 56 |

English Readme:

57 |

Create a commit message with the following template,It also provides the operation of checking the format of commit:

58 |
 59 | <type>(<scope>): <subject>
 60 | <BLANK LINE>
 61 | <body>
 62 | <BLANK LINE>
 63 | <footer>
 64 | 
65 |

Starting from version 1.7.7, it supports adding JIRA information to scope.

66 |

The plug-in is based on Git Commit Template

67 | 68 |

中文说明:

69 |

该插件可以按照如下模板去生成commit的内容,并提供了检测commit的格式的操作:

70 |
 71 | <type>(<scope>): <subject>
 72 | <BLANK LINE>
 73 | <body>
 74 | <BLANK LINE>
 75 | <footer>
 76 | 
77 |

从1.7.7版本开始支持添加jira信息到scope中。

78 |

该插件是在Git Commit Template的基础上开发完成

79 | 80 |

捐赠(Donate)

81 |
 82 | 你的馈赠将助力我更好的去贡献,谢谢!
 83 | Your gift will help me to contribute better, thank you!
 84 | 
 85 | PayPal
 86 | 
 87 | 支付宝(Alipay)
 88 | 支付宝
 89 | 支付宝
 90 | 
 91 | 微信(WeChat)
 92 | 微信支付
 93 | 
94 | """.trimIndent() 95 | ) 96 | changeNotes.set( 97 | """ 98 | 105 | """.trimIndent() 106 | ) 107 | } 108 | 109 | publishPlugin { 110 | project.findProperty("ORG_GRADLE_PROJECT_intellijPublishToken")?.let { 111 | token.set(it as String) 112 | } 113 | if (publishChannel.isNotEmpty()) { 114 | channels.set(listOf(publishChannel)) 115 | } else if (ideaVersion.contains("EAP-SNAPSHOT")) { 116 | channels.set(listOf("beta")) 117 | } 118 | } 119 | 120 | signPlugin { 121 | project.findProperty("signing.certificateChainFile")?.let { 122 | certificateChainFile.set(file(it as String)) 123 | } 124 | project.findProperty("signing.privateKeyFile")?.let { 125 | privateKeyFile.set(file(it as String)) 126 | } 127 | project.findProperty("signing.password")?.let { 128 | password.set(it as String) 129 | } 130 | } 131 | 132 | initializeIntelliJPlugin { 133 | offline.set(true) 134 | } 135 | 136 | downloadZipSigner { 137 | cliPath.set("${project.projectDir.absolutePath}/tools/marketplace-zip-signer-cli.jar") 138 | } 139 | } -------------------------------------------------------------------------------- /chengelog.md: -------------------------------------------------------------------------------- 1 | # 2.0 2 | 3 | - 将配置级别从全局更改为项目 4 | - change the configuration level from global to project 5 | 6 | # 1.8.8 7 | 8 | - 添加logo 9 | - add logo 10 | - 移除过时的方法调用 11 | - remove Deprecated method 12 | 13 | # 1.8.7 14 | 15 | - 代码优化 16 | - optimized code 17 | 18 | # 1.8.6 19 | 20 | - XML中增加displayName属性值的设置 21 | - Setting the value of the displayName attribute in XML 22 | 23 | # 1.8.5 24 | 25 | - 代码优化 26 | - optimized code 27 | 28 | # 1.8.4 29 | 30 | - 修复在部分IDEA中长描述输入框输入非ascii码字符显示为乱码的问题 31 | - Fixed the bug of input non-ascii characters into the long description input box in some IDEAs were displayed as garbled characters 32 | 33 | # 1.8.3 34 | 35 | - 修复配图 36 | - replace picture 37 | 38 | # 1.8.2 39 | 40 | - 移除过时的方法调用 41 | - remove Deprecated method 42 | 43 | # 1.8.1 44 | 45 | - 移除过时的方法调用 46 | - remove Deprecated method 47 | 48 | # 1.8.0 49 | 50 | - 增加自定义JQL的操作 51 | - custom jql 52 | 53 | # 1.7.9 54 | 55 | - 移除过时的方法调用,升级IDEA版本到2020.2 56 | - remove Deprecated method,update IDEA version to 2020.2 57 | - scope中item增加提示框,用于显示过长的内容 58 | - A prompt box is added to the item in the scope to display the long content 59 | 60 | # 1.7.8 61 | 62 | - 修复Scope未选择时报空指针异常 63 | - Fix NullPointerException when scope is not selected 64 | - 更改JIRA列表的获取时的认证方式 65 | - Change the authentication method when obtaining the JIRA list 66 | - 修复非ascii码账户获取JIRA列表报错的问题 67 | - Fixed the bug of getting JIRA list from non-ascii characters account 68 | 69 | # 1.7.7 70 | 71 | - 支持添加jira信息到scope中 72 | - Support adding JIRA to scope 73 | 74 | # 1.7.6 75 | 76 | - 升级校验工具版本 77 | - Upgrade tool version 78 | 79 | # 1.7.5 80 | 81 | - 描述信息的区域自适应 82 | - Region adaptation for description information 83 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | ideaVersion=2024.1 2 | ideaType=IC 3 | pluginGroup=com.godfather1103 4 | pluginName=commit-template-check-plugin 5 | pluginVersion=2.1 6 | publishChannel= 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Nov 02 16:44:26 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://mirrors.huaweicloud.com/gradle/gradle-7.5.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /licenses/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2017 Leroy Merlin 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /pic/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/pic/1.png -------------------------------------------------------------------------------- /pic/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/pic/2.png -------------------------------------------------------------------------------- /pic/Alipay-300.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/pic/Alipay-300.png -------------------------------------------------------------------------------- /pic/Alipay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/pic/Alipay.png -------------------------------------------------------------------------------- /pic/WeChat-300.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/pic/WeChat-300.png -------------------------------------------------------------------------------- /pic/WeChat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/pic/WeChat.png -------------------------------------------------------------------------------- /pic/config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/pic/config.png -------------------------------------------------------------------------------- /pic/hb-300.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/pic/hb-300.png -------------------------------------------------------------------------------- /pic/hb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/pic/hb.jpg -------------------------------------------------------------------------------- /pic/intellij-idea-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/pic/intellij-idea-100.png -------------------------------------------------------------------------------- /pic/jetbrains-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/pic/jetbrains-100.png -------------------------------------------------------------------------------- /pic/scope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/pic/scope.png -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "commit-template-check-plugin" 2 | 3 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/commit/CheckCommitMsgStyleFactory.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.commit; 2 | 3 | import com.intellij.openapi.vcs.CheckinProjectPanel; 4 | import com.intellij.openapi.vcs.changes.CommitContext; 5 | import com.intellij.openapi.vcs.checkin.CheckinHandler; 6 | import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | /** 10 | *

Title: Godfather1103's Github

11 | *

Copyright: Copyright (c) 2018

12 | *

Company: https://github.com/godfather1103

13 | * 14 | * @author 作者: godfa E-mail: chuchuanbao@gmail.com 15 | * 创建时间:2018/11/3 23:36 16 | * @version 1.0 17 | * @since 1.0 18 | */ 19 | public class CheckCommitMsgStyleFactory extends CheckinHandlerFactory { 20 | @NotNull 21 | @Override 22 | public CheckinHandler createHandler(@NotNull CheckinProjectPanel checkinProjectPanel, @NotNull CommitContext commitContext) { 23 | return new CheckCommitMsgStyleHandler(checkinProjectPanel.getProject(), checkinProjectPanel); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/commit/CheckCommitMsgStyleHandler.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.commit; 2 | 3 | 4 | import com.godfather1103.settings.AppSettings; 5 | import com.godfather1103.util.NotificationCenter; 6 | import com.godfather1103.util.RuleCheckApp; 7 | import com.intellij.openapi.project.DumbService; 8 | import com.intellij.openapi.project.Project; 9 | import com.intellij.openapi.vcs.CheckinProjectPanel; 10 | import com.intellij.openapi.vcs.checkin.CheckinHandler; 11 | import com.intellij.openapi.vcs.ui.RefreshableOnComponent; 12 | import com.intellij.ui.NonFocusableCheckBox; 13 | import org.jetbrains.annotations.Nullable; 14 | 15 | import javax.swing.*; 16 | import java.awt.*; 17 | import java.io.File; 18 | import java.util.Objects; 19 | import java.util.ResourceBundle; 20 | 21 | 22 | /** 23 | *

Title: Godfather1103's Github

24 | *

Copyright: Copyright (c) 2018

25 | *

Company: https://github.com/godfather1103

26 | * 27 | * @author 作者: godfa E-mail: chuchuanbao@gmail.com 28 | * 创建时间:2018/11/3 23:36 29 | * @version 1.0 30 | * @since 1.0 31 | */ 32 | public class CheckCommitMsgStyleHandler extends CheckinHandler { 33 | 34 | private final ResourceBundle bundle; 35 | 36 | private final Project myProject; 37 | 38 | private final CheckinProjectPanel myCheckinPanel; 39 | 40 | private static boolean checkFlag = true; 41 | 42 | CheckCommitMsgStyleHandler(Project myProject, CheckinProjectPanel myCheckinPanel) { 43 | this.myProject = myProject; 44 | this.myCheckinPanel = myCheckinPanel; 45 | this.bundle = ResourceBundle.getBundle("i18n/describe"); 46 | } 47 | 48 | @Nullable 49 | @Override 50 | public RefreshableOnComponent getBeforeCheckinConfigurationPanel() { 51 | NonFocusableCheckBox checkBox = new NonFocusableCheckBox(bundle.getString("check_label_message")); 52 | return new RefreshableOnComponent() { 53 | @Override 54 | public JComponent getComponent() { 55 | JPanel panel = new JPanel(new BorderLayout()); 56 | panel.add(checkBox); 57 | boolean dumb = DumbService.isDumb(myProject); 58 | checkBox.setEnabled(!dumb); 59 | return panel; 60 | } 61 | 62 | @Override 63 | public void saveState() { 64 | checkFlag = checkBox.isSelected(); 65 | } 66 | 67 | @Override 68 | public void restoreState() { 69 | checkBox.setSelected(checkFlag); 70 | } 71 | }; 72 | } 73 | 74 | 75 | @Override 76 | public ReturnResult beforeCheckin() { 77 | String basePath = myProject.getBasePath(); 78 | String filePath = basePath + "/check.commit.style.rule.json"; 79 | AppSettings.State state = Objects.requireNonNull(AppSettings.getInstance(myProject).getState()); 80 | String path = state.getPath(); 81 | String sCommitMessage = myCheckinPanel.getCommitMessage(); 82 | if (!checkFlag) { 83 | return ReturnResult.COMMIT; 84 | } else { 85 | try { 86 | if (new File(filePath).exists()) { 87 | new RuleCheckApp(filePath).check(sCommitMessage); 88 | } else if (path != null && new File(path).exists()) { 89 | new RuleCheckApp(path).check(sCommitMessage); 90 | } else { 91 | new RuleCheckApp().check(sCommitMessage); 92 | } 93 | return ReturnResult.COMMIT; 94 | } catch (Exception ex) { 95 | NotificationCenter.noticeWindows(bundle.getString("detection_result"), ex.getMessage(), NotificationCenter.TYPE_ERROR); 96 | return ReturnResult.CANCEL; 97 | } 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/entity/ConfigEntity.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.entity; 2 | 3 | import com.godfather1103.settings.AppSettings; 4 | import com.godfather1103.util.AESUtils; 5 | import com.godfather1103.util.StringUtils; 6 | import io.vavr.control.Try; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | import java.util.Optional; 10 | import java.util.ResourceBundle; 11 | 12 | /** 13 | *

Title: Godfather1103's Github

14 | *

Copyright: Copyright (c) 2020

15 | *

Company: https://github.com/godfather1103

16 | * 17 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 18 | * 创建时间:2020-08-29 23:18 19 | * @version 1.0 20 | * @since 1.0 21 | * 配置相关对象 22 | */ 23 | public class ConfigEntity { 24 | 25 | public enum SelectedMode { 26 | /** 27 | * 只填充jira Key 28 | */ 29 | JIRAKEY(1, "jira_key_mode"), 30 | /** 31 | * 填充jira标题 32 | */ 33 | JIRASUMMARY(2, "jira_summary_mode"), 34 | /** 35 | * 所见即所得 36 | */ 37 | SEE(3, "see_mode"); 38 | 39 | private final Integer key; 40 | private final String value; 41 | 42 | final ResourceBundle bundle; 43 | 44 | SelectedMode(Integer key, String value) { 45 | this.key = key; 46 | this.value = value; 47 | bundle = ResourceBundle.getBundle("i18n/describe"); 48 | } 49 | 50 | public Integer getKey() { 51 | return key; 52 | } 53 | 54 | /** 55 | * getByKey
56 | * 57 | * @param key 参数 58 | * @return 结果 59 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 60 | * @date 创建时间:2024/11/1 18:39 61 | */ 62 | public static Optional getByKey(Integer key) { 63 | for (SelectedMode mode : SelectedMode.values()) { 64 | if (mode.key.equals(key)) { 65 | return Optional.of(mode); 66 | } 67 | } 68 | return Optional.of(JIRAKEY); 69 | } 70 | 71 | @Override 72 | public String toString() { 73 | return bundle.getString(this.value); 74 | } 75 | } 76 | 77 | private ConfigEntity(@NotNull AppSettings.State state) { 78 | this.path = StringUtils.showString(state.getPath()); 79 | this.jiraServer = StringUtils.showString(state.getJiraServer()); 80 | this.jiraUserName = StringUtils.showString(state.getJiraUserName()); 81 | this.jiraPassword = Try.of(() -> AESUtils.decrypt(state.getJiraPassword())).getOrNull(); 82 | this.jiraJQL = StringUtils.showString(state.getJiraJql()); 83 | this.selectedMode = SelectedMode.getByKey(state.getSelectedMode()).orElse(SelectedMode.JIRAKEY); 84 | } 85 | 86 | public static Optional getEntity(AppSettings.State state) { 87 | if (state == null) { 88 | return Optional.empty(); 89 | } else { 90 | return Optional.of(new ConfigEntity(state)); 91 | } 92 | } 93 | 94 | private String path; 95 | private String jiraServer; 96 | private String jiraUserName; 97 | private String jiraPassword; 98 | private String jiraJQL; 99 | private SelectedMode selectedMode; 100 | 101 | public boolean isOpenJira() { 102 | if (StringUtils.isEmpty(jiraServer)) { 103 | return false; 104 | } 105 | if (StringUtils.isEmpty(jiraUserName)) { 106 | return false; 107 | } 108 | if (StringUtils.isEmpty(jiraPassword)) { 109 | return false; 110 | } 111 | return true; 112 | } 113 | 114 | public String getPath() { 115 | return path; 116 | } 117 | 118 | public void setPath(String path) { 119 | this.path = path; 120 | } 121 | 122 | public String getJiraServer() { 123 | return jiraServer; 124 | } 125 | 126 | public void setJiraServer(String jiraServer) { 127 | this.jiraServer = jiraServer; 128 | } 129 | 130 | public String getJiraUserName() { 131 | return jiraUserName; 132 | } 133 | 134 | public void setJiraUserName(String jiraUserName) { 135 | this.jiraUserName = jiraUserName; 136 | } 137 | 138 | public String getJiraPassword() { 139 | return jiraPassword; 140 | } 141 | 142 | public void setJiraPassword(String jiraPassword) { 143 | this.jiraPassword = jiraPassword; 144 | } 145 | 146 | public SelectedMode getSelectedMode() { 147 | return selectedMode; 148 | } 149 | 150 | public void setSelectedMode(SelectedMode selectedMode) { 151 | this.selectedMode = selectedMode; 152 | } 153 | 154 | public String getJiraJQL() { 155 | return jiraJQL; 156 | } 157 | 158 | public void setJiraJQL(String jiraJQL) { 159 | this.jiraJQL = jiraJQL; 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/entity/JiraEntity.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.entity; 2 | 3 | /** 4 | *

Title: Godfather1103's Github

5 | *

Copyright: Copyright (c) 2020

6 | *

Company: https://github.com/godfather1103

7 | * 8 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 9 | * 创建时间:2020-08-29 23:56 10 | * @version 1.0 11 | * @since 1.0 12 | * Jira相关对象 13 | */ 14 | public class JiraEntity { 15 | private String key; 16 | private String summary; 17 | 18 | public JiraEntity(String key, String summary) { 19 | this.key = key; 20 | this.summary = summary; 21 | } 22 | 23 | public String getKey() { 24 | return key; 25 | } 26 | 27 | public void setKey(String key) { 28 | this.key = key; 29 | } 30 | 31 | public String getSummary() { 32 | return summary; 33 | } 34 | 35 | public void setSummary(String summary) { 36 | this.summary = summary; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return key + " - " + summary; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/settings/AppSettings.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.settings; 2 | 3 | import com.godfather1103.util.StringUtils; 4 | import com.intellij.ide.util.PropertiesComponent; 5 | import com.intellij.openapi.components.PersistentStateComponent; 6 | import com.intellij.openapi.components.Service; 7 | import com.intellij.openapi.components.State; 8 | import com.intellij.openapi.components.Storage; 9 | import com.intellij.openapi.project.Project; 10 | import org.jetbrains.annotations.NotNull; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | 14 | import java.util.Objects; 15 | import java.util.Optional; 16 | 17 | import static com.godfather1103.util.StringUtils.showString; 18 | 19 | /** 20 | *

Title: Godfather1103's Github

21 | *

Copyright: Copyright (c) 2024

22 | *

Company: https://github.com/godfather1103

23 | * 类描述: 24 | * 25 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 26 | * @version 1.0 27 | * @date 创建时间:2024/11/1 16:59 28 | * @since 1.0 29 | */ 30 | @Service(Service.Level.PROJECT) 31 | @State( 32 | name = "com.godfather1103.settings.AppSettings", 33 | storages = @Storage("ComGodfather1103SettingsAppSettings.xml") 34 | ) 35 | public final class AppSettings implements PersistentStateComponent { 36 | 37 | private static final Logger LOGGER = LoggerFactory.getLogger(AppSettings.class); 38 | 39 | public static final String PATH = "RuleConfFilePath"; 40 | public static final String JIRA_SERVER_ADDRESS = "JIRA_SERVER_ADDRESS"; 41 | public static final String JIRA_USERNAME = "JIRA_USERNAME"; 42 | public static final String JIRA_PASSWORD = "JIRA_PASSWORD"; 43 | public static final String JIRA_JQL = "JIRA_JQL"; 44 | public static final String SCOPE_SELECTED_ITEM_INPUT_VALUE = "SCOPE_SELECTED_ITEM_INPUT_VALUE"; 45 | public static final String SYSTEM_FLAG = "system"; 46 | public static final String USER_FLAG = "user"; 47 | 48 | private State myState = new State(); 49 | 50 | private static State systemState; 51 | 52 | public static AppSettings getInstance(Project project) { 53 | loadSystemState(); 54 | var app = project.getService(AppSettings.class); 55 | if (Objects.nonNull(app.getState())) { 56 | app.getState().setTemplateProject(project.isDefault()); 57 | } 58 | return app; 59 | } 60 | 61 | @Override 62 | public State getState() { 63 | if (Objects.isNull(myState.getUseSystemConfig()) 64 | || Optional.ofNullable(myState.getTemplateProject()).orElse(false)) { 65 | loadState(myState); 66 | } 67 | return myState; 68 | } 69 | 70 | @Override 71 | public void loadState(@NotNull State state) { 72 | loadSystemState(); 73 | // 默认工程统一使用系统变量 74 | if (Optional.ofNullable(myState.getTemplateProject()).orElse(false)) { 75 | state.setUseSystemConfig(true); 76 | } 77 | // 非默认工程根据实际情况注入 78 | if (Objects.isNull(state.getUseSystemConfig())) { 79 | state.setUseSystemConfig(StringUtils.isEmpty(state.getJiraServer())); 80 | } 81 | // 第一次加载时注入其中 82 | if (state.getUseSystemConfig()) { 83 | systemState.copyTo(state); 84 | state.setUseSystemConfig(Optional.ofNullable(state.getTemplateProject()).orElse(false)); 85 | } 86 | this.myState = state; 87 | } 88 | 89 | /** 90 | * loadSystemState
91 | * 92 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 93 | * @date 创建时间:2025/4/17 15:11 94 | */ 95 | private static void loadSystemState() { 96 | if (Objects.isNull(systemState)) { 97 | synchronized (State.class) { 98 | if (Objects.isNull(systemState)) { 99 | State tmp = new State(SYSTEM_FLAG); 100 | PropertiesComponent prop = PropertiesComponent.getInstance(); 101 | String storedPath = showString(prop.getValue(PATH)); 102 | String storedJiraServerAddress = showString(prop.getValue(JIRA_SERVER_ADDRESS)); 103 | String storedJiraUserName = showString(prop.getValue(JIRA_USERNAME)); 104 | String storedJiraPassword = showString(prop.getValue(JIRA_PASSWORD)); 105 | String storedJiraJql = showString(prop.getValue(JIRA_JQL)); 106 | tmp.setPath(storedPath); 107 | tmp.setJiraServer(storedJiraServerAddress); 108 | tmp.setJiraUserName(storedJiraUserName); 109 | tmp.setJiraPassword(storedJiraPassword); 110 | tmp.setJiraJql(storedJiraJql); 111 | tmp.setSelectedMode(prop.getInt(SCOPE_SELECTED_ITEM_INPUT_VALUE, 1)); 112 | systemState = tmp; 113 | } 114 | } 115 | } 116 | } 117 | 118 | public static class State { 119 | 120 | private final String type; 121 | 122 | public State() { 123 | this(USER_FLAG); 124 | } 125 | 126 | private State(String type) { 127 | this.type = type; 128 | } 129 | 130 | private Boolean useSystemConfig; 131 | private Boolean templateProject; 132 | private String path; 133 | private String jiraServer; 134 | private String jiraUserName; 135 | private String jiraPassword; 136 | private String jiraJql; 137 | private Integer selectedMode; 138 | 139 | /** 140 | * applyToSystem
141 | * 142 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 143 | * @date 创建时间:2025/4/17 15:08 144 | */ 145 | public void applyToSystem() { 146 | if (Objects.equals(SYSTEM_FLAG, getType())) { 147 | LOGGER.warn("系统State不能调度该方法"); 148 | return; 149 | } 150 | copyTo(systemState); 151 | PropertiesComponent prop = PropertiesComponent.getInstance(); 152 | prop.setValue(PATH, showString(systemState.getPath())); 153 | prop.setValue(JIRA_SERVER_ADDRESS, showString(systemState.getJiraServer())); 154 | prop.setValue(JIRA_USERNAME, showString(systemState.getJiraUserName())); 155 | prop.setValue(JIRA_PASSWORD, showString(systemState.getJiraPassword())); 156 | prop.setValue(JIRA_JQL, showString(systemState.getJiraJql())); 157 | prop.setValue(SCOPE_SELECTED_ITEM_INPUT_VALUE, Optional.ofNullable(systemState.getSelectedMode()).orElse(1), 1); 158 | } 159 | 160 | /** 161 | * copyTo
162 | * 163 | * @param to 参数 164 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 165 | * @date 创建时间:2025/4/17 15:05 166 | */ 167 | private void copyTo(@NotNull State to) { 168 | to.setPath(getPath()); 169 | to.setJiraServer(getJiraServer()); 170 | to.setJiraUserName(getJiraUserName()); 171 | to.setJiraPassword(getJiraPassword()); 172 | to.setJiraJql(getJiraJql()); 173 | to.setSelectedMode(getSelectedMode()); 174 | } 175 | 176 | public String getType() { 177 | return type; 178 | } 179 | 180 | public Boolean getTemplateProject() { 181 | return templateProject; 182 | } 183 | 184 | public void setTemplateProject(Boolean templateProject) { 185 | this.templateProject = templateProject; 186 | } 187 | 188 | public Boolean getUseSystemConfig() { 189 | return useSystemConfig; 190 | } 191 | 192 | public void setUseSystemConfig(Boolean useSystemConfig) { 193 | this.useSystemConfig = useSystemConfig; 194 | } 195 | 196 | public String getPath() { 197 | return path; 198 | } 199 | 200 | public void setPath(String path) { 201 | this.path = path; 202 | } 203 | 204 | public String getJiraServer() { 205 | return jiraServer; 206 | } 207 | 208 | public void setJiraServer(String jiraServer) { 209 | this.jiraServer = jiraServer; 210 | } 211 | 212 | public String getJiraUserName() { 213 | return jiraUserName; 214 | } 215 | 216 | public void setJiraUserName(String jiraUserName) { 217 | this.jiraUserName = jiraUserName; 218 | } 219 | 220 | public String getJiraPassword() { 221 | return jiraPassword; 222 | } 223 | 224 | public void setJiraPassword(String jiraPassword) { 225 | this.jiraPassword = jiraPassword; 226 | } 227 | 228 | public String getJiraJql() { 229 | return jiraJql; 230 | } 231 | 232 | public void setJiraJql(String jiraJql) { 233 | this.jiraJql = jiraJql; 234 | } 235 | 236 | public Integer getSelectedMode() { 237 | return selectedMode; 238 | } 239 | 240 | public void setSelectedMode(Integer selectedMode) { 241 | this.selectedMode = selectedMode; 242 | } 243 | } 244 | } 245 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/settings/AppSettingsConfigurableProvider.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.settings; 2 | 3 | import com.godfather1103.ui.Settings; 4 | import com.intellij.openapi.options.Configurable; 5 | import com.intellij.openapi.options.ConfigurableProvider; 6 | import com.intellij.openapi.project.Project; 7 | import org.jetbrains.annotations.NotNull; 8 | import org.jetbrains.annotations.Nullable; 9 | 10 | /** 11 | *

Title: Godfather1103's Github

12 | *

Copyright: Copyright (c) 2024

13 | *

Company: https://github.com/godfather1103

14 | * 类描述: 15 | * 16 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 17 | * @version 1.0 18 | * @date 创建时间:2024/11/1 18:00 19 | * @since 1.0 20 | */ 21 | public class AppSettingsConfigurableProvider extends ConfigurableProvider { 22 | 23 | @NotNull 24 | private final Project project; 25 | 26 | public AppSettingsConfigurableProvider(@NotNull Project project) { 27 | this.project = project; 28 | } 29 | 30 | @Override 31 | public @Nullable Configurable createConfigurable() { 32 | return new Settings(project); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/ui/Settings.form: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 |
127 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/ui/Settings.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.ui; 2 | 3 | import com.godfather1103.entity.ConfigEntity; 4 | import com.godfather1103.settings.AppSettings; 5 | import com.godfather1103.util.AESUtils; 6 | import com.godfather1103.util.JiraUtils; 7 | import com.godfather1103.util.StringUtils; 8 | import com.intellij.openapi.fileChooser.FileChooserDescriptor; 9 | import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; 10 | import com.intellij.openapi.options.Configurable; 11 | import com.intellij.openapi.project.Project; 12 | import com.intellij.openapi.ui.TextBrowseFolderListener; 13 | import com.intellij.openapi.ui.TextFieldWithBrowseButton; 14 | import io.vavr.control.Try; 15 | import org.jetbrains.annotations.Nullable; 16 | 17 | import javax.swing.*; 18 | import java.awt.event.ActionEvent; 19 | import java.io.File; 20 | import java.util.Objects; 21 | import java.util.Optional; 22 | import java.util.ResourceBundle; 23 | 24 | import static com.godfather1103.util.StringUtils.isEmpty; 25 | import static com.godfather1103.util.StringUtils.showString; 26 | 27 | /** 28 | *

Title: Godfather1103's Github

29 | *

Copyright: Copyright (c) 2018

30 | *

Company: https://github.com/godfather1103

31 | * 32 | * @author 作者: godfa E-mail: chuchuanbao@gmail.com 33 | * 创建时间:2018/11/3 23:29 34 | * @version 1.0 35 | * @since 1.0 36 | */ 37 | public class Settings implements Configurable { 38 | 39 | private final Project project; 40 | 41 | private final ResourceBundle bundle; 42 | 43 | public Settings(Project project) { 44 | this.project = project; 45 | this.bundle = ResourceBundle.getBundle("i18n/describe"); 46 | } 47 | 48 | private TextFieldWithBrowseButton ruleConfFilePath; 49 | private JPanel rootPanel; 50 | private JTextField jiraUsername; 51 | private JPasswordField jiraPassword; 52 | private JTextField jiraServer; 53 | private JComboBox scopeSelectedMode; 54 | private JTextField jqlContent; 55 | private JCheckBox updateToSystem; 56 | 57 | @Override 58 | public String getDisplayName() { 59 | return Optional.of(bundle.getString("display_name")) 60 | .filter(StringUtils::isNotEmpty) 61 | .orElse("Git Commit Configuration"); 62 | } 63 | 64 | @Nullable 65 | @Override 66 | public String getHelpTopic() { 67 | return null; 68 | } 69 | 70 | @Override 71 | public void disposeUIResources() { 72 | 73 | } 74 | 75 | @Nullable 76 | @Override 77 | public JComponent createComponent() { 78 | FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); 79 | ruleConfFilePath.addBrowseFolderListener(new TextBrowseFolderListener(descriptor) { 80 | @Override 81 | public void actionPerformed(ActionEvent e) { 82 | JFileChooser fc = new JFileChooser(); 83 | String current = ruleConfFilePath.getText(); 84 | if (!current.isEmpty()) { 85 | fc.setCurrentDirectory(new File(current)); 86 | } 87 | fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); 88 | fc.showOpenDialog(rootPanel); 89 | File file = fc.getSelectedFile(); 90 | String path = file == null ? "" : file.getAbsolutePath(); 91 | ruleConfFilePath.setText(path); 92 | } 93 | }); 94 | 95 | for (ConfigEntity.SelectedMode value : ConfigEntity.SelectedMode.values()) { 96 | scopeSelectedMode.addItem(value); 97 | } 98 | return rootPanel; 99 | } 100 | 101 | @Override 102 | public boolean isModified() { 103 | AppSettings.State state = Objects.requireNonNull(AppSettings.getInstance(project).getState()); 104 | String storedPath = showString(state.getPath()); 105 | String storedJiraServerAddress = showString(state.getJiraServer()); 106 | String storedJiraUserName = showString(state.getJiraUserName()); 107 | String storedJiraPassword = showString(state.getJiraPassword()); 108 | String storedJiraJql = showString(state.getJiraJql()); 109 | ConfigEntity.SelectedMode storedSelectedMode = ConfigEntity.SelectedMode.getByKey(state.getSelectedMode()) 110 | .orElse(ConfigEntity.SelectedMode.JIRAKEY); 111 | String uiPath = showString(ruleConfFilePath.getText()); 112 | String uiAddress = showString(jiraServer.getText()); 113 | String uiUserName = showString(jiraUsername.getText()); 114 | String uiPassword = Try.of(() -> AESUtils.encrypt(showString(jiraPassword.getPassword()))).getOrNull(); 115 | String uiJql = showString(jqlContent.getText()); 116 | ConfigEntity.SelectedMode uiSelectedMode = ConfigEntity.SelectedMode.JIRAKEY; 117 | if (scopeSelectedMode.getSelectedIndex() != -1) { 118 | uiSelectedMode = (ConfigEntity.SelectedMode) scopeSelectedMode.getSelectedItem(); 119 | } 120 | if (updateToSystem.isSelected()) { 121 | return true; 122 | } else if (!storedPath.equals(uiPath)) { 123 | return true; 124 | } else if (!storedJiraServerAddress.equals(uiAddress)) { 125 | return true; 126 | } else if (!storedJiraUserName.equals(uiUserName)) { 127 | return true; 128 | } else if (!storedJiraJql.equals(uiJql)) { 129 | return true; 130 | } else if (uiSelectedMode != storedSelectedMode) { 131 | return true; 132 | } else { 133 | return !storedJiraPassword.equals(uiPassword); 134 | } 135 | } 136 | 137 | 138 | @Override 139 | public void apply() { 140 | String server = showString(jiraServer.getText()); 141 | if (!isEmpty(server) && !JiraUtils.checkJiraServer(server)) { 142 | if (server.endsWith("/")) { 143 | server = server.substring(0, server.length() - 1); 144 | if (!JiraUtils.checkJiraServer(server)) { 145 | throw new RuntimeException("Jira Server[" + server + "] is Error!"); 146 | } else { 147 | jiraServer.setText(server); 148 | } 149 | } else { 150 | throw new RuntimeException("Jira Server[" + server + "] is Error!"); 151 | } 152 | } 153 | AppSettings.State state = Objects.requireNonNull(AppSettings.getInstance(project).getState()); 154 | state.setPath(showString(ruleConfFilePath.getText())); 155 | state.setJiraServer(showString(jiraServer.getText())); 156 | state.setJiraUserName(showString(jiraUsername.getText())); 157 | state.setJiraPassword(Try.of(() -> AESUtils.encrypt(showString(jiraPassword.getPassword()))).getOrNull()); 158 | state.setJiraJql(showString(jqlContent.getText())); 159 | if (scopeSelectedMode.getSelectedIndex() != -1) { 160 | state.setSelectedMode( 161 | Optional.ofNullable((ConfigEntity.SelectedMode) scopeSelectedMode.getSelectedItem()) 162 | .orElse(ConfigEntity.SelectedMode.JIRAKEY) 163 | .getKey() 164 | ); 165 | } 166 | state.setUseSystemConfig(project.isDefault()); 167 | state.setTemplateProject(project.isDefault()); 168 | // 默认工程强制更新全局信息 169 | if (updateToSystem.isSelected() || project.isDefault()) { 170 | state.applyToSystem(); 171 | updateToSystem.setSelected(false); 172 | } 173 | } 174 | 175 | @Override 176 | public void reset() { 177 | AppSettings.State state = Objects.requireNonNull(AppSettings.getInstance(project).getState()); 178 | ruleConfFilePath.setText(state.getPath()); 179 | jiraServer.setText(state.getJiraServer()); 180 | jiraUsername.setText(state.getJiraUserName()); 181 | jiraPassword.setText(Try.of(() -> showString(AESUtils.decrypt(state.getJiraPassword()))).getOrNull()); 182 | jqlContent.setText(state.getJiraJql()); 183 | scopeSelectedMode.setSelectedItem( 184 | ConfigEntity.SelectedMode.getByKey(state.getSelectedMode()) 185 | .orElse(ConfigEntity.SelectedMode.JIRAKEY) 186 | ); 187 | updateToSystem.setSelected(false); 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/util/AESUtils.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.util; 2 | 3 | 4 | import javax.crypto.Cipher; 5 | import javax.crypto.spec.IvParameterSpec; 6 | import javax.crypto.spec.SecretKeySpec; 7 | import java.nio.charset.StandardCharsets; 8 | import java.util.Base64; 9 | import java.util.Set; 10 | 11 | /** 12 | *

Title: Godfather1103's Github

13 | *

Copyright: Copyright (c) 2024

14 | *

Company: https://github.com/godfather1103

15 | * 类描述: 16 | * 17 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 18 | * @version 1.0 19 | * @date 创建时间:2024/11/1 18:17 20 | * @since 1.0 21 | */ 22 | public class AESUtils { 23 | 24 | private static final String ENC_KEY = "b2849e29970d4285bfc21f726c00eaeb"; 25 | private static final String IV = "1qaz!@#$2wsx%^&*"; 26 | private static final String ALGORITHM = "AES"; 27 | private static final String PADDING = "AES/CBC/PKCS5Padding"; 28 | private static final Set KEY_LENGTH = Set.of(16, 24, 32); 29 | 30 | /** 31 | * 加密
32 | * 33 | * @param sSrc 参数 34 | * @return 结果 35 | * @throws Exception 异常 36 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 37 | * @date 创建时间:2024/11/1 18:14 38 | */ 39 | public static String encrypt(String sSrc) throws Exception { 40 | return encrypt(sSrc, ENC_KEY); 41 | } 42 | 43 | /** 44 | * 加密
45 | * 46 | * @param sSrc 参数 47 | * @param sKey 参数 48 | * @return 结果 49 | * @throws Exception 异常 50 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 51 | * @date 创建时间:2024/11/1 18:14 52 | */ 53 | public static String encrypt(String sSrc, String sKey) throws Exception { 54 | if (StringUtils.isEmpty(sKey)) { 55 | throw new Exception("密钥不能为空"); 56 | } 57 | // 判断Key 58 | if (!KEY_LENGTH.contains(sKey.length())) { 59 | throw new Exception("密钥长度错误"); 60 | } 61 | SecretKeySpec skeySpec = new SecretKeySpec(sKey.getBytes(StandardCharsets.UTF_8), ALGORITHM); 62 | //"算法/模式/补码方式" 63 | Cipher cipher = Cipher.getInstance(PADDING); 64 | cipher.init(Cipher.ENCRYPT_MODE, skeySpec, new IvParameterSpec(IV.getBytes(StandardCharsets.UTF_8))); 65 | byte[] encrypted = cipher.doFinal(sSrc.getBytes(StandardCharsets.UTF_8)); 66 | //此处使用BASE64做转码功能,同时能起到2次加密的作用。 67 | return Base64.getEncoder().encodeToString(encrypted); 68 | } 69 | 70 | /** 71 | * 解密
72 | * 73 | * @param sSrc 参数 74 | * @return 结果 75 | * @throws Exception 异常 76 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 77 | * @date 创建时间:2024/11/1 18:15 78 | */ 79 | public static String decrypt(String sSrc) throws Exception { 80 | return decrypt(sSrc, ENC_KEY); 81 | } 82 | 83 | /** 84 | * 解密
85 | * 86 | * @param sSrc 参数 87 | * @param sKey 参数 88 | * @return 结果 89 | * @throws Exception 异常 90 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 91 | * @date 创建时间:2024/11/1 18:15 92 | */ 93 | public static String decrypt(String sSrc, String sKey) throws Exception { 94 | // 判断Key是否正确 95 | if (StringUtils.isEmpty(sKey)) { 96 | throw new Exception("密钥不能为空"); 97 | } 98 | // 判断Key 99 | if (!KEY_LENGTH.contains(sKey.length())) { 100 | throw new Exception("密钥长度错误"); 101 | } 102 | SecretKeySpec skeySpec = new SecretKeySpec(sKey.getBytes(StandardCharsets.UTF_8), ALGORITHM); 103 | Cipher cipher = Cipher.getInstance(PADDING); 104 | cipher.init(Cipher.DECRYPT_MODE, skeySpec, new IvParameterSpec(IV.getBytes(StandardCharsets.UTF_8))); 105 | //先用base64解密 106 | byte[] encrypted = Base64.getDecoder().decode(sSrc); 107 | byte[] original = cipher.doFinal(encrypted); 108 | return new String(original, StandardCharsets.UTF_8); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/util/HttpUtils.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.util; 2 | 3 | import io.vavr.Tuple2; 4 | import okhttp3.OkHttpClient; 5 | import okhttp3.Request; 6 | import okhttp3.Response; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | import java.io.IOException; 10 | import java.util.ResourceBundle; 11 | import java.util.concurrent.TimeUnit; 12 | 13 | /** 14 | *

Title: Godfather1103's Github

15 | *

Copyright: Copyright (c) 2020

16 | *

Company: https://github.com/godfather1103

17 | * 18 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 19 | * 创建时间:2020-09-03 13:14 20 | * @version 1.0 21 | * @since 1.0 22 | * HTTP工具 23 | */ 24 | public class HttpUtils { 25 | 26 | private final static OkHttpClient CLIENT = new OkHttpClient.Builder() 27 | .callTimeout(30, TimeUnit.SECONDS) 28 | .readTimeout(30, TimeUnit.SECONDS) 29 | .connectTimeout(30, TimeUnit.SECONDS) 30 | .build(); 31 | 32 | private final static ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("i18n/describe"); 33 | 34 | public static String execute(Request request) throws IOException { 35 | Response response = exec(request); 36 | if (response.isSuccessful()) { 37 | return response.body().string(); 38 | } else { 39 | String msg = String.format(RESOURCE_BUNDLE.getString("network_error") + " Url[%s],Code[%s]", request.url(), response.code()); 40 | throw new RuntimeException(msg); 41 | } 42 | } 43 | 44 | public static Response exec(Request request) throws IOException { 45 | return CLIENT.newCall(request).execute(); 46 | } 47 | 48 | public static Tuple2 checkNetwork(@NotNull String url) { 49 | if (StringUtils.isEmpty(url)) { 50 | throw new RuntimeException("URL is Empty!"); 51 | } 52 | Request request = new Request.Builder().url(url).build(); 53 | try { 54 | Response response = exec(request); 55 | return new Tuple2<>(response.isSuccessful(), response.code()); 56 | } catch (IOException e) { 57 | throw new RuntimeException(RESOURCE_BUNDLE.getString("network_error")); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/util/JiraUtils.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.util; 2 | 3 | import com.godfather1103.entity.JiraEntity; 4 | import com.google.gson.JsonArray; 5 | import com.google.gson.JsonObject; 6 | import com.google.gson.JsonParser; 7 | import io.vavr.Tuple2; 8 | import okhttp3.MediaType; 9 | import okhttp3.Request; 10 | import okhttp3.RequestBody; 11 | import org.jetbrains.annotations.NotNull; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | import java.util.Optional; 16 | import java.util.ResourceBundle; 17 | 18 | /** 19 | *

Title: Godfather1103's Github

20 | *

Copyright: Copyright (c) 2020

21 | *

Company: https://github.com/godfather1103

22 | * 23 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 24 | * 创建时间:2020-08-29 21:53 25 | * @version 1.0 26 | * @since 1.0 27 | * Jira相关工具类 28 | */ 29 | public class JiraUtils { 30 | private final static MediaType JSON = MediaType.parse("application/json"); 31 | 32 | private final static ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("i18n/describe"); 33 | 34 | public static Optional> getSession(@NotNull String server, @NotNull String userName, @NotNull String password) 35 | throws Exception { 36 | String url = server + "/rest/auth/1/session"; 37 | RequestBody body = buildUserInfoBody(userName, password); 38 | Request request = new Request.Builder() 39 | .url(url) 40 | .post(body) 41 | .build(); 42 | String response = HttpUtils.execute(request); 43 | JsonObject jsonObject = JsonParser.parseString(response).getAsJsonObject(); 44 | JsonObject session = jsonObject.get("session").getAsJsonObject(); 45 | return Optional.ofNullable(new Tuple2<>(session.get("name").getAsString(), session.get("value").getAsString())); 46 | } 47 | 48 | /** 49 | * 获取待处理的任务列表
50 | * 51 | * @param server 服务器地址 52 | * @param userName 用户名 53 | * @param password 密码 54 | * @return 相关列表 55 | * @throws Exception 查询列表过程中的异常 56 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 57 | * 创建时间:2020-08-29 21:56 58 | */ 59 | public static List getToDoList(@NotNull String server, @NotNull String userName, @NotNull String password) 60 | throws Exception { 61 | return getToDoList(server, userName, password, null); 62 | } 63 | 64 | /** 65 | * 获取待处理的任务列表
66 | * 67 | * @param server 服务器地址 68 | * @param userName 用户名 69 | * @param password 密码 70 | * @param jql 相关检索参数 71 | * @return 相关列表 72 | * @throws Exception 查询列表过程中的异常 73 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 74 | * 创建时间:2020-08-29 21:56 75 | */ 76 | public static List getToDoList(@NotNull String server, @NotNull String userName, @NotNull String password, String jql) 77 | throws Exception { 78 | if (jql == null || jql.trim().isEmpty()) { 79 | jql = "assignee=currentUser()+AND+resolution=Unresolved"; 80 | } 81 | String url = server + "/rest/api/2/search?jql=" + jql; 82 | Tuple2 session = getSession(server, userName, password).orElseThrow(() -> new RuntimeException(RESOURCE_BUNDLE.getString("jira_login_error"))); 83 | Request request = new Request.Builder() 84 | .url(url) 85 | .addHeader("Content-Type", "application/json") 86 | .addHeader("cookie", session._1() + "=" + session._2()) 87 | .build(); 88 | String response = HttpUtils.execute(request); 89 | JsonObject jsonObject = JsonParser.parseString(response).getAsJsonObject(); 90 | JsonArray issues = jsonObject.get("issues").getAsJsonArray(); 91 | List list = new ArrayList<>(issues.size()); 92 | issues.forEach(item -> { 93 | JsonObject issue = item.getAsJsonObject(); 94 | String key = issue.get("key").getAsString(); 95 | JsonObject fields = issue.getAsJsonObject("fields"); 96 | list.add(new JiraEntity(key, fields.get("summary").getAsString())); 97 | }); 98 | return list; 99 | } 100 | 101 | /** 102 | * 检测Jira服务器
103 | * 104 | * @param server 服务器地址 105 | * @return 检测结果 106 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 107 | * 创建时间:2020-09-03 13:13 108 | */ 109 | public static boolean checkJiraServer(@NotNull String server) { 110 | return HttpUtils.checkNetwork(server + "/rest/api/2/search")._1(); 111 | } 112 | 113 | private static RequestBody buildUserInfoBody(@NotNull String userName, @NotNull String password) { 114 | JsonObject user = new JsonObject(); 115 | user.addProperty("username", userName); 116 | user.addProperty("password", password); 117 | return RequestBody.create(JSON, user.toString()); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/util/NotificationCenter.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.util; 2 | 3 | import com.intellij.notification.Notification; 4 | import com.intellij.notification.NotificationType; 5 | import com.intellij.notification.Notifications; 6 | import com.intellij.openapi.ui.Messages; 7 | 8 | /** 9 | *

Title: Godfather1103's Github

10 | *

Copyright: Copyright (c) 2018

11 | *

Company: https://github.com/godfather1103

12 | * 13 | * @author 作者: godfa E-mail: chuchuanbao@gmail.com 14 | * 创建时间:2018/11/3 23:36 15 | * @version 1.0 16 | * @since 1.0 17 | */ 18 | public class NotificationCenter { 19 | 20 | public static int TYPE_INFO = 0; 21 | 22 | public static int TYPE_WARNING = 1; 23 | 24 | public static int TYPE_ERROR = 2; 25 | 26 | 27 | public static void notice(String message) { 28 | notice(message, NotificationType.INFORMATION); 29 | } 30 | 31 | public static void notice(String message, NotificationType type) { 32 | Notification n = new Notification( 33 | "extras", 34 | "Notice", 35 | message, 36 | type); 37 | Notifications.Bus.notify(n); 38 | } 39 | 40 | public static void noticeWindows(String title, String message) { 41 | noticeWindows(title, message, TYPE_INFO); 42 | } 43 | 44 | public static void noticeWindows(String title, String message, int nType) { 45 | if (nType == TYPE_ERROR) { 46 | Messages.showErrorDialog(message, title); 47 | } else if (nType == TYPE_WARNING) { 48 | Messages.showWarningDialog(message, title); 49 | } else { 50 | Messages.showInfoMessage(message, title); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/util/RuleCheckApp.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.util; 2 | 3 | import com.godfather1103.vo.CheckRuleVo; 4 | import com.google.gson.Gson; 5 | import com.google.gson.reflect.TypeToken; 6 | import org.apache.commons.io.FileUtils; 7 | 8 | import java.io.File; 9 | import java.io.IOException; 10 | import java.lang.reflect.Type; 11 | import java.util.ArrayList; 12 | 13 | /** 14 | *

Title: Godfather1103's Github

15 | *

Copyright: Copyright (c) 2024

16 | *

Company: https://github.com/godfather1103

17 | * RuleCheckApp 18 | * 19 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 20 | * @version 1.0 21 | * @date 创建时间:2024/2/6 14:15 22 | * @since 1.0 23 | */ 24 | public class RuleCheckApp { 25 | 26 | private static final String BASE_RULE = "[\n" + 27 | " {\n" + 28 | " \"matchPattern\": \"(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\\\\(\\\\S*\\\\))?:\\\\s.+\",\n" + 29 | " \"showMsg\": \"未包含feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert等关键词\"\n" + 30 | " }\n" + 31 | "]"; 32 | 33 | private ArrayList ruleCheckers; 34 | 35 | public ArrayList getRuleCheckers() { 36 | return ruleCheckers; 37 | } 38 | 39 | public void setRuleCheckers(ArrayList ruleCheckers) { 40 | this.ruleCheckers = ruleCheckers; 41 | } 42 | 43 | public RuleCheckApp() { 44 | init(BASE_RULE); 45 | } 46 | 47 | public RuleCheckApp(String configFilePath) { 48 | try { 49 | String s = FileUtils.readFileToString(new File(configFilePath), "UTF-8"); 50 | init(s); 51 | } catch (IOException e) { 52 | throw new RuntimeException(e); 53 | } 54 | } 55 | 56 | /** 57 | * init
58 | * 59 | * @param content 参数 60 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 61 | * @date 创建时间:2024/2/6 14:15 62 | */ 63 | private void init(String content) { 64 | String configContent = StringUtils.showString(content, BASE_RULE); 65 | Type type = new TypeToken>() { 66 | }.getType(); 67 | setRuleCheckers(new Gson().fromJson(configContent, type)); 68 | } 69 | 70 | 71 | /** 72 | * 检测方法
73 | * 74 | * @param text 被检测的结果 75 | * @throws Exception 相关检测的异常 76 | * @author 作者: godfa E-mail: chuchuanbao@gmail.com 77 | * 创建时间:2018/11/3 22:57 78 | */ 79 | public void check(String text) throws Exception { 80 | if (this.ruleCheckers == null) { 81 | throw new Exception("相关规则配置文件不存在!"); 82 | } else { 83 | for (CheckRuleVo ruleChecker : this.ruleCheckers) { 84 | ruleChecker.check(text); 85 | } 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/util/StringUtils.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.util; 2 | 3 | /** 4 | *

Title: Godfather1103's Github

5 | *

Copyright: Copyright (c) 2020

6 | *

Company: https://github.com/godfather1103

7 | * 8 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 9 | * 创建时间:2020-08-29 21:49 10 | * @version 1.0 11 | * @since 1.0 12 | * 字符串相关的工具类 13 | */ 14 | public class StringUtils { 15 | 16 | /** 17 | * 显示字符串,如果为空返回空串
18 | * 19 | * @param str 待处理的字符串 20 | * @return 处理后的结果 21 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 22 | * 创建时间:2020-08-29 21:49 23 | */ 24 | public static String showString(String str) { 25 | return showString(str, ""); 26 | } 27 | 28 | public static String showString(String str, String defaultValue) { 29 | if (isEmpty(str)) { 30 | return defaultValue; 31 | } else { 32 | return str.trim(); 33 | } 34 | } 35 | 36 | /** 37 | * 显示字符串,如果为空返回空串
38 | * 39 | * @param str 待处理的字符数组 40 | * @return 处理后的结果 41 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 42 | * 创建时间:2020-08-29 21:49 43 | */ 44 | public static String showString(char[] str) { 45 | if (str == null || str.length == 0) { 46 | return ""; 47 | } else { 48 | return new String(str); 49 | } 50 | } 51 | 52 | /** 53 | * 判断字符串是否为空
54 | * 55 | * @param str 待处理的字符串 56 | * @return 判断结果 57 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 58 | * 创建时间:2020-08-29 21:50 59 | */ 60 | public static boolean isEmpty(String str) { 61 | return str == null || str.trim().isEmpty(); 62 | } 63 | 64 | public static boolean isNotEmpty(String str) { 65 | return !isEmpty(str); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/godfather1103/vo/CheckRuleVo.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.vo; 2 | 3 | import java.io.Serializable; 4 | import java.util.regex.Matcher; 5 | import java.util.regex.Pattern; 6 | 7 | /** 8 | *

Title: Godfather1103's Github

9 | *

Copyright: Copyright (c) 2024

10 | *

Company: https://github.com/godfather1103

11 | * CheckRuleVo 12 | * 13 | * @author 作者: Jack Chu E-mail: chuchuanbao@gmail.com 14 | * @version 1.0 15 | * @date 创建时间:2024/2/6 13:56 16 | * @since 1.0 17 | */ 18 | public class CheckRuleVo implements Serializable { 19 | 20 | private String matchPattern; 21 | 22 | private String showMsg; 23 | 24 | public String getMatchPattern() { 25 | return matchPattern; 26 | } 27 | 28 | public void setMatchPattern(String matchPattern) { 29 | this.matchPattern = matchPattern; 30 | } 31 | 32 | public String getShowMsg() { 33 | return showMsg; 34 | } 35 | 36 | public void setShowMsg(String showMsg) { 37 | this.showMsg = showMsg; 38 | } 39 | 40 | public void check(String match) throws Exception { 41 | Pattern pattern = Pattern.compile(getMatchPattern()); 42 | Matcher matcher = pattern.matcher(match); 43 | if (!matcher.find()) { 44 | throw new Exception(getShowMsg()); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/leroymerlin/commit/ChangeType.java: -------------------------------------------------------------------------------- 1 | package com.leroymerlin.commit; 2 | 3 | /** 4 | * From https://github.com/commitizen/conventional-commit-types 5 | * 6 | * @author Damien Arrachequesne 7 | */ 8 | public enum ChangeType { 9 | 10 | FEAT("Features", "A new feature"), 11 | FIX("Bug Fixes", "A bug fix"), 12 | DOCS("Documentation", "Documentation only changes"), 13 | STYLE("Styles", "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)"), 14 | REFACTOR("Code Refactoring", "A code change that neither fixes a bug nor adds a feature"), 15 | PERF("Performance Improvements", "A code change that improves performance"), 16 | TEST("Tests", "Adding missing tests or correcting existing tests"), 17 | BUILD("Builds", "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)"), 18 | CI("Continuous Integrations", "Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)"), 19 | CHORE("Chores", "Other changes that don't modify src or test files"), 20 | REVERT("Reverts", "Reverts a previous commit"); 21 | 22 | public final String title; 23 | public final String description; 24 | 25 | ChangeType(String title, String description) { 26 | this.title = title; 27 | this.description = description; 28 | } 29 | 30 | public String label() { 31 | return this.name().toLowerCase(); 32 | } 33 | 34 | @Override 35 | public String toString() { 36 | return String.format("%s - %s", this.label(), this.description); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/leroymerlin/commit/CommitDialog.java: -------------------------------------------------------------------------------- 1 | package com.leroymerlin.commit; 2 | 3 | import com.godfather1103.util.StringUtils; 4 | import com.intellij.openapi.project.Project; 5 | import com.intellij.openapi.ui.DialogWrapper; 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import javax.swing.*; 9 | 10 | /** 11 | * @author Damien Arrachequesne 12 | */ 13 | public class CommitDialog extends DialogWrapper { 14 | 15 | private final CommitPanel panel; 16 | 17 | CommitDialog(@Nullable Project project) { 18 | super(project); 19 | panel = new CommitPanel(project); 20 | setTitle("Commit"); 21 | setOKButtonText("OK"); 22 | init(); 23 | } 24 | 25 | @Nullable 26 | @Override 27 | protected JComponent createCenterPanel() { 28 | return panel.getMainPanel(); 29 | } 30 | 31 | String getCommitMessage() { 32 | return String.format("%s(%s): %s%n%n%s%s%s", 33 | panel.getChangeType(), 34 | panel.getChangeScope(), 35 | panel.getShortDescription(), 36 | getLongDescription(), 37 | getBreakingChanges(), 38 | getClosedIssues()); 39 | } 40 | 41 | private String getLongDescription() { 42 | return breakLines(panel.getLongDescription(), 100); 43 | } 44 | 45 | private String getBreakingChanges() { 46 | if (StringUtils.isEmpty(panel.getBreakingChanges())) { 47 | return ""; 48 | } 49 | return String.format("%n%n%s", "BREAKING CHANGE: " + panel.getBreakingChanges()); 50 | } 51 | 52 | private String getClosedIssues() { 53 | if (StringUtils.isEmpty(panel.getClosedIssues())) { 54 | return ""; 55 | } 56 | return String.format("%n%n%s", "Closes " + panel.getClosedIssues()); 57 | } 58 | 59 | private static String breakLines(String input, int maxLineLength) { 60 | String[] tokens = input.split(" "); 61 | StringBuilder output = new StringBuilder(input.length()); 62 | int lineLength = 0; 63 | for (int i = 0; i < tokens.length; i++) { 64 | String word = tokens[i]; 65 | 66 | boolean shouldAddNewLine = lineLength + (" " + word).length() > maxLineLength; 67 | if (shouldAddNewLine) { 68 | if (i > 0) { 69 | output.append(System.lineSeparator()); 70 | } 71 | lineLength = 0; 72 | } 73 | boolean shouldAddSpace = i < tokens.length - 1 && 74 | (lineLength + (word + " ").length() + tokens[i + 1].length() <= maxLineLength); 75 | if (shouldAddSpace) { 76 | word += " "; 77 | } 78 | output.append(word); 79 | lineLength += word.length(); 80 | } 81 | return output.toString(); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/leroymerlin/commit/CommitPanel.form: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 |
118 | -------------------------------------------------------------------------------- /src/main/java/com/leroymerlin/commit/CommitPanel.java: -------------------------------------------------------------------------------- 1 | package com.leroymerlin.commit; 2 | 3 | import com.godfather1103.entity.ConfigEntity; 4 | import com.godfather1103.entity.JiraEntity; 5 | import com.godfather1103.settings.AppSettings; 6 | import com.godfather1103.util.JiraUtils; 7 | import com.godfather1103.util.NotificationCenter; 8 | import com.intellij.notification.NotificationType; 9 | import com.intellij.openapi.project.Project; 10 | 11 | import javax.swing.*; 12 | import java.awt.*; 13 | import java.awt.event.ItemEvent; 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | import java.util.Objects; 17 | import java.util.Optional; 18 | 19 | /** 20 | * @author Damien Arrachequesne 21 | */ 22 | public class CommitPanel { 23 | private JPanel mainPanel; 24 | private JComboBox changeType; 25 | private JComboBox changeScope; 26 | private JTextField shortDescription; 27 | private JTextArea longDescription; 28 | private JTextField closedIssues; 29 | private JTextField breakingChanges; 30 | 31 | private Optional configEntity; 32 | 33 | private List fonts; 34 | 35 | private synchronized void initFonts() { 36 | String[] data = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); 37 | int style = longDescription.getFont().getStyle(); 38 | int size = longDescription.getFont().getSize(); 39 | fonts = new ArrayList<>(data.length); 40 | for (String s : data) { 41 | fonts.add(new Font(s, style, size)); 42 | } 43 | longDescription.addCaretListener(e -> { 44 | JTextArea ja = (JTextArea) e.getSource(); 45 | String text = ja.getText(); 46 | Font jaFont = ja.getFont(); 47 | if (jaFont.canDisplayUpTo(text) != -1) { 48 | for (Font font : fonts) { 49 | if (font.canDisplayUpTo(text) == -1) { 50 | ja.setFont(font); 51 | break; 52 | } 53 | } 54 | } 55 | }); 56 | } 57 | 58 | CommitPanel(Project project) { 59 | for (ChangeType type : ChangeType.values()) { 60 | changeType.addItem(type); 61 | } 62 | configEntity = ConfigEntity.getEntity(Objects.requireNonNull(AppSettings.getInstance(project).getState())); 63 | if (configEntity.isPresent() && configEntity.get().isOpenJira()) { 64 | ConfigEntity config = configEntity.get(); 65 | try { 66 | List toDoList = null; 67 | try { 68 | toDoList = JiraUtils.getToDoList(config.getJiraServer(), config.getJiraUserName(), config.getJiraPassword(), config.getJiraJQL()); 69 | } catch (Exception ex) { 70 | ex.printStackTrace(); 71 | NotificationCenter.notice(ex.getMessage(), NotificationType.ERROR); 72 | } 73 | if (toDoList != null) { 74 | toDoList.forEach(changeScope::addItem); 75 | } 76 | changeScope.setSelectedIndex(-1); 77 | if (config.getSelectedMode() == ConfigEntity.SelectedMode.JIRAKEY 78 | || config.getSelectedMode() == ConfigEntity.SelectedMode.JIRASUMMARY) { 79 | changeScope.addItemListener(e -> { 80 | if (e.getStateChange() == ItemEvent.SELECTED) { 81 | Object item = e.getItem(); 82 | if (item instanceof JiraEntity) { 83 | JiraEntity entity = (JiraEntity) item; 84 | if (config.getSelectedMode() == ConfigEntity.SelectedMode.JIRAKEY) { 85 | changeScope.setSelectedItem(entity.getKey()); 86 | } else if (config.getSelectedMode() == ConfigEntity.SelectedMode.JIRASUMMARY) { 87 | changeScope.setSelectedItem(entity.getSummary()); 88 | } 89 | } 90 | } 91 | }); 92 | } 93 | changeScope.setRenderer( 94 | new ListCellRenderer() { 95 | 96 | private ListCellRenderer renderer = changeScope.getRenderer(); 97 | 98 | @Override 99 | public Component getListCellRendererComponent(JList list, 100 | Object value, int index, boolean isSelected, boolean cellHasFocus) { 101 | Component component = renderer.getListCellRendererComponent( 102 | list, value, index, isSelected, cellHasFocus); 103 | if (component instanceof JLabel) { 104 | JLabel label = (JLabel) component; 105 | label.setToolTipText(label.getText()); 106 | } 107 | return component; 108 | } 109 | } 110 | ); 111 | } catch (Exception exception) { 112 | exception.printStackTrace(); 113 | NotificationCenter.notice(exception.getMessage(), NotificationType.ERROR); 114 | } 115 | } 116 | initFonts(); 117 | } 118 | 119 | JPanel getMainPanel() { 120 | return mainPanel; 121 | } 122 | 123 | String getChangeType() { 124 | ChangeType type = (ChangeType) changeType.getSelectedItem(); 125 | return type.label(); 126 | } 127 | 128 | String getChangeScope() { 129 | if (changeScope.getSelectedItem() == null) { 130 | return ""; 131 | } 132 | if (changeScope.getSelectedIndex() == -1) { 133 | return changeScope.getSelectedItem().toString(); 134 | } else { 135 | if (configEntity.isPresent() && configEntity.get().isOpenJira()) { 136 | ConfigEntity config = configEntity.get(); 137 | if (config.getSelectedMode() == ConfigEntity.SelectedMode.SEE) { 138 | return changeScope.getSelectedItem().toString(); 139 | } else if (config.getSelectedMode() == ConfigEntity.SelectedMode.JIRASUMMARY) { 140 | return ((JiraEntity) changeScope.getSelectedItem()).getSummary(); 141 | } 142 | return ((JiraEntity) changeScope.getSelectedItem()).getKey(); 143 | } else { 144 | return changeScope.getSelectedItem().toString(); 145 | } 146 | } 147 | } 148 | 149 | String getShortDescription() { 150 | return shortDescription.getText().trim(); 151 | } 152 | 153 | String getLongDescription() { 154 | return longDescription.getText().trim(); 155 | } 156 | 157 | String getBreakingChanges() { 158 | return breakingChanges.getText().trim(); 159 | } 160 | 161 | String getClosedIssues() { 162 | return closedIssues.getText().trim(); 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /src/main/java/com/leroymerlin/commit/CreateCommitAction.java: -------------------------------------------------------------------------------- 1 | package com.leroymerlin.commit; 2 | 3 | import com.intellij.openapi.actionSystem.AnAction; 4 | import com.intellij.openapi.actionSystem.AnActionEvent; 5 | import com.intellij.openapi.project.DumbAware; 6 | import com.intellij.openapi.ui.DialogWrapper; 7 | import com.intellij.openapi.vcs.CommitMessageI; 8 | import com.intellij.openapi.vcs.VcsDataKeys; 9 | import com.intellij.openapi.vcs.ui.Refreshable; 10 | import org.jetbrains.annotations.Nullable; 11 | 12 | /** 13 | * @author Damien Arrachequesne 14 | */ 15 | public class CreateCommitAction extends AnAction implements DumbAware { 16 | 17 | @Override 18 | public void actionPerformed(AnActionEvent actionEvent) { 19 | final CommitMessageI commitPanel = getCommitPanel(actionEvent); 20 | if (commitPanel == null) { 21 | return; 22 | } 23 | 24 | CommitDialog dialog = new CommitDialog(actionEvent.getProject()); 25 | dialog.show(); 26 | if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) { 27 | commitPanel.setCommitMessage(dialog.getCommitMessage()); 28 | } 29 | } 30 | 31 | @Nullable 32 | private static CommitMessageI getCommitPanel(@Nullable AnActionEvent e) { 33 | if (e == null) { 34 | return null; 35 | } 36 | Refreshable data = Refreshable.PANEL_KEY.getData(e.getDataContext()); 37 | if (data instanceof CommitMessageI) { 38 | return (CommitMessageI) data; 39 | } 40 | return VcsDataKeys.COMMIT_MESSAGE_CONTROL.getData(e.getDataContext()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | commit-template-check-plugin 3 | Git Commit Template Check 4 | 5 | Jack Chu 6 | 7 | English Readme: 9 |

Create a commit message with the following template,It also provides the operation of checking the format of commit:

10 |
 11 | <type>(<scope>): <subject>
 12 | <BLANK LINE>
 13 | <body>
 14 | <BLANK LINE>
 15 | <footer>
 16 | 
17 |

Starting from version 1.7.7, it supports adding JIRA information to scope.

18 |

The plug-in is based on Git Commit Template

19 | 20 |

中文说明:

21 |

该插件可以按照如下模板去生成commit的内容,并提供了检测commit的格式的操作:

22 |
 23 | <type>(<scope>): <subject>
 24 | <BLANK LINE>
 25 | <body>
 26 | <BLANK LINE>
 27 | <footer>
 28 | 
29 |

从1.7.7版本开始支持添加jira信息到scope中。

30 |

该插件是在Git Commit Template的基础上开发完成

31 | 32 |

捐赠(Donate)

33 |
 34 | 你的馈赠将助力我更好的去贡献,谢谢!
 35 | Your gift will help me to contribute better, thank you!
 36 | 
 37 | PayPal
 38 | 
 39 | 支付宝(Alipay)
 40 | 支付宝
 41 | 支付宝
 42 | 
 43 | 
 44 | 微信(WeChat)
 45 | 微信支付
 46 | 
47 | ]]>
48 | 49 | 50 | 52 | 1.8.2 53 |
  • remove Deprecated method
  • 54 |
  • 移除过时的方法调用
  • 55 | 56 |
      57 | 1.8.1 58 |
    • remove Deprecated method
    • 59 |
    • 移除过时的方法调用
    • 60 |
    61 |
      62 | 1.8.0 63 |
    • custom jql
    • 64 |
    • 增加自定义JQL的操作
    • 65 |
    66 |
      67 | 1.7.9 68 |
    • remove Deprecated method,update IDEA version to 2020.2
    • 69 |
    • 移除过时的方法调用,升级IDEA版本到2020.2
    • 70 |
    • A prompt box is added to the item in the scope to display the long content
    • 71 |
    • scope中item增加提示框,用于显示过长的内容
    • 72 |
    73 |
      74 | 1.7.8 75 |
    • Fix NullPointerException when scope is not selected
    • 76 |
    • 修复Scope未选择时报空指针异常
    • 77 |
    • Change the authentication method when obtaining the JIRA list
    • 78 |
    • 更改JIRA列表的获取时的认证方式
    • 79 |
    • Fixed the bug of getting JIRA list from non-ascii characters account
    • 80 |
    • 修复非ascii码账户获取JIRA列表报错的问题
    • 81 |
    82 |
      83 | 1.7.7 84 |
    • Support adding JIRA to scope
    • 85 |
    • 支持添加jira信息到scope中
    • 86 |
    87 |
      88 | 1.7.6 89 |
    • Upgrade tool version
    • 90 |
    • 升级校验工具版本
    • 91 |
    92 |
      93 | 1.7.5 94 |
    • Region adaptation for description information
    • 95 |
    • 描述信息的区域自适应
    • 96 |
    97 | ]]> 98 |
    99 | 100 | 101 | 102 | com.intellij.modules.vcs 103 | 104 | 105 | 106 | 114 | 115 | 116 | 117 | 118 | 122 | 123 | 124 | 125 | 126 |
    -------------------------------------------------------------------------------- /src/main/resources/META-INF/pluginIcon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 34 | 35 | -------------------------------------------------------------------------------- /src/main/resources/i18n/describe.properties: -------------------------------------------------------------------------------- 1 | check_label_message=Check the commit message 2 | detection_result=detection result 3 | display_name=Git Commit Configuration 4 | rule_file_path=Rule file path 5 | jira_server=Jira Server Address 6 | jira_username=Jira UserName 7 | jira_password=Jira Password 8 | scope_selected_mode=scope selected mode 9 | see_mode=What you see is what you get 10 | jira_key_mode=input jira key 11 | jira_summary_mode=input jira summary 12 | network_error=Network Error! 13 | jira_login_error=Jira Login Error! 14 | jql_desc=jira query language,default:"assignee=currentUser()+AND+resolution=Unresolved" 15 | jql_label=jira query language 16 | upadte_to_system=Whether to update the configuration to the default configuration? 17 | -------------------------------------------------------------------------------- /src/main/resources/i18n/describe_zh_CN.properties: -------------------------------------------------------------------------------- 1 | check_label_message=\u68C0\u6D4B\u63D0\u4EA4\u7684\u4FE1\u606F 2 | detection_result=\u68C0\u6D4B\u7ED3\u679C\u63D0\u9192 3 | display_name=Git Commit \u63D2\u4EF6\u914D\u7F6E 4 | rule_file_path=\u89C4\u5219\u6587\u4EF6\u8DEF\u5F84 5 | jira_password=Jira\u5BC6\u7801 6 | jira_server=Jira\u670D\u52A1\u5668\u5730\u5740 7 | jira_username=Jira\u7528\u6237\u540D 8 | scope_selected_mode=scope\u586B\u5145\u5185\u5BB9 9 | see_mode=\u6240\u89C1\u5373\u6240\u5F97 10 | jira_key_mode=\u586B\u5145Jira\u7684Key 11 | jira_summary_mode=\u586B\u5145Jira\u7684\u6458\u8981 12 | network_error=\u7F51\u7EDC\u5F02\u5E38\uFF01 13 | jira_login_error=Jira\u767B\u5F55\u5F02\u5E38\uFF01 14 | jql_desc=Jira\u67E5\u8BE2\u8BED\u53E5\uFF0C\u9ED8\u8BA4\u503C\u4E3A\uFF1Aassignee=currentUser()+AND+resolution=Unresolved 15 | jql_label=jira\u67E5\u8BE2\u8BED\u53E5 16 | upadte_to_system=\u662F\u5426\u66F4\u65B0\u914D\u7F6E\u5230\u9ED8\u8BA4\u914D\u7F6E\u4E2D 17 | -------------------------------------------------------------------------------- /src/main/resources/icons/load.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/src/main/resources/icons/load.png -------------------------------------------------------------------------------- /src/test/java/com/godfather1103/util/AESUtilsTest.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.util; 2 | 3 | import junit.framework.TestCase; 4 | 5 | public class AESUtilsTest extends TestCase { 6 | 7 | public void testEncrypt() throws Exception { 8 | String info = "中华人民共和国🇨🇳"; 9 | String enc = AESUtils.encrypt(info); 10 | System.out.println("加密结果:" + enc); 11 | System.out.println("解密结果:" + AESUtils.decrypt(enc)); 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /src/test/java/com/godfather1103/util/JiraUtilsTest.java: -------------------------------------------------------------------------------- 1 | package com.godfather1103.util; 2 | 3 | import com.godfather1103.entity.JiraEntity; 4 | import io.vavr.Tuple2; 5 | import org.junit.Test; 6 | 7 | import java.util.List; 8 | import java.util.Optional; 9 | 10 | import static org.junit.Assert.fail; 11 | 12 | public class JiraUtilsTest { 13 | 14 | @Test 15 | public void getToDoList() { 16 | try { 17 | List r = JiraUtils.getToDoList(System.getenv("JIRA_SERVER"), System.getenv("JIRA_USERNAME"), System.getenv("JIRA_PASSWORD")); 18 | System.out.println(r.size()); 19 | r = JiraUtils.getToDoList(System.getenv("JIRA_SERVER"), System.getenv("JIRA_USERNAME"), System.getenv("JIRA_PASSWORD"),"project+=+XJRB+AND+resolution+=+Unresolved+AND+due+<=+1d+AND+assignee+in+(currentUser())"); 20 | System.out.println(r.size()); 21 | } catch (Exception e) { 22 | e.printStackTrace(); 23 | fail("getToDoList异常"); 24 | } 25 | } 26 | 27 | @Test 28 | public void getSession() { 29 | try { 30 | Optional> session = JiraUtils.getSession(System.getenv("JIRA_SERVER"), System.getenv("JIRA_USERNAME"), System.getenv("JIRA_PASSWORD")); 31 | System.out.println(session.orElse(new Tuple2<>("", ""))); 32 | } catch (Exception e) { 33 | e.printStackTrace(); 34 | fail("getSession异常"); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /template.check.commit.style.rule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "matchPattern": "(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\\(\\S*\\))?:\\s.+", 4 | "showMsg": "未包含feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert等关键词" 5 | } 6 | ] -------------------------------------------------------------------------------- /tools/marketplace-zip-signer-cli.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/godfather1103/commit-template-check-plugin/966a5d0a7c42bfbbb0b287c0fedcd3f7ca46ed81/tools/marketplace-zip-signer-cli.jar --------------------------------------------------------------------------------