refactor: fix tbs app param issue

上级 25fd8f34
此差异已折叠。
此差异已折叠。
BREAK=1
DEFAULT=2
FUNC=3
INTERFACE=4
SELECT=5
CASE=6
DEFER=7
GO=8
MAP=9
STRUCT=10
CHAN=11
ELSE=12
GOTO=13
PACKAGE=14
SWITCH=15
CONST=16
FALLTHROUGH=17
IF=18
RANGE=19
TYPE=20
CONTINUE=21
FOR=22
IMPORT=23
RETURN=24
VAR=25
NIL_LIT=26
IDENTIFIER=27
L_PAREN=28
R_PAREN=29
L_CURLY=30
R_CURLY=31
L_BRACKET=32
R_BRACKET=33
ASSIGN=34
COMMA=35
SEMI=36
COLON=37
DOT=38
PLUS_PLUS=39
MINUS_MINUS=40
DECLARE_ASSIGN=41
ELLIPSIS=42
LOGICAL_OR=43
LOGICAL_AND=44
EQUALS=45
NOT_EQUALS=46
LESS=47
LESS_OR_EQUALS=48
GREATER=49
GREATER_OR_EQUALS=50
OR=51
DIV=52
MOD=53
LSHIFT=54
RSHIFT=55
BIT_CLEAR=56
EXCLAMATION=57
PLUS=58
MINUS=59
CARET=60
STAR=61
AMPERSAND=62
RECEIVE=63
DECIMAL_LIT=64
OCTAL_LIT=65
HEX_LIT=66
FLOAT_LIT=67
IMAGINARY_LIT=68
RUNE_LIT=69
RAW_STRING_LIT=70
INTERPRETED_STRING_LIT=71
WS=72
COMMENT=73
TERMINATOR=74
LINE_COMMENT=75
'break'=1
'default'=2
'func'=3
'interface'=4
'select'=5
'case'=6
'defer'=7
'go'=8
'map'=9
'struct'=10
'chan'=11
'else'=12
'goto'=13
'package'=14
'switch'=15
'const'=16
'fallthrough'=17
'if'=18
'range'=19
'type'=20
'continue'=21
'for'=22
'import'=23
'return'=24
'var'=25
'nil'=26
'('=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
......@@ -42,7 +42,7 @@ func (a TbsApp) AnalysisPath(deps []core_domain.CodeDataStruct, identifiersMap m
for index, methodCall := range currentMethodCalls {
if methodCall.FunctionName == "" {
if index == len(currentMethodCalls)-1 {
checkAssert(hasAssert, clz, method, &results, &testType)
checkAssert(hasAssert, clz.FilePath, method, &results, &testType)
}
continue
}
......@@ -58,7 +58,7 @@ func (a TbsApp) AnalysisPath(deps []core_domain.CodeDataStruct, identifiersMap m
}
if index == len(currentMethodCalls)-1 {
checkAssert(hasAssert, clz, method, &results, &testType)
checkAssert(hasAssert, clz.FilePath, method, &results, &testType)
}
}
......@@ -69,11 +69,11 @@ func (a TbsApp) AnalysisPath(deps []core_domain.CodeDataStruct, identifiersMap m
return results
}
func checkAssert(hasAssert bool, clz core_domain.CodeDataStruct, method core_domain.CodeFunction, results *[]TestBadSmell, testType *string) {
func checkAssert(hasAssert bool, filePath string, method core_domain.CodeFunction, results *[]TestBadSmell, testType *string) {
if !hasAssert {
*testType = "UnknownTest"
tbs := TestBadSmell{
FileName: clz.FilePath,
FileName: filePath,
Type: *testType,
Description: "",
Line: method.Position.StartLine,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册