From 6af21ef2db90d8cc0692f8c8528f163182516529 Mon Sep 17 00:00:00 2001
From: wuhaoyang <2507865306@qq.com>
Date: Fri, 19 Jan 2024 18:31:25 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=87=86=E5=88=99:=E9=81=BF?=
=?UTF-8?q?=E5=85=8D=E5=9C=A8=E5=AE=B9=E6=98=93=E5=8F=97=E6=94=BB=E5=87=BB?=
=?UTF-8?q?=E7=9A=84=E5=9C=B0=E6=96=B9=E5=AD=98=E5=82=A8=E5=8F=A3=E4=BB=A4?=
=?UTF-8?q?=E3=80=82=E5=A6=82=E6=9E=9C=E9=9C=80=E8=A6=81=EF=BC=8C=E5=BA=94?=
=?UTF-8?q?=E5=AD=98=E5=82=A8=E5=8F=A3=E4=BB=A4=E7=9A=84=E5=8A=A0=E5=AF=86?=
=?UTF-8?q?hash=E5=80=BC=EF=BC=8C=E4=BB=A5=E6=9B=BF=E4=BB=A3=E6=98=8E?=
=?UTF-8?q?=E6=96=87=E5=8F=A3=E4=BB=A4=E5=AD=98=E5=82=A8=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sonar-keyware-plugins-cxx/pom.xml | 11 +-
.../sonar/cxx/ConfigurationFileLanguage.java | 30 ++
.../java/com/keyware/sonar/cxx/CxxPlugin.java | 1 +
.../com/keyware/sonar/cxx/CxxSquidSensor.java | 4 +-
.../checkers/ConfigurationFileChecker.java | 265 ++++++++++++++++++
.../ConfigurationFileCheckerTest.java | 72 +++++
.../configFile/ConfigurationFileChecker.conf | 3 +
.../configFile/ConfigurationFileChecker.ini | 3 +
.../configFile/ConfigurationFileChecker.json | 5 +
.../ConfigurationFileChecker.properties | 2 +
.../configFile/ConfigurationFileChecker.xml | 7 +
.../configFile/ConfigurationFileChecker.yml | 3 +
12 files changed, 403 insertions(+), 3 deletions(-)
create mode 100644 sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/ConfigurationFileLanguage.java
create mode 100644 sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/rules/checkers/ConfigurationFileChecker.java
create mode 100644 sonar-keyware-plugins-cxx/src/test/java/com/keyware/sonar/cxx/rules/checkers/ConfigurationFileCheckerTest.java
create mode 100644 sonar-keyware-plugins-cxx/src/test/resources/com/keyware/sonar/cxx/rules/checkers/configFile/ConfigurationFileChecker.conf
create mode 100644 sonar-keyware-plugins-cxx/src/test/resources/com/keyware/sonar/cxx/rules/checkers/configFile/ConfigurationFileChecker.ini
create mode 100644 sonar-keyware-plugins-cxx/src/test/resources/com/keyware/sonar/cxx/rules/checkers/configFile/ConfigurationFileChecker.json
create mode 100644 sonar-keyware-plugins-cxx/src/test/resources/com/keyware/sonar/cxx/rules/checkers/configFile/ConfigurationFileChecker.properties
create mode 100644 sonar-keyware-plugins-cxx/src/test/resources/com/keyware/sonar/cxx/rules/checkers/configFile/ConfigurationFileChecker.xml
create mode 100644 sonar-keyware-plugins-cxx/src/test/resources/com/keyware/sonar/cxx/rules/checkers/configFile/ConfigurationFileChecker.yml
diff --git a/sonar-keyware-plugins-cxx/pom.xml b/sonar-keyware-plugins-cxx/pom.xml
index 7baecb8..7cb658c 100644
--- a/sonar-keyware-plugins-cxx/pom.xml
+++ b/sonar-keyware-plugins-cxx/pom.xml
@@ -82,7 +82,16 @@
sslr-core
${sonar-cxx.versin}
-
+
+ org.yaml
+ snakeyaml
+ 1.28
+
+
+ springframework
+ spring
+ 1.2.6
+
com.google.code.findbugs
jsr305
diff --git a/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/ConfigurationFileLanguage.java b/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/ConfigurationFileLanguage.java
new file mode 100644
index 0000000..87e8107
--- /dev/null
+++ b/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/ConfigurationFileLanguage.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2023 - 2024. KeyWare.Co.Ltd All rights reserved.
+ * 项目名称:C++ 信息安全性设计准则
+ * 项目描述:用于检查C++源代码的安全性设计准则的Sonarqube插件
+ * 版权说明:本软件属北京关键科技股份有限公司所有,在未获得北京关键科技股份有限公司正式授权情况下,任何企业和个人,不能获取、阅读、安装、传播本软件涉及的任何受知识产权保护的内容。
+ */
+
+
+package com.keyware.sonar.cxx;
+
+import org.sonar.api.resources.AbstractLanguage;
+
+import java.lang.module.Configuration;
+
+public final class ConfigurationFileLanguage extends AbstractLanguage {
+
+ public static final String NAME = "Configuration";
+ public static final String KEY = "cfg";
+ private final Configuration config;
+
+ public ConfigurationFileLanguage (Configuration config) {
+ super(KEY, NAME);
+ this.config = config;
+ }
+
+ @Override
+ public String[] getFileSuffixes() {
+ return new String[] {".yml", ".properties", ".ini",".conf" ,".xml" ,".json"};
+ }
+}
diff --git a/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/CxxPlugin.java b/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/CxxPlugin.java
index 28008d5..91d2e69 100644
--- a/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/CxxPlugin.java
+++ b/sonar-keyware-plugins-cxx/src/main/java/com/keyware/sonar/cxx/CxxPlugin.java
@@ -99,6 +99,7 @@ public final class CxxPlugin implements Plugin {
var l = new ArrayList