Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
inspect
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
912协同工作系统
项目监控管理工具
inspect
Commits
4a996493
提交
4a996493
authored
3月 04, 2020
作者:
马晨俊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mcj:修改变量名称,删除无用注释
上级
4b753e73
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
95 行增加
和
90 行删除
+95
-90
InspectController.java
...n/java/com/zjty/inspect/controller/InspectController.java
+3
-3
InspectParameter.java
src/main/java/com/zjty/inspect/entity/InspectParameter.java
+5
-2
Report.java
src/main/java/com/zjty/inspect/entity/Report.java
+1
-1
Warn.java
src/main/java/com/zjty/inspect/entity/Warn.java
+0
-6
InspectServiceImpl.java
...ava/com/zjty/inspect/service/impl/InspectServiceImpl.java
+3
-1
task.java
src/main/java/com/zjty/inspect/task/task.java
+12
-11
AnalysisFile.java
src/main/java/com/zjty/inspect/utils/AnalysisFile.java
+0
-1
FileUtil.java
src/main/java/com/zjty/inspect/utils/FileUtil.java
+9
-9
GitLabUtil.java
src/main/java/com/zjty/inspect/utils/GitLabUtil.java
+13
-4
Inspector.java
src/main/java/com/zjty/inspect/utils/Inspector.java
+49
-52
没有找到文件。
src/main/java/com/zjty/inspect/controller/InspectController.java
浏览文件 @
4a996493
...
...
@@ -55,10 +55,10 @@ public class InspectController {
inspectParameter
.
setDisaster
(
disaster
);
inspectParameter
.
setData
(
data
);
inspectParameter
.
setFramework
(
framework
);
inspectParameter
.
setPath
(
file
.
getPath
());
inspectParameter
.
setPath
(
file
.
get
Canonical
Path
());
inspectParameter
.
setId
(
UUIDUtil
.
getUUID
());
ReportVo
reportVo
=
new
ReportVo
();
reportVo
.
setSourceAddress
(
file
.
getPath
());
reportVo
.
setSourceAddress
(
file
.
get
Canonical
Path
());
ReportVo
inspect
=
inspectService
.
inspect
(
reportVo
,
inspectParameter
);
return
ResponseEntity
.
ok
(
inspect
);
}
...
...
@@ -70,7 +70,7 @@ public class InspectController {
*/
@PostMapping
(
"/git"
)
public
ResponseEntity
inspect1
(
@RequestBody
InspectParameter
inspectParameter
){
String
path
=
GitLabUtil
.
downLoadProject
(
inspectParameter
.
getGitAddress
());
String
path
=
GitLabUtil
.
downLoadProject
(
inspectParameter
.
getGitAddress
()
,
inspectParameter
.
getGitName
()
);
inspectParameter
.
setId
(
UUIDUtil
.
getUUID
());
ReportVo
report1
=
new
ReportVo
();
report1
.
setSourceAddress
(
path
);
...
...
src/main/java/com/zjty/inspect/entity/InspectParameter.java
浏览文件 @
4a996493
...
...
@@ -6,8 +6,6 @@ import lombok.NoArgsConstructor;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 传入参数表
...
...
@@ -99,6 +97,11 @@ public class InspectParameter {
*/
private
String
gitAddress
;
/**
* 项目名称
*/
private
String
gitName
;
/**
* 源代码存储地址
*/
...
...
src/main/java/com/zjty/inspect/entity/Report.java
浏览文件 @
4a996493
...
...
@@ -78,6 +78,6 @@ public class Report {
MAVEN
,
GRADLE
,
ANT
}
public
enum
Language
{
JAVA
,
PYTHON
,
CPP
,
JSP
,
ASP
,
ONLYVIEW
,
UNKNOW
,
JAVASCRIPT
,
GO
,
VUE
JAVA
,
PYTHON
,
CPP
,
JSP
,
ASP
,
ONLYVIEW
,
UNKNOW
,
JAVASCRIPT
,
GO
,
VUE
,
HTML
}
}
src/main/java/com/zjty/inspect/entity/Warn.java
浏览文件 @
4a996493
...
...
@@ -12,13 +12,7 @@ import javax.persistence.Id;
*/
@Data
@Entity
public
class
Warn
{
/**
* 主键id
*/
@Id
private
String
id
;
/**
* 发现问题的文件地址
...
...
src/main/java/com/zjty/inspect/service/impl/InspectServiceImpl.java
浏览文件 @
4a996493
...
...
@@ -26,6 +26,7 @@ public class InspectServiceImpl implements InspectService {
@Transactional
@Override
public
ReportVo
inspect
(
ReportVo
reportVo
,
InspectParameter
inspectParameter
)
{
//统计文件后缀数量
Map
<
String
,
Report
.
Language
>
suffixLanguageMapping
=
new
HashMap
<>();
suffixLanguageMapping
.
put
(
"java"
,
Report
.
Language
.
JAVA
);
suffixLanguageMapping
.
put
(
"vue"
,
Report
.
Language
.
VUE
);
...
...
@@ -33,10 +34,11 @@ public class InspectServiceImpl implements InspectService {
suffixLanguageMapping
.
put
(
"py"
,
Report
.
Language
.
PYTHON
);
suffixLanguageMapping
.
put
(
"jsp"
,
Report
.
Language
.
JSP
);
suffixLanguageMapping
.
put
(
"go"
,
Report
.
Language
.
GO
);
suffixLanguageMapping
.
put
(
"js"
,
Report
.
Language
.
JAVASCRIPT
);
suffixLanguageMapping
.
put
(
"html"
,
Report
.
Language
.
HTML
);
inspector
.
setInspectParameter
(
inspectParameter
);
inspector
.
setReport
(
reportVo
);
inspector
.
setSuffixLanguageMapping
(
suffixLanguageMapping
);
inspector
.
setPath
(
inspectParameter
.
getPath
());
ReportVo
report
=
inspector
.
inspect
();
return
report
;
}
...
...
src/main/java/com/zjty/inspect/task/task.java
浏览文件 @
4a996493
...
...
@@ -48,8 +48,8 @@ public class task implements CommandLineRunner {
coefficientModel
.
setScale
(
1
);
coefficientModel
.
setId
(
UUIDUtil
.
getUUID
());
coefficientModel
.
setName
(
"安全能力"
);
coefficientModel
.
setMin
(
0
);
coefficientModel
.
setMax
(
2
);
coefficientModel
.
setMin
(
1
);
coefficientModel
.
setMax
(
3
);
coefficientModel
.
setBelowCoefficient
(
0
D
);
coefficientModel
.
setMediumCoefficient
(
0.1
);
coefficientModel
.
setTopCoefficient
(
0.2
);
...
...
@@ -58,8 +58,8 @@ public class task implements CommandLineRunner {
coefficientMode2
.
setScale
(
2
);
coefficientMode2
.
setId
(
UUIDUtil
.
getUUID
());
coefficientMode2
.
setName
(
"安全能力"
);
coefficientMode2
.
setMin
(
0
);
coefficientMode2
.
setMax
(
2
);
coefficientMode2
.
setMin
(
1
);
coefficientMode2
.
setMax
(
3
);
coefficientMode2
.
setBelowCoefficient
(-
0.1
);
coefficientMode2
.
setMediumCoefficient
(
0
D
);
coefficientMode2
.
setTopCoefficient
(
0.1
);
...
...
@@ -68,8 +68,8 @@ public class task implements CommandLineRunner {
coefficientMode3
.
setScale
(
3
);
coefficientMode3
.
setId
(
UUIDUtil
.
getUUID
());
coefficientMode3
.
setName
(
"安全能力"
);
coefficientMode3
.
setMin
(
0
);
coefficientMode3
.
setMax
(
2
);
coefficientMode3
.
setMin
(
1
);
coefficientMode3
.
setMax
(
3
);
coefficientMode3
.
setBelowCoefficient
(-
0.2
);
coefficientMode3
.
setMediumCoefficient
(-
0.1
);
coefficientMode3
.
setTopCoefficient
(
0
D
);
...
...
@@ -78,7 +78,7 @@ public class task implements CommandLineRunner {
coefficientMode4
.
setScale
(
1
);
coefficientMode4
.
setId
(
UUIDUtil
.
getUUID
());
coefficientMode4
.
setName
(
"容灾能力"
);
coefficientMode4
.
setMin
(
0
);
coefficientMode4
.
setMin
(
1
);
coefficientMode4
.
setMax
(
2
);
coefficientMode4
.
setBelowCoefficient
(
0
D
);
coefficientMode4
.
setMediumCoefficient
(
0
D
);
...
...
@@ -88,8 +88,8 @@ public class task implements CommandLineRunner {
coefficientMode5
.
setScale
(
2
);
coefficientMode5
.
setId
(
UUIDUtil
.
getUUID
());
coefficientMode5
.
setName
(
"容灾能力"
);
coefficientMode5
.
setMin
(
0
);
coefficientMode5
.
setMax
(
2
);
coefficientMode5
.
setMin
(
1
);
coefficientMode5
.
setMax
(
3
);
coefficientMode5
.
setBelowCoefficient
(
0.05
);
coefficientMode5
.
setMediumCoefficient
(
0
D
);
coefficientMode5
.
setTopCoefficient
(
0
D
);
...
...
@@ -128,13 +128,14 @@ public class task implements CommandLineRunner {
coefficientMode7
.
setScale
(
3
);
coefficientMode7
.
setId
(
UUIDUtil
.
getUUID
());
coefficientMode7
.
setName
(
"容灾能力"
);
coefficientMode7
.
setMin
(
0
);
coefficientMode7
.
setMax
(
2
);
coefficientMode7
.
setMin
(
1
);
coefficientMode7
.
setMax
(
3
);
coefficientMode7
.
setBelowCoefficient
(-
0.1
);
coefficientMode7
.
setMediumCoefficient
(
0
D
);
coefficientMode7
.
setTopCoefficient
(
0
D
);
coefficientModels
.
add
(
coefficientMode6
);
coefficientModels
.
add
(
coefficientMode5
);
coefficientModels
.
add
(
coefficientMode4
);
...
...
src/main/java/com/zjty/inspect/utils/AnalysisFile.java
浏览文件 @
4a996493
...
...
@@ -95,7 +95,6 @@ public class AnalysisFile {
warn
.
setLineNum
(
i
);
warn
.
setTechnologyId
(
rule
.
getTechnologyId
());
warn
.
setRuleId
(
rule
.
getId
());
warn
.
setId
(
UUIDUtil
.
getUUID
());
warns
.
add
(
warn
);
}
}
...
...
src/main/java/com/zjty/inspect/utils/FileUtil.java
浏览文件 @
4a996493
...
...
@@ -28,6 +28,8 @@ public class FileUtil {
* @throws IOException
*/
public
static
File
saveToLocal
(
MultipartFile
multipartFile
)
throws
IOException
{
String
name
=
LocalDate
.
now
().
toString
();
String
[]
split1
=
UUIDUtil
.
getUUID
().
split
(
"-"
);
// 获取文件名
String
fileName
=
multipartFile
.
getOriginalFilename
();
// 获取文件后缀
...
...
@@ -36,16 +38,16 @@ public class FileUtil {
final
File
excelFile
=
File
.
createTempFile
(
LocalDateTime
.
now
()+
fileName
,
prefix
);
// MultipartFile to File
multipartFile
.
transferTo
(
excelFile
);
if
(
prefix
.
equals
(
".zip"
)){
FileUtil
.
unPackZip
(
excelFile
,
""
,
"./"
);
FileUtil
.
unPackZip
(
excelFile
,
""
,
"./"
+
name
+
"/"
+
split1
[
0
]
);
}
else
{
FileUtil
.
unPackRar
(
excelFile
,
"./"
);
FileUtil
.
unPackRar
(
excelFile
,
"./"
+
name
+
"/"
+
split1
[
0
]
);
}
String
[]
split
=
fileName
.
split
(
"\\."
);
File
file3
=
new
File
(
"./"
+
split
[
0
]);
File
file3
=
new
File
(
"./"
+
name
+
"/"
+
split1
[
0
]+
"/"
+
split
[
0
]);
excelFile
.
delete
();
log
.
info
(
"end unpack file"
);
System
.
out
.
println
(
file3
.
getCanonicalPath
());
return
file3
;
}
...
...
@@ -114,11 +116,9 @@ public class FileUtil {
public
static
void
main
(
String
[]
args
)
throws
IOException
{
File
file
=
new
File
(
"/Users/mcj/Downloads/acq-server.zip"
);
String
[]
split
=
file
.
getName
().
split
(
"\\."
);
System
.
out
.
println
(
split
[
0
]);
System
.
out
.
println
(
file
.
getName
());
System
.
out
.
println
(
LocalDate
.
now
().
toString
());
String
[]
split1
=
UUIDUtil
.
getUUID
().
split
(
"-"
);
System
.
out
.
println
(
split1
[
0
]);
// FileUtil.unPackZip(new File("/Users/mcj/Downloads/acq-server.zip"),"", "./");
//FileUtils.deleteDirectory(new File("./acq-server"));
SAXReader
reader
=
new
SAXReader
();
...
...
src/main/java/com/zjty/inspect/utils/GitLabUtil.java
浏览文件 @
4a996493
...
...
@@ -6,6 +6,8 @@ import org.eclipse.jgit.api.errors.GitAPIException;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
import
java.io.IOException
;
import
java.time.LocalDate
;
/**
* @author Mcj
...
...
@@ -14,19 +16,26 @@ import java.io.File;
@Component
public
class
GitLabUtil
{
public
static
String
downLoadProject
(
String
path
)
{
public
static
String
downLoadProject
(
String
path
,
String
name
)
{
String
name1
=
LocalDate
.
now
().
toString
();
String
[]
split1
=
UUIDUtil
.
getUUID
().
split
(
"-"
);
//String REMOTE_URL = "https://git.yfzx.zjtys.com.cn:8888/912-system/monitor/adaptation-master.git";
CloneCommand
cloneCommand
=
Git
.
cloneRepository
();
cloneCommand
.
setURI
(
path
);
// cloneCommand.setCredentialsProvider(mcj
);
File
file
=
new
File
(
"./"
);
File
file
=
new
File
(
"./"
+
name1
+
"/"
+
split1
[
0
]+
"/"
+
name
);
file
.
mkdirs
(
);
cloneCommand
.
setDirectory
(
file
);
try
{
cloneCommand
.
call
();
}
catch
(
GitAPIException
e
)
{
e
.
printStackTrace
();
}
return
file
.
getPath
();
try
{
return
file
.
getCanonicalPath
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
file
.
getAbsolutePath
();
}
}
...
...
src/main/java/com/zjty/inspect/utils/Inspector.java
浏览文件 @
4a996493
...
...
@@ -45,12 +45,23 @@ public class Inspector {
private
ArrayList
<
Rule
>
rules
=
new
ArrayList
<
Rule
>();
private
ArrayList
<
Warn
>
warns
=
new
ArrayList
<>();
/**
* 添加规则时去重使用
* key:mysql-connect:*
* value:随意
*/
private
HashMap
<
String
,
Rule
>
ruleMap
=
new
HashMap
<>();
Technology
technology
;
Technology
technology1
;
/**
* 利率参数
* 支持的国产化技术
*/
Technology
techJavaSupport
;
/**
* 不支持的国产化技术
*/
Technology
techNotCnSupport
;
/**
* 计算预算的参数对象
*/
private
InspectParameter
inspectParameter
;
...
...
@@ -60,18 +71,18 @@ public class Inspector {
private
ReportVo
report
;
/**
* 语言
* 统计语言
* key:java
* value:10
*/
private
Map
<
String
,
Counter
>
languageMatchMap
=
new
HashMap
<>();
/**
* 后缀语言
* key:properties
* value:[{/Users/path},{/Users/path}]
*/
private
Map
<
String
,
Report
.
Language
>
suffixLanguageMapping
=
new
HashMap
<>();
/**
* 路径
*/
private
String
path
;
/**
* 规则列表
...
...
@@ -97,41 +108,48 @@ public class Inspector {
* @return 报告
*/
public
ReportVo
inspect
()
{
technology
=
technologyDao
.
findAllByTechnologyNameEquals
(
"Java依赖"
);
technology1
=
technologyDao
.
findAllByTechnologyNameEquals
(
"非国产化依赖"
);
for
(
String
s
:
suffixLanguageMapping
.
keySet
())
{
//查询技术,构造支持与非支持技术对象
techJavaSupport
=
technologyDao
.
findAllByTechnologyNameEquals
(
"Java依赖"
);
techNotCnSupport
=
technologyDao
.
findAllByTechnologyNameEquals
(
"非国产化依赖"
);
//统计项目组成文件构成
for
(
String
languageName
:
suffixLanguageMapping
.
keySet
())
{
//配置如:java,0
languageMatchMap
.
put
(
s
,
new
Counter
());
languageMatchMap
.
put
(
languageName
,
new
Counter
());
}
/**
* 如果存在html文件,不一定是前端代码,
* 如果只存在html文件,不存在其他类型文件,大概率是前端代码
* 策略:
* 先检测是否存在html文件,如果存在,假定为前端项目
* 然后检测其他条件,如果符合,将假定冲掉
*/
//统计文件地址
this
.
configFileTypePathsMapping
=
new
HashMap
<>();
configFileTypePathsMapping
.
put
(
"xml"
,
new
ArrayList
<>());
configFileTypePathsMapping
.
put
(
"json"
,
new
ArrayList
<>());
configFileTypePathsMapping
.
put
(
"gradle"
,
new
ArrayList
<>());
configFileTypePathsMapping
.
put
(
"properties"
,
new
ArrayList
<>());
configFileTypePathsMapping
.
put
(
"yml"
,
new
ArrayList
<>());
//查询所有规则
this
.
ruleList
=
ruleDao
.
findAll
();
for
(
Rule
rule
:
ruleList
)
{
if
(!
ruleSuffixMap
.
containsKey
(
rule
.
getSuffix
()))
{
//用于存储各种后缀的文件集合
ruleSuffixMap
.
put
(
rule
.
getSuffix
(),
new
ArrayList
<>());
//将每个后缀的规则分类
//key:规则后缀
//value:规则集合
ruleSuffixList
.
put
(
rule
.
getSuffix
(),
new
ArrayList
<>());
ruleSuffixList
.
get
(
rule
.
getSuffix
()).
add
(
rule
);
}
else
{
ruleSuffixList
.
get
(
rule
.
getSuffix
()).
add
(
rule
);
}
//规则添加时去重使用,mysql-connect:*
ruleMap
.
put
(
rule
.
getTarget
()+
":"
+
rule
.
getSuffix
(),
rule
);
}
try
{
//以下为计算文件名称匹配正则表达式
FileSystem
aDefault
=
FileSystems
.
getDefault
();
Map
<
String
,
PathMatcher
>
languageSuffixMatcherMapping
=
new
HashMap
<>(
16
);
//构造各个语言后缀文件的正则表达式
for
(
String
s
:
suffixLanguageMapping
.
keySet
())
{
languageSuffixMatcherMapping
.
put
(
s
,
aDefault
.
getPathMatcher
(
"glob:**/*."
+
s
));
}
...
...
@@ -143,22 +161,11 @@ public class Inspector {
for
(
String
s
:
ruleSuffixMap
.
keySet
())
{
ruleSuffix
.
put
(
aDefault
.
getPathMatcher
(
"glob:**/*."
+
s
),
s
);
}
/// TODO: 2020-02-12
// WebSocketServer.sendIn(uuid,TimeUtil.getNowDate() + " 项目评估:" + "开始读取项目文件");
Files
.
walkFileTree
(
Paths
.
get
(
path
),
new
FileVisitor
<
Path
>()
{
/**
* 统计某个后缀出现的次数
* @param dir
* @param attrs
* @return
* @throws IOException
*/
//文件读取
Files
.
walkFileTree
(
Paths
.
get
(
inspectParameter
.
getPath
()),
new
FileVisitor
<
Path
>()
{
@Override
public
FileVisitResult
preVisitDirectory
(
Path
dir
,
BasicFileAttributes
attrs
)
throws
IOException
{
/**
* 这里是对于路径(文件夹)的过滤,在这里读不到文件
* 如果能判断,可以返回FileVisitResult.SKIP_SUBTREE 不访问子目录
*/
//这里是对于路径(文件夹)的过滤,在这里读不到文件如果能判断,可以返回FileVisitResult.SKIP_SUBTREE 不访问子目录
//if(dir.getFileName().startsWith("."))return FileVisitResult.SKIP_SUBTREE;
//if (dir.endsWith(".git"))return FileVisitResult.SKIP_SUBTREE;
return
FileVisitResult
.
CONTINUE
;
...
...
@@ -186,13 +193,13 @@ public class Inspector {
if
(
file
.
toString
().
endsWith
(
".jar"
))
{
ProjectPom
projectPom
=
new
ProjectPom
();
// TODO: 2020-02-28 jar文件需要修改格式变为string
String
[]
split
=
file
.
toString
().
split
(
"\\."
);
String
[]
split
=
file
.
getFileName
().
toString
().
split
(
"\\."
);
PomDependency
pomDependency
=
new
PomDependency
();
pomDependency
.
setArtifactId
(
split
[
0
]);
projectPom
.
getDependencies
().
add
(
pomDependency
);
if
(
inspectParameter
.
getAdmin
()==
1
){
Rule
rule
=
new
Rule
();
rule
.
setTechnologyId
(
tech
nology
.
getId
());
rule
.
setTechnologyId
(
tech
JavaSupport
.
getId
());
rule
.
setTarget
(
split
[
0
]);
rule
.
setSuffix
(
"*"
);
rule
.
setId
(
UUIDUtil
.
getUUID
());
...
...
@@ -226,17 +233,16 @@ public class Inspector {
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
analysis
(
technology
);
return
analysis
();
}
/**
* 构成报告所需要到数据
*
* @return Report
* @param technology
*/
@Transactional
public
ReportVo
analysis
(
Technology
technology
)
{
public
ReportVo
analysis
()
{
DepTreeVo
depTreeVo
=
new
DepTreeVo
();
String
most
=
null
;
int
maxnum
=
0
;
...
...
@@ -272,13 +278,13 @@ public class Inspector {
stringBuilder
.
append
(
dependency
.
getGroupId
()).
append
(
":"
).
append
(
dependency
.
getArtifactId
());
if
(
inspectParameter
.
getAdmin
()==
1
){
Rule
rule
=
new
Rule
();
rule
.
setTechnologyId
(
tech
nology
.
getId
());
rule
.
setTechnologyId
(
tech
JavaSupport
.
getId
());
rule
.
setTarget
(
dependency
.
getGroupId
());
rule
.
setSuffix
(
"*"
);
rule
.
setId
(
UUIDUtil
.
getUUID
());
Rule
rule1
=
new
Rule
();
rule1
.
setTechnologyId
(
tech
nology
.
getId
());
rule1
.
setTechnologyId
(
tech
JavaSupport
.
getId
());
rule1
.
setTarget
(
dependency
.
getArtifactId
());
rule1
.
setSuffix
(
"*"
);
rule1
.
setId
(
UUIDUtil
.
getUUID
());
...
...
@@ -317,13 +323,13 @@ public class Inspector {
stringBuilder
.
append
(
dependency
.
getGroupId
()).
append
(
":"
).
append
(
dependency
.
getArtifactId
());
if
(
inspectParameter
.
getAdmin
()==
1
){
Rule
rule
=
new
Rule
();
rule
.
setTechnologyId
(
tech
nology
.
getId
());
rule
.
setTechnologyId
(
tech
JavaSupport
.
getId
());
rule
.
setTarget
(
dependency
.
getGroupId
());
rule
.
setSuffix
(
"*"
);
rule
.
setId
(
UUIDUtil
.
getUUID
());
Rule
rule1
=
new
Rule
();
rule1
.
setTechnologyId
(
tech
nology
.
getId
());
rule1
.
setTechnologyId
(
tech
JavaSupport
.
getId
());
rule1
.
setTarget
(
dependency
.
getArtifactId
());
rule1
.
setSuffix
(
"*"
);
rule1
.
setId
(
UUIDUtil
.
getUUID
());
...
...
@@ -418,14 +424,13 @@ public class Inspector {
int
ik
=
KmpUtil
.
kmpMatch
(
name
,
rule
.
getTarget
());
if
(
ik
>
0
)
{
//rule匹配上了
if
(
rule
.
getTechnologyId
().
equals
(
tech
nology1
.
getId
())){
if
(
rule
.
getTechnologyId
().
equals
(
tech
NotCnSupport
.
getId
())){
Warn
warn
=
new
Warn
();
warn
.
setFilePath
(
path
.
toAbsolutePath
().
toString
());
warn
.
setLineNum
(
num
);
warn
.
setTechnologyId
(
rule
.
getTechnologyId
());
warn
.
setRuleId
(
rule
.
getId
());
warn
.
setRule
(
rule
.
getTarget
());
warn
.
setId
(
UUIDUtil
.
getUUID
());
warns
.
add
(
warn
);
a
=
0
;
}
...
...
@@ -433,14 +438,6 @@ public class Inspector {
}
return
a
;
}
public
static
void
main
(
String
[]
args
)
{
Path
path
=
Paths
.
get
(
"/Users/mcj/IdeaProjects/inspect/pom.xml"
);
Path
path1
=
path
.
toAbsolutePath
();
boolean
xml
=
path1
.
getFileName
().
toString
().
endsWith
(
"xml"
);
boolean
b
=
path1
.
endsWith
(
"xml"
);
System
.
out
.
println
(
xml
);
}
public
class
Counter
{
private
int
i
=
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论