refactor: rename ClassNode.Path to ClassNode.FilePath

上级 d965a4db
......@@ -57,7 +57,7 @@ func methodCallToMethodModel(call domain.JMethodCall) domain.JMethod {
}
func updateSelfRefs(node domain.JClassNode, method domain.JMethod, info *support.PackageClassInfo) {
path := node.Path
path := node.FilePath
input, err := ioutil.ReadFile(path)
if err != nil {
log.Fatalln(err)
......
......@@ -33,8 +33,8 @@ func (a TbsApp) AnalysisPath(deps []domain.JClassNode, identifiersMap map[string
var testType = ""
for _, annotation := range method.Annotations {
checkIgnoreTest(clz.Path, annotation, &results, &testType)
checkEmptyTest(clz.Path, annotation, &results, method, &testType)
checkIgnoreTest(clz.FilePath, annotation, &results, &testType)
checkEmptyTest(clz.FilePath, annotation, &results, method, &testType)
}
var methodCallMap = make(map[string][]domain.JMethodCall)
......@@ -49,9 +49,9 @@ func (a TbsApp) AnalysisPath(deps []domain.JClassNode, identifiersMap map[string
methodCallMap[methodCall.BuildFullMethodName()] = append(methodCallMap[methodCall.BuildFullMethodName()], methodCall)
checkRedundantPrintTest(clz.Path, methodCall, &results, &testType)
checkSleepyTest(clz.Path, methodCall, method, &results, &testType)
checkRedundantAssertionTest(clz.Path, methodCall, method, &results, &testType)
checkRedundantPrintTest(clz.FilePath, methodCall, &results, &testType)
checkSleepyTest(clz.FilePath, methodCall, method, &results, &testType)
checkRedundantAssertionTest(clz.FilePath, methodCall, method, &results, &testType)
if methodCall.HasAssertion() {
hasAssert = true
......@@ -73,7 +73,7 @@ func checkAssert(hasAssert bool, clz domain.JClassNode, method domain.JMethod, r
if !hasAssert {
*testType = "UnknownTest"
tbs := TestBadSmell{
FileName: clz.Path,
FileName: clz.FilePath,
Type: *testType,
Description: "",
Line: method.StartLine,
......@@ -127,7 +127,7 @@ func checkDuplicateAssertTest(clz domain.JClassNode, results *[]TestBadSmell, me
if isDuplicateAssert {
*testType = "DuplicateAssertTest"
tbs := TestBadSmell{
FileName: clz.Path,
FileName: clz.FilePath,
Type: *testType,
Description: "",
Line: method.StartLine,
......
......@@ -6,7 +6,7 @@ type JClassNode struct {
Package string
Class string
Type string
Path string
FilePath string
Fields []JField
Methods []JMethod
MethodCalls []JMethodCall
......
......@@ -14,7 +14,7 @@ type Suggest struct {
func NewSuggest(clz JClassNode, pattern, reason string) Suggest {
return Suggest{
File: clz.Path,
File: clz.FilePath,
Package: clz.Package,
Class: clz.Class,
Pattern: pattern,
......
......@@ -89,7 +89,7 @@ func (s *JavaFullListener) ExitInterfaceBody(ctx *parser.InterfaceBodyContext) {
func (s *JavaFullListener) exitBody() {
if currentNode.Class != "" {
currentNode.Fields = fields
currentNode.Path = fileName
currentNode.FilePath = fileName
currentNode.SetMethodFromMap(methodMap)
}
......@@ -432,7 +432,7 @@ func (s *JavaFullListener) EnterCreator(ctx *parser.CreatorContext) {
Package: currentPkg,
Class: text,
Type: "CreatorClass",
Path: "",
FilePath: "",
Fields: nil,
Methods: nil,
MethodCalls: nil,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册