未验证 提交 74939bb4 编写于 作者: P Phodal Huang

fix: try to fix lint issue

上级 4e72ab93
ignore:
- "core/languages"
......@@ -45,7 +45,7 @@ func (j *BadSmellApp) AnalysisPath(codeDir string, ignoreRules []string) []BadSm
nodeInfo = listener.getNodeInfo()
nodeInfo.Path = file
nodeInfos = append(nodeInfos, *nodeInfo)
nodeInfos = append(nodeInfos, nodeInfo)
}
bsModel, _ := json.MarshalIndent(nodeInfos, "", "\t")
......
......@@ -39,8 +39,8 @@ type BadSmellListener struct {
BaseJavaParserListener
}
func (s *BadSmellListener) getNodeInfo() *models2.BsJClass {
return &models2.BsJClass{
func (s *BadSmellListener) getNodeInfo() models2.BsJClass {
return *&models2.BsJClass{
currentPkg,
currentClz,
currentClzType,
......@@ -190,7 +190,7 @@ func (s *BadSmellListener) EnterMethodDeclaration(ctx *MethodDeclarationContext)
paramContext := param.(*FormalParameterContext)
paramType := paramContext.TypeType().GetText()
paramValue := paramContext.VariableDeclaratorId().(*VariableDeclaratorIdContext).IDENTIFIER().GetText()
methodParams = append(methodParams, *&models2.JFullParameter{paramType, paramValue})
methodParams = append(methodParams, models2.JFullParameter{paramType, paramValue})
localVars[paramValue] = paramType
}
......@@ -303,17 +303,17 @@ func (s *BadSmellListener) EnterMethodCall(ctx *MethodCallContext) {
targetType = currentClzExtends
}
if fullType != "" {
jMethodCall := &models2.BsJMethodCall{removeTarget(fullType), "", targetType, callee, startLine, startLinePosition, stopLine, stopLinePosition}
methodCalls = append(methodCalls, *jMethodCall)
jMethodCall := *&models2.BsJMethodCall{removeTarget(fullType), "", targetType, callee, startLine, startLinePosition, stopLine, stopLinePosition}
methodCalls = append(methodCalls, jMethodCall)
} else {
if ctx.GetText() == targetType {
methodName := ctx.IDENTIFIER().GetText()
jMethodCall := &models2.BsJMethodCall{currentPkg, "", currentClz, methodName, startLine, startLinePosition, stopLine, stopLinePosition}
methodCalls = append(methodCalls, *jMethodCall)
jMethodCall := *&models2.BsJMethodCall{currentPkg, "", currentClz, methodName, startLine, startLinePosition, stopLine, stopLinePosition}
methodCalls = append(methodCalls, jMethodCall)
} else {
methodName := ctx.IDENTIFIER().GetText()
jMethodCall := &models2.BsJMethodCall{currentPkg, "NEEDFIX", targetType, methodName, startLine, startLinePosition, stopLine, stopLinePosition}
methodCalls = append(methodCalls, *jMethodCall)
jMethodCall := *&models2.BsJMethodCall{currentPkg, "NEEDFIX", targetType, methodName, startLine, startLinePosition, stopLine, stopLinePosition}
methodCalls = append(methodCalls, jMethodCall)
}
}
}
......
......@@ -51,9 +51,9 @@ type JFullParameter struct {
Type string
}
func NewJFullClassNode() *BsJClass {
func NewJFullClassNode() BsJClass {
info := &ClassBadSmellInfo{0, 0}
return &BsJClass{
return *&BsJClass{
"",
"",
"",
......
......@@ -19,8 +19,8 @@ func (s *JavaRefactorListener) EnterPackageDeclaration(ctx *PackageDeclarationCo
startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine()
pkgInfo := &models2.JPkgInfo{node.Pkg, startLine, stopLine}
node.SetPkgInfo(*pkgInfo)
pkgInfo := *&models2.JPkgInfo{node.Pkg, startLine, stopLine}
node.SetPkgInfo(pkgInfo)
}
func (s *JavaRefactorListener) EnterImportDeclaration(ctx *ImportDeclarationContext) {
......@@ -31,9 +31,9 @@ func (s *JavaRefactorListener) EnterImportDeclaration(ctx *ImportDeclarationCont
startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine()
jImport := &models2.JImport{importText, startLine, stopLine}
jImport := *&models2.JImport{importText, startLine, stopLine}
node.AddImport(*jImport)
node.AddImport(jImport)
}
func (s *JavaRefactorListener) EnterClassDeclaration(ctx *ClassDeclarationContext) {
......@@ -46,8 +46,8 @@ func (s *JavaRefactorListener) EnterQualifiedNameList(ctx *QualifiedNameListCont
for _, qualified := range ctx.AllQualifiedName() {
startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine()
field := &models2.JField{qualified.GetText(), node.Pkg, startLine, stopLine}
node.AddField(*field)
field := *&models2.JField{qualified.GetText(), node.Pkg, startLine, stopLine}
node.AddField(field)
}
}
......@@ -55,8 +55,8 @@ func (s *JavaRefactorListener) EnterCatchType(ctx *CatchTypeContext) {
for _, qualified := range ctx.AllQualifiedName() {
startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine()
field := &models2.JField{qualified.GetText(), node.Pkg, startLine, stopLine}
node.AddField(*field)
field := *&models2.JField{qualified.GetText(), node.Pkg, startLine, stopLine}
node.AddField(field)
}
}
......@@ -68,8 +68,8 @@ func (s *JavaRefactorListener) EnterInterfaceMethodDeclaration(ctx *InterfaceMet
stopLinePosition := ctx.GetStop().GetColumn()
name := ctx.IDENTIFIER().GetText()
//XXX: find the start position of {, not public
method := &models2.JFullMethod{name, startLine, startLinePosition, stopLine, stopLinePosition}
node.AddMethod(*method)
method := *&models2.JFullMethod{name, startLine, startLinePosition, stopLine, stopLinePosition}
node.AddMethod(method)
}
func (s *JavaRefactorListener) EnterInterfaceDeclaration(ctx *InterfaceDeclarationContext) {
......@@ -80,8 +80,8 @@ func (s *JavaRefactorListener) EnterInterfaceDeclaration(ctx *InterfaceDeclarati
func (s *JavaRefactorListener) EnterTypeType(ctx *TypeTypeContext) {
startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine()
field := &models2.JField{ctx.GetText(), node.Pkg, startLine, stopLine}
node.AddField(*field)
field := *&models2.JField{ctx.GetText(), node.Pkg, startLine, stopLine}
node.AddField(field)
}
func (s *JavaRefactorListener) EnterClassOrInterfaceType(ctx *ClassOrInterfaceTypeContext) {
......@@ -92,8 +92,8 @@ func (s *JavaRefactorListener) EnterClassOrInterfaceType(ctx *ClassOrInterfaceTy
startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine()
field := &models2.JField{name, node.Pkg, startLine, stopLine}
node.AddField(*field)
field := *&models2.JField{name, node.Pkg, startLine, stopLine}
node.AddField(field)
}
}
......@@ -103,8 +103,8 @@ func (s *JavaRefactorListener) EnterAnnotation(ctx *AnnotationContext) {
startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine()
field := &models2.JField{annotation, node.Pkg, startLine, stopLine}
node.AddField(*field)
field := *&models2.JField{annotation, node.Pkg, startLine, stopLine}
node.AddField(field)
}
func (s *JavaRefactorListener) EnterLambdaParameters(ctx *LambdaParametersContext) {
......@@ -115,8 +115,8 @@ func (s *JavaRefactorListener) EnterLambdaParameters(ctx *LambdaParametersContex
startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine()
field := &models2.JField{name, node.Pkg, startLine, stopLine}
node.AddField(*field)
field := *&models2.JField{name, node.Pkg, startLine, stopLine}
node.AddField(field)
}
}
......@@ -124,8 +124,8 @@ func (s *JavaRefactorListener) EnterMethodCall(ctx *MethodCallContext) {
text := ctx.IDENTIFIER().GetText()
startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine()
field := &models2.JField{text, node.Pkg, startLine, stopLine}
node.AddField(*field)
field := *&models2.JField{text, node.Pkg, startLine, stopLine}
node.AddField(field)
}
func (s *JavaRefactorListener) EnterExpressionList(ctx *ExpressionListContext) {
......@@ -134,8 +134,8 @@ func (s *JavaRefactorListener) EnterExpressionList(ctx *ExpressionListContext) {
if isUppercaseText(expText) {
startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine()
field := &models2.JField{expText, node.Pkg, startLine, stopLine}
node.AddField(*field)
field := *&models2.JField{expText, node.Pkg, startLine, stopLine}
node.AddField(field)
}
}
}
......@@ -146,8 +146,8 @@ func (s *JavaRefactorListener) EnterStatement(ctx *StatementContext) {
if isUppercaseText(expText) {
startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine()
field := &models2.JField{expText, node.Pkg, startLine, stopLine}
node.AddField(*field)
field := *&models2.JField{expText, node.Pkg, startLine, stopLine}
node.AddField(field)
}
}
}
......@@ -172,8 +172,8 @@ func (s *JavaRefactorListener) EnterExpression(ctx *ExpressionContext) {
if isUppercaseText(expText) {
startLine := ctx.GetStart().GetLine()
stopLine := ctx.GetStop().GetLine()
field := &models2.JField{expText, node.Pkg, startLine, stopLine}
node.AddField(*field)
field := *&models2.JField{expText, node.Pkg, startLine, stopLine}
node.AddField(field)
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册