调整工程结构

wuhaoyang
Guo XIn 11 months ago
parent 81e40159b1
commit 02d782f556
  1. 3
      .gitignore
  2. 37
      pom.xml
  3. 30
      sonar-dependencies/pom.xml
  4. 1
      sonar-dependencies/sonar-cxx
  5. 1
      sonar-dependencies/sonar-java
  6. 110
      sonar-keyware-plugins-cxx/pom.xml
  7. 0
      sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/CxxSecurityDesignRulesPlugin.java
  8. 8
      sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/CxxSecurityDesignRulesRepository.java
  9. 0
      sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/checkers/DemoChecker.java
  10. 0
      sonar-keyware-plugins-cxx/src/main/resources/license-header.txt
  11. 35
      sonar-keyware-plugins-java/pom.xml
  12. 0
      sonar-keyware-plugins-java/src/main/java/com/keyware/sonar/java/JavaSecurityDesignRulesPlugin.java
  13. 0
      sonar-keyware-plugins-java/src/main/java/com/keyware/sonar/java/rules/JavaFileCheckRegistrar.java
  14. 0
      sonar-keyware-plugins-java/src/main/java/com/keyware/sonar/java/rules/JavaSecurityDesignRulesRepository.java
  15. 0
      sonar-keyware-plugins-java/src/main/java/com/keyware/sonar/java/rules/RulesList.java
  16. 0
      sonar-keyware-plugins-java/src/main/java/com/keyware/sonar/java/rules/checkers/ABCVarNameChecker.java
  17. 0
      sonar-keyware-plugins-java/src/main/resources/license-header.txt
  18. 0
      sonar-keyware-plugins-java/src/main/resources/org/sonar/l10n/java/rules/java/ABCVarNameChecker.html
  19. 0
      sonar-keyware-plugins-java/src/main/resources/org/sonar/l10n/java/rules/java/ABCVarNameChecker.json
  20. 0
      sonar-keyware-plugins-java/src/test/files/ABCVarNameRule.java
  21. 0
      sonar-keyware-plugins-java/src/test/java/com/keyware/sonar/java/JavaSecurityDesignRulesPluginTest.java
  22. 0
      sonar-keyware-plugins-java/src/test/java/com/keyware/sonar/java/rules/JavaFileCheckRegistrarTest.java
  23. 0
      sonar-keyware-plugins-java/src/test/java/com/keyware/sonar/java/rules/JavaSecurityDesignRulesRepositoryTest.java
  24. 0
      sonar-keyware-plugins-java/src/test/java/com/keyware/sonar/java/rules/checkers/ABCVarNameCheckerTest.java
  25. 0
      sonar-keyware-plugins-java/src/test/java/com/keyware/sonar/java/utils/FilesUtils.java
  26. 22
      sonar-keyware-plugins/pom.xml
  27. BIN
      sonar-keyware-plugins/sonar-keyware-plugins-cxx/libs/cxx-sslr-toolkit-2.1.1.488.jar
  28. BIN
      sonar-keyware-plugins/sonar-keyware-plugins-cxx/libs/sonar-cxx-plugin-2.1.1.488.jar

3
.gitignore vendored

@ -35,4 +35,5 @@ build/
.vscode/ .vscode/
### Mac OS ### ### Mac OS ###
.DS_Store .DS_Store
/*/dependency-reduced-pom.xml

@ -11,18 +11,49 @@
<groupId>com.keyware.sonar</groupId> <groupId>com.keyware.sonar</groupId>
<artifactId>sonar-keyware</artifactId> <artifactId>sonar-keyware</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<licenses>
<license>
<name>Keyware Private Terms</name>
<distribution>user must manually download and install the dependency.</distribution>
</license>
</licenses>
<organization>
<name>北京关键科技股份有限公司</name>
<url>http://www.keyware.cn</url>
</organization>
<url>http://www.keyware.cn</url>
<scm>
<connection>scm:git:http://www.keyware.cn</connection>
<developerConnection>scm:git:http://www.keyware.cn</developerConnection>
<url>http://www.keyware.cn</url>
<tag>-</tag>
</scm>
<developers>
<developer><id>guoxin</id><name>GuoXin</name><organization>Keyware</organization></developer>
<developer><id>renfengjiang</id><name>RenFengJiang</name><organization>Keyware</organization></developer>
<developer><id>renfengshan</id><name>RenFengShan</name><organization>Keyware</organization></developer>
<developer><id>wuhaoyang</id><name>WuHaoYang</name><organization>Keyware</organization></developer>
<developer><id>zhangchenbao</id><name>ZhangChenBao</name><organization>Keyware</organization></developer>
</developers>
<properties> <properties>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<aggregate.report.dir>integration-tests/target/site/jacoco-aggregate/jacoco.xml</aggregate.report.dir>
</properties> </properties>
<modules> <modules>
<module>sonar-dependencies</module> <module>sonar-keyware-plugins-cxx</module>
<module>sonar-keyware-plugins</module> <module>sonar-keyware-plugins-java</module>
</modules> </modules>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.keyware.sonar</groupId>
<artifactId>sonar-keyware</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>sonar-dependencies</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<!--<module>sonar-cxx</module>-->
<module>sonar-java</module>
</modules>
<properties>
</properties>
<dependencyManagement>
<dependencies>
</dependencies>
</dependencyManagement>
</project>

@ -1 +0,0 @@
Subproject commit dd3c88c7343f3a44c5172dc4499b361dda028d85

@ -1 +0,0 @@
Subproject commit 0d3165c6aebe18052b1d97893a2e3da85e6d9b41

@ -6,41 +6,27 @@
<parent> <parent>
<groupId>com.keyware.sonar</groupId> <groupId>com.keyware.sonar</groupId>
<artifactId>sonar-keyware-plugins</artifactId> <artifactId>sonar-keyware</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0</version>
</parent> </parent>
<name>C++ 信息安全性设计准则</name> <name>C++ 信息安全性设计准则</name>
<artifactId>sonar-keyware-plugins-cxx</artifactId> <artifactId>sonar-keyware-plugins-cxx</artifactId>
<version>1.0</version>
<packaging>sonar-plugin</packaging> <packaging>sonar-plugin</packaging>
<version>1.0-SNAPSHOT</version>
<description>用于检查C++源代码的安全性设计准则的Sonarqube插件</description> <description>用于检查C++源代码的安全性设计准则的Sonarqube插件</description>
<licenses>
<license>
<name>Keyware Private Terms</name>
<distribution>user must manually download and install the dependency.</distribution>
</license>
</licenses>
<organization>
<name>北京关键科技股份有限公司</name>
<url>http://www.keyware.cn</url>
</organization>
<url>http://www.keyware.cn</url>
<scm>
<connection>scm:git:http://www.keyware.cn</connection>
<developerConnection>scm:git:http://www.keyware.cn</developerConnection>
<url>http://www.keyware.cn</url>
<tag>-</tag>
</scm>
<properties> <properties>
<sonar.artifact.path>target/${project.artifactId}-${project.version}.jar</sonar.artifact.path>
<sonar.pluginClass>com.keyware.sonar.cxx.CxxSecurityDesignPlugin</sonar.pluginClass>
<sonar.pluginName>C++ 信息安全性设计准则</sonar.pluginName>
<!-- in addition, a dependency must be set in 'integration-tests/pom.xml' to aggregate the results -->
<sonar.coverage.jacoco.xmlReportPaths>${basedir}/../${aggregate.report.dir}</sonar.coverage.jacoco.xmlReportPaths>
<java.version>11</java.version> <java.version>11</java.version>
<commons-io.version>2.15.1</commons-io.version> <commons-io.version>2.15.1</commons-io.version>
<commons-lang.version>2.6</commons-lang.version> <commons-lang.version>2.6</commons-lang.version>
<sonar-cxx.versin>2.1.2-SNAPSHOT</sonar-cxx.versin>
<!-- we depend on API ${sonar.version} but we keep backward compatibility with LTS --> <!-- we depend on API ${sonar.version} but we keep backward compatibility with LTS -->
<sonar.version>9.9.0.65466</sonar.version> <sonar.version>9.9.0.65466</sonar.version>
<sonar.plugin.api.version>9.14.0.375</sonar.plugin.api.version> <sonar.plugin.api.version>9.14.0.375</sonar.plugin.api.version>
@ -56,82 +42,77 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.sonarsource.sonarqube-plugins.cxx</groupId> <groupId>org.sonarsource.api.plugin</groupId>
<artifactId>cxx-sslr-toolkit</artifactId> <artifactId>sonar-plugin-api</artifactId>
<systemPath>${project.basedir}/libs/cxx-sslr-toolkit-2.1.1.488.jar</systemPath> <scope>provided</scope>
<version>2.1.1.488</version> </dependency>
<scope>system</scope> <dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-plugin-api-impl</artifactId>
<scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.sonarsource.sonarqube-plugins.cxx</groupId> <groupId>org.sonarsource.sonarqube-plugins.cxx</groupId>
<artifactId>sonar-cxx-plugin</artifactId> <artifactId>sonar-cxx-plugin</artifactId>
<systemPath>${project.basedir}/libs/sonar-cxx-plugin-2.1.1.488.jar</systemPath> <version>${sonar-cxx.versin}</version>
<version>2.1.1.488</version> <scope>provided</scope>
<!--<type>sonar-plugin</type>-->
<scope>system</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.sonarsource.api.plugin</groupId> <groupId>org.sonarsource.sonarqube-plugins.cxx</groupId>
<artifactId>sonar-plugin-api</artifactId> <artifactId>cxx-squid</artifactId>
<version>${sonar.plugin.api.version}</version> <version>${sonar-cxx.versin}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.sonarsource.sonarqube</groupId> <groupId>org.sonarsource.sonarqube-plugins.cxx</groupId>
<artifactId>sonar-plugin-api-impl</artifactId> <artifactId>cxx-checks</artifactId>
<version>${sonar.version}</version> <version>${sonar-cxx.versin}</version>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>org.sonarsource.sonarqube-plugins.cxx</groupId>
<artifactId>commons-io</artifactId> <artifactId>cxx-sensors</artifactId>
<version>${commons-io.version}</version> <version>${sonar-cxx.versin}</version>
<scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-lang</groupId> <groupId>org.sonarsource.sonarqube-plugins.cxx</groupId>
<artifactId>commons-lang</artifactId> <artifactId>cxx-squid-bridge</artifactId>
<version>${commons-lang.version}</version> <version>${sonar-cxx.versin}</version>
</dependency> </dependency>
<dependency>
<groupId>org.sonarsource.sonarqube-plugins.cxx</groupId>
<artifactId>sslr-core</artifactId>
<version>${sonar-cxx.versin}</version>
</dependency>
<dependency> <dependency>
<groupId>com.google.code.findbugs</groupId> <groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId> <artifactId>jsr305</artifactId>
<version>${jsr305.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId> <artifactId>mockito-core</artifactId>
<version>${mockito-core.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.assertj</groupId> <groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId> <artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId> <artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -142,8 +123,15 @@
<plugin> <plugin>
<groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId> <groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
<artifactId>sonar-packaging-maven-plugin</artifactId> <artifactId>sonar-packaging-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration> <configuration>
<sonarQubeMinVersion>${sonarQubeMinVersion}</sonarQubeMinVersion> <pluginKey>keywareCxxPlugin</pluginKey>
<pluginName>C++ 安全性设计准则</pluginName>
<pluginClass>com.keyware.sonar.cxx.CxxSecurityDesignRulesPlugin</pluginClass>
<sonarLintSupported>true</sonarLintSupported>
<skipDependenciesPackaging>true</skipDependenciesPackaging>
<pluginApiMinVersion>9.14.0.375</pluginApiMinVersion>
<requirePlugins>java:${project.version}</requirePlugins>
</configuration> </configuration>
</plugin> </plugin>
@ -165,6 +153,8 @@
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
<resources> <resources>
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>

@ -10,7 +10,6 @@ import org.sonar.api.SonarEdition;
import org.sonar.api.SonarProduct; import org.sonar.api.SonarProduct;
import org.sonar.api.SonarQubeSide; import org.sonar.api.SonarQubeSide;
import org.sonar.api.SonarRuntime; import org.sonar.api.SonarRuntime;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.resources.Language; import org.sonar.api.resources.Language;
import org.sonar.api.server.rule.RulesDefinition; import org.sonar.api.server.rule.RulesDefinition;
import org.sonar.api.utils.Version; import org.sonar.api.utils.Version;
@ -49,7 +48,6 @@ public class CxxSecurityDesignRulesRepository extends CustomCxxRulesDefinition {
RulesDefinition.NewRepository repository = context.createRepository(REPOSITORY_KEY, "cxx").setName(REPOSITORY_NAME); RulesDefinition.NewRepository repository = context.createRepository(REPOSITORY_KEY, "cxx").setName(REPOSITORY_NAME);
setTemplates(repository); setTemplates(repository);
repository.done(); repository.done();
@ -57,7 +55,11 @@ public class CxxSecurityDesignRulesRepository extends CustomCxxRulesDefinition {
@Override @Override
public Language getLanguage() { public Language getLanguage() {
return new CxxLanguage(new MapSettings().asConfig()); return new CxxLanguage(null) {
public String[] getFileSuffixes() {
return new String[]{".cxx", ".cpp", ".cc", ".c", ".hxx", ".hpp", ".hh", ".h"};
}
};
} }
@Override @Override

@ -6,45 +6,16 @@
<parent> <parent>
<groupId>com.keyware.sonar</groupId> <groupId>com.keyware.sonar</groupId>
<artifactId>sonar-keyware-plugins</artifactId> <artifactId>sonar-keyware</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0</version>
</parent> </parent>
<name>Java 信息安全性设计准则</name> <name>Java 信息安全性设计准则</name>
<artifactId>sonar-keyware-plugins-java</artifactId> <artifactId>sonar-keyware-plugins-java</artifactId>
<packaging>sonar-plugin</packaging> <packaging>sonar-plugin</packaging>
<version>1.0-SNAPSHOT</version> <version>1.0</version>
<description>用于检查Java源代码的安全性设计准则的Sonarqube插件</description> <description>用于检查Java源代码的安全性设计准则的Sonarqube插件</description>
<licenses>
<license>
<name>Keyware Private Terms</name>
<distribution>user must manually download and install the dependency.</distribution>
</license>
</licenses>
<organization>
<name>北京关键科技股份有限公司</name>
<url>http://www.keyware.cn</url>
</organization>
<url>http://www.keyware.cn</url>
<scm>
<connection>scm:git:http://www.keyware.cn</connection>
<developerConnection>scm:git:http://www.keyware.cn</developerConnection>
<url>http://www.keyware.cn</url>
<tag>-</tag>
</scm>
<developers>
<developer><id>guoxin</id><name>GuoXin</name><organization>Keyware</organization></developer>
<developer><id>renfengjiang</id><name>RenFengJiang</name><organization>Keyware</organization></developer>
<developer><id>renfengshan</id><name>RenFengShan</name><organization>Keyware</organization></developer>
<developer><id>wuhaoyang</id><name>WuHaoYang</name><organization>Keyware</organization></developer>
<developer><id>zhangchenbao</id><name>ZhangChenBao</name><organization>Keyware</organization></developer>
</developers>
<properties> <properties>
<jacoco.version>0.8.10</jacoco.version> <jacoco.version>0.8.10</jacoco.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.keyware.sonar</groupId>
<artifactId>sonar-keyware</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>sonar-keyware-plugins</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>sonar-keyware-plugins-java</module>
<module>sonar-keyware-plugins-cxx</module>
</modules>
</project>
Loading…
Cancel
Save