Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
Coca
提交
74939bb4
C
Coca
项目概览
Phodal
/
Coca
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Coca
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
74939bb4
编写于
12月 21, 2019
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: try to fix lint issue
上级
4e72ab93
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
40 addition
and
38 deletion
+40
-38
codecov.yml
codecov.yml
+2
-0
core/adapter/bs/BadSmellApp.go
core/adapter/bs/BadSmellApp.go
+1
-1
core/adapter/bs/BadSmellListener.go
core/adapter/bs/BadSmellListener.go
+9
-9
core/adapter/bs/models/BsModel.go
core/adapter/bs/models/BsModel.go
+2
-2
core/domain/refactor/base/JavaRefactorListener.go
core/domain/refactor/base/JavaRefactorListener.go
+26
-26
core/languages/g4/Sql.g4
core/languages/g4/Sql.g4
+0
-0
未找到文件。
codecov.yml
0 → 100644
浏览文件 @
74939bb4
ignore
:
-
"
core/languages"
core/adapter/bs/BadSmellApp.go
浏览文件 @
74939bb4
...
...
@@ -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
"
)
...
...
core/adapter/bs/BadSmellListener.go
浏览文件 @
74939bb4
...
...
@@ -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
)
}
}
}
...
...
core/adapter/bs/models/BsModel.go
浏览文件 @
74939bb4
...
...
@@ -51,9 +51,9 @@ type JFullParameter struct {
Type
string
}
func
NewJFullClassNode
()
*
BsJClass
{
func
NewJFullClassNode
()
BsJClass
{
info
:=
&
ClassBadSmellInfo
{
0
,
0
}
return
&
BsJClass
{
return
*
&
BsJClass
{
""
,
""
,
""
,
...
...
core/domain/refactor/base/JavaRefactorListener.go
浏览文件 @
74939bb4
...
...
@@ -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
)
}
}
...
...
core/languages/
sql
/Sql.g4
→
core/languages/
g4
/Sql.g4
浏览文件 @
74939bb4
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录