Momo Code Sec Inspector 插件使用教程
1. 项目的目录结构及介绍
Momo Code Sec Inspector 是一个用于 IntelliJ IDEA 的静态代码安全审计插件。项目的目录结构如下:
src
├── main
│ ├── java
│ │ └── com
│ │ └── immomo
│ │ └── momosec
│ │ ├── aspect
│ │ ├── entity
│ │ ├── fix
│ │ ├── lang
│ │ │ ├── java
│ │ │ │ ├── rule
│ │ │ │ │ └── momosecurity
│ │ │ │ │ └── [InspectionName].java
│ │ │ │ └── utils
│ │ │ └── xml
│ │ │ └── rule
│ │ │ └── momosecurity
│ │ │ └── [InspectionName].java
│ │ └── utils
│ └── resources
│ ├── META-INF
│ │ ├── description.html
│ │ ├── pluginIcon.svg
│ │ └── plugin.xml
│ └── inspectionDescriptions
│ └── [InspectionName].html
└── test
├── java
│ └── com
│ └── immomo
│ └── momosec
│ └── lang
│ ├── java
│ │ ├── fix
│ │ └── rule
│ │ └── momosecurity
│ │ └── [InspectionName]Test.java
│ └── xml
│ └── rule
│ └── momosecurity
│ └── [InspectionName]Test.java
├── resources
└── testData
└── lang
├── java
│ └── rule
目录结构介绍
src/main/java
:包含插件的主要代码,分为多个包,如aspect
、entity
、fix
、lang
等。src/main/resources
:包含插件的资源文件,如META-INF
目录下的配置文件和图标,以及检查描述文件。src/test
:包含插件的测试代码和测试数据。
2. 项目的启动文件介绍
插件的启动文件主要位于 src/main/resources/META-INF/plugin.xml
。这个文件是插件的配置文件,定义了插件的基本信息、扩展点和插件行为。
plugin.xml 文件介绍
<idea-plugin>
<id>com.immomo.momosec.momo-code-sec-inspector</id>
<name>Momo Code Sec Inspector</name>
<version>1.0</version>
<vendor email="support@example.com" url="http://www.example.com">Your Company</vendor>
<description><![CDATA[
Add your plugin description here.
]]></description>
<change-notes><![CDATA[
Add your change notes here.
]]></change-notes>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="183.0"/>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html on how to target different products -->
<!-- uncomment to enable plugin in all products -->
<!-- <depends>com.intellij.modules.lang</depends> -->
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
</extensions>
<actions>
<!-- Add your actions here -->
</actions>
</idea-plugin>
启动文件功能
<id>
:插件的唯一标识符。<name>
:插件的名称。<version>
:插件的版本号。<vendor>
:插件的提供者信息。<description>
:插件的描述信息。<change-notes>
:插件的变更记录。<idea-version>
:插件支持的 IntelliJ IDEA 版本。<extensions>
:插件的扩展点。<actions>
:插件的自定义操作