未验证 提交 66fbf2fc 编写于 作者: P Phodal Huang

refactor: rename support to infrastructure

上级 cf61e1dc
......@@ -4,7 +4,7 @@ import (
"encoding/json"
. "github.com/phodal/coca/core/adapter/call"
. "github.com/phodal/coca/core/adapter/identifier"
. "github.com/phodal/coca/core/support"
. "github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
)
......
......@@ -9,7 +9,7 @@ import (
"github.com/phodal/coca/core/adapter"
. "github.com/phodal/coca/core/adapter/api"
"github.com/phodal/coca/core/domain/call_graph"
. "github.com/phodal/coca/core/support"
. "github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
"log"
"os"
......
......@@ -3,7 +3,7 @@ package cmd
import (
"encoding/json"
"github.com/phodal/coca/core/adapter/bs"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
"sort"
"strings"
......@@ -38,7 +38,7 @@ var badsmellCmd = &cobra.Command{
bsModel, _ = json.MarshalIndent(sortSmells, "", "\t")
}
support.WriteToCocaFile("bs.json", string(bsModel))
infrastructure.WriteToCocaFile("bs.json", string(bsModel))
},
}
......@@ -69,7 +69,7 @@ func isSmellHaveSize(key string) bool {
"longMethod",
"dataClass",
}
return support.Contains(smellList, key)
return infrastructure.Contains(smellList, key)
}
func init() {
......
......@@ -6,7 +6,7 @@ import (
"github.com/phodal/coca/config"
. "github.com/phodal/coca/core/domain/call_graph"
"github.com/phodal/coca/core/models"
. "github.com/phodal/coca/core/support"
. "github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
"log"
"strings"
......
......@@ -5,14 +5,14 @@ import (
"fmt"
"github.com/phodal/coca/config"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"log"
"os/exec"
)
func GetDepsFromJson(depPath string) []models.JClassNode {
var parsedDeps []models.JClassNode
file := support.ReadFile(depPath)
file := infrastructure.ReadFile(depPath)
if file == nil {
log.Fatal("lost file:" + depPath)
}
......
......@@ -6,7 +6,7 @@ import (
"github.com/phodal/coca/config"
"github.com/phodal/coca/core/domain/concept"
"github.com/phodal/coca/core/models"
. "github.com/phodal/coca/core/support"
. "github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
"log"
"os"
......
......@@ -6,7 +6,7 @@ import (
"github.com/phodal/coca/config"
"github.com/phodal/coca/core/domain/count"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
"log"
"os"
......@@ -34,7 +34,7 @@ var countCmd = &cobra.Command{
return
}
file := support.ReadFile(dependence)
file := infrastructure.ReadFile(dependence)
if file == nil {
log.Fatal("lost file:" + dependence)
}
......@@ -43,7 +43,7 @@ var countCmd = &cobra.Command{
callMap := count.BuildCallMap(cparsedDeps)
callMapSort := support.RankByWordCount(callMap)
callMapSort := infrastructure.RankByWordCount(callMap)
if countCmdConfig.Top > 0 {
callMapSort = callMapSort[:countCmdConfig.Top]
......
......@@ -7,7 +7,7 @@ import (
"github.com/phodal/coca/config"
"github.com/phodal/coca/core/domain/evaluate"
"github.com/phodal/coca/core/models"
. "github.com/phodal/coca/core/support"
. "github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
"log"
"os"
......
......@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/olekukonko/tablewriter"
. "github.com/phodal/coca/core/domain/gitt"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
"io/ioutil"
"log"
......@@ -33,7 +33,7 @@ var gitCmd = &cobra.Command{
message := getCommitMessage()
commitMessages := BuildMessageByInput(message)
cModel, _ := json.MarshalIndent(commitMessages, "", "\t")
support.WriteToCocaFile("commits.json", string(cModel))
infrastructure.WriteToCocaFile("commits.json", string(cModel))
if *&gitCmdConfig.ShowSummary {
ShowChangeLogSummary(commitMessages)
......
......@@ -6,7 +6,7 @@ import (
"github.com/phodal/coca/cmd/cmd_util"
"github.com/phodal/coca/config"
"github.com/phodal/coca/core/domain/call_graph/rcall"
. "github.com/phodal/coca/core/support"
. "github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
"log"
"strings"
......
......@@ -6,7 +6,7 @@ import (
. "github.com/phodal/coca/core/domain/refactor/move_class"
. "github.com/phodal/coca/core/domain/refactor/rename"
. "github.com/phodal/coca/core/domain/refactor/unused"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
)
......@@ -30,7 +30,7 @@ var refactorCmd = &cobra.Command{
}
if dependence != "" && rename != "" {
file := support.ReadFile(dependence)
file := infrastructure.ReadFile(dependence)
if file == nil {
return
}
......
......@@ -5,7 +5,7 @@ import (
"github.com/olekukonko/tablewriter"
"github.com/phodal/coca/config"
"github.com/phodal/coca/core/domain/suggest"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
"log"
"os"
......@@ -21,7 +21,7 @@ var suggestCmd = &cobra.Command{
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
parsedDeps = nil
depFile := support.ReadFile(apiCmdConfig.DependencePath)
depFile := infrastructure.ReadFile(apiCmdConfig.DependencePath)
if depFile == nil {
log.Fatal("lost deps")
}
......
......@@ -8,7 +8,7 @@ import (
"github.com/phodal/coca/core/adapter/call"
"github.com/phodal/coca/core/domain/tbs"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
"os"
"strconv"
......@@ -28,7 +28,7 @@ var tbsCmd = &cobra.Command{
Short: "generate tests bad smell",
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
files := support.GetJavaTestFiles(tbsCmdConfig.Path)
files := infrastructure.GetJavaTestFiles(tbsCmdConfig.Path)
var identifiers []models.JIdentifier
identifiers = adapter.LoadTestIdentify(files)
......@@ -43,7 +43,7 @@ var tbsCmd = &cobra.Command{
classNodes := analysisApp.AnalysisFiles(identifiers, files, classes)
nodeContent, _ := json.MarshalIndent(classNodes, "", "\t")
support.WriteToCocaFile("tdeps.json", string(nodeContent))
infrastructure.WriteToCocaFile("tdeps.json", string(nodeContent))
app := tbs.NewTbsApp()
result := app.AnalysisPath(classNodes, identifiersMap)
......@@ -60,7 +60,7 @@ var tbsCmd = &cobra.Command{
resultContent, _ = json.MarshalIndent(tbsMap, "", "\t")
}
support.WriteToCocaFile("tbs.json", string(resultContent))
infrastructure.WriteToCocaFile("tbs.json", string(resultContent))
if len(result) <= 20 {
table := tablewriter.NewWriter(os.Stdout)
......
......@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/olekukonko/tablewriter"
"github.com/phodal/coca/core/domain/todo"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"github.com/spf13/cobra"
"os"
"strings"
......@@ -30,7 +30,7 @@ var todoCmd = &cobra.Command{
todos := app.AnalysisPath(path)
simple, _ := json.MarshalIndent(todos, "", "\t")
support.WriteToCocaFile("simple-todos.json", string(simple))
infrastructure.WriteToCocaFile("simple-todos.json", string(simple))
fmt.Println("Todos Count", len(todos))
......@@ -38,7 +38,7 @@ var todoCmd = &cobra.Command{
gitTodos := app.BuildWithGitHistory(todos)
cModel, _ := json.MarshalIndent(todos, "", "\t")
support.WriteToCocaFile("todos.json", string(cModel))
infrastructure.WriteToCocaFile("todos.json", string(cModel))
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Date", "Author", "Messages", "FileName", "Line"})
......
......@@ -5,6 +5,6 @@ import (
)
func main() {
//defer profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook)
//defer profile.Start().Stop()
cmd.Execute()
}
......@@ -2,7 +2,7 @@ package api
import (
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"fmt"
"github.com/antlr/antlr4/runtime/Go/antlr"
"path/filepath"
......@@ -14,14 +14,14 @@ type JavaApiApp struct {
}
func (j *JavaApiApp) AnalysisPath(codeDir string, parsedDeps []models.JClassNode, identifiersMap map[string]models.JIdentifier, diMap map[string]string) []RestApi {
files := support.GetJavaFiles(codeDir)
files := infrastructure.GetJavaFiles(codeDir)
for index := range files {
file := files[index]
displayName := filepath.Base(file)
fmt.Println("Start parse java call: " + displayName)
parser := support.ProcessFile(file)
parser := infrastructure.ProcessFile(file)
context := parser.CompilationUnit()
listener := NewJavaApiListener(identifiersMap, diMap)
......
......@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/antlr/antlr4/runtime/Go/antlr"
models2 "github.com/phodal/coca/core/adapter/bs/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"os"
"path/filepath"
"strconv"
......@@ -54,7 +54,7 @@ func (j *BadSmellApp) AnalysisPath(codeDir string, ignoreRules []string) []BadSm
}
bsModel, _ := json.MarshalIndent(nodeInfos, "", "\t")
support.WriteToCocaFile("nodeInfos.json", string(bsModel))
infrastructure.WriteToCocaFile("nodeInfos.json", string(bsModel))
bsList := analysisBadSmell(nodeInfos)
......
......@@ -4,7 +4,7 @@ import (
"fmt"
"github.com/antlr/antlr4/runtime/Go/antlr"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"path/filepath"
)
......@@ -16,7 +16,7 @@ func NewJavaCallApp() JavaCallApp {
}
func (j *JavaCallApp) AnalysisPath(codeDir string, classes []string, identNodes []models.JIdentifier) []models.JClassNode {
files := support.GetJavaFiles(codeDir)
files := infrastructure.GetJavaFiles(codeDir)
return j.AnalysisFiles(identNodes, files, classes)
}
......@@ -32,7 +32,7 @@ func (j *JavaCallApp) AnalysisFiles(identNodes []models.JIdentifier, files []str
displayName := filepath.Base(file)
fmt.Println("Start parse java call: " + displayName)
parser := support.ProcessFile(file)
parser := infrastructure.ProcessFile(file)
context := parser.CompilationUnit()
listener := NewJavaCallListener(identMap, file)
......
......@@ -4,7 +4,7 @@ import (
"encoding/json"
"github.com/phodal/coca/core/adapter/identifier"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
)
func BuildIdentifierMap(identifiers []models.JIdentifier) map[string]models.JIdentifier {
......@@ -19,13 +19,13 @@ func BuildIdentifierMap(identifiers []models.JIdentifier) map[string]models.JIde
func LoadIdentify(importPath string) []models.JIdentifier {
var identifiers []models.JIdentifier
apiContent := support.ReadCocaFile("identify.json")
apiContent := infrastructure.ReadCocaFile("identify.json")
if apiContent == nil || string(apiContent) == "null" {
identifierApp := new(identifier.JavaIdentifierApp)
ident := identifierApp.AnalysisPath(importPath)
identModel, _ := json.MarshalIndent(ident, "", "\t")
support.WriteToCocaFile("identify.json", string(identModel))
infrastructure.WriteToCocaFile("identify.json", string(identModel))
return *&ident
}
......@@ -37,14 +37,14 @@ func LoadIdentify(importPath string) []models.JIdentifier {
func LoadTestIdentify(files []string) []models.JIdentifier {
var identifiers []models.JIdentifier
apiContent := support.ReadCocaFile("tidentify.json")
apiContent := infrastructure.ReadCocaFile("tidentify.json")
if apiContent == nil || string(apiContent) == "null" {
identifierApp := identifier.NewJavaIdentifierApp()
ident := identifierApp.AnalysisFiles(files)
identModel, _ := json.MarshalIndent(ident, "", "\t")
support.WriteToCocaFile("tidentify.json", string(identModel))
infrastructure.WriteToCocaFile("tidentify.json", string(identModel))
return *&ident
}
......
......@@ -3,7 +3,7 @@ package identifier
import (
"github.com/antlr/antlr4/runtime/Go/antlr"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
)
......@@ -15,7 +15,7 @@ func NewJavaIdentifierApp() JavaIdentifierApp {
}
func (j *JavaIdentifierApp) AnalysisPath(codeDir string) []models.JIdentifier {
files := support.GetJavaFiles(codeDir)
files := infrastructure.GetJavaFiles(codeDir)
return j.AnalysisFiles(files)
}
......@@ -23,7 +23,7 @@ func (j *JavaIdentifierApp) AnalysisFiles(files []string) []models.JIdentifier {
var nodeInfos []models.JIdentifier = nil
for _, file := range files {
parser := support.ProcessFile(file)
parser := infrastructure.ProcessFile(file)
context := parser.CompilationUnit()
listener := NewJavaIdentifierListener()
......
......@@ -7,7 +7,7 @@ import (
"github.com/phodal/coca/core/adapter/call"
"github.com/phodal/coca/core/adapter/identifier"
"github.com/phodal/coca/core/domain/arch/tequila"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"io"
"path/filepath"
"reflect"
......@@ -49,7 +49,7 @@ func TestConceptAnalyser_Analysis(t *testing.T) {
g.Expect(len(graph.SubGraphs.SubGraphs)).To(Equal(3))
jsonContent, _ := json.MarshalIndent(results, "", "\t")
content := support.ReadFile(filepath.FromSlash(codePath + "/" + "results.json"))
content := infrastructure.ReadFile(filepath.FromSlash(codePath + "/" + "results.json"))
g.Expect(JSONBytesEqual(jsonContent, content)).To(Equal(true))
}
......
......@@ -5,7 +5,7 @@ import (
. "github.com/onsi/gomega"
"github.com/phodal/coca/core/domain/call_graph"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"path/filepath"
"testing"
)
......@@ -19,7 +19,7 @@ func Test_should_generate_correct_files(t *testing.T) {
codePath := "../../../_fixtures/call_api_test.json"
codePath = filepath.FromSlash(codePath)
file := support.ReadFile(codePath)
file := infrastructure.ReadFile(codePath)
_ = json.Unmarshal(file, &parsedDeps)
dotContent := analyser.Analysis("com.phodal.pholedge.book.BookController.createBook", *&parsedDeps)
......
......@@ -3,7 +3,7 @@ package rcall
import (
"github.com/phodal/coca/core/domain/call_graph"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"encoding/json"
)
......@@ -19,7 +19,7 @@ func (c RCallGraph) Analysis(funcName string, clzs []models.JClassNode) string {
rcallMap := BuildRCallMethodMap(clzs, projectMethodMap)
mapJson, _ := json.MarshalIndent(rcallMap, "", "\t")
support.WriteToCocaFile("rcallmap.json", string(mapJson))
infrastructure.WriteToCocaFile("rcallmap.json", string(mapJson))
chain := c.buildRCallChain(funcName, rcallMap)
......
......@@ -3,7 +3,7 @@ package rcall
import (
"encoding/json"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"log"
"testing"
......@@ -15,7 +15,7 @@ func TestRCallGraph_Analysis(t *testing.T) {
var parsedDeps []models.JClassNode
analyser := NewRCallGraph()
file := support.ReadFile("../../../../_fixtures/call_api_test.json")
file := infrastructure.ReadFile("../../../../_fixtures/call_api_test.json")
if file == nil {
log.Fatal("lost file")
}
......
......@@ -4,7 +4,7 @@ import (
"github.com/phodal/coca/config"
languages2 "github.com/phodal/coca/core/domain/call_graph/stop_words/languages"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
)
type ConceptAnalyser struct {
......@@ -18,11 +18,11 @@ func (c ConceptAnalyser) run() {
}
func (c ConceptAnalyser) Analysis(clzs *[]models.JClassNode) support.PairList {
func (c ConceptAnalyser) Analysis(clzs *[]models.JClassNode) infrastructure.PairList {
return buildMethodsFromDeps(*clzs)
}
func buildMethodsFromDeps(clzs []models.JClassNode) support.PairList {
func buildMethodsFromDeps(clzs []models.JClassNode) infrastructure.PairList {
var methodsName []string
var methodStr string
for _, clz := range clzs {
......@@ -37,7 +37,7 @@ func buildMethodsFromDeps(clzs []models.JClassNode) support.PairList {
words = removeNormalWords(words)
wordCounts := support.RankByWordCount(words)
wordCounts := infrastructure.RankByWordCount(words)
return wordCounts
}
......
......@@ -3,7 +3,7 @@ package concept
import (
"encoding/json"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"log"
"path/filepath"
"testing"
......@@ -19,7 +19,7 @@ func TestConceptAnalyser_Analysis(t *testing.T) {
codePath := "../../../_fixtures/call_api_test.json"
codePath = filepath.FromSlash(codePath)
file := support.ReadFile(codePath)
file := infrastructure.ReadFile(codePath)
if file == nil {
log.Fatal("lost file")
}
......
......@@ -4,7 +4,7 @@ import (
"encoding/json"
. "github.com/onsi/gomega"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"path/filepath"
"testing"
)
......@@ -14,7 +14,7 @@ func TestBuildCallMap(t *testing.T) {
var parsedDeps []models.JClassNode
codePath := "../../../_fixtures/count/call.json"
codePath = filepath.FromSlash(codePath)
file := support.ReadFile(codePath)
file := infrastructure.ReadFile(codePath)
_ = json.Unmarshal(file, &parsedDeps)
callMap := BuildCallMap(parsedDeps)
......
......@@ -3,7 +3,7 @@ package evaluate
import (
"github.com/phodal/coca/core/domain/evaluate/evaluator"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"gonum.org/v1/gonum/stat"
"strings"
)
......@@ -49,7 +49,7 @@ func (a Analyser) Analysis(classNodes []models.JClassNode, identifiers []models.
for _, method := range ident.Methods {
result.Summary.MethodCount++
if support.Contains(method.Modifiers, "static") {
if infrastructure.Contains(method.Modifiers, "static") {
result.Summary.StaticMethodCount++
}
......
......@@ -8,7 +8,7 @@ import (
"github.com/phodal/coca/core/adapter/identifier"
"github.com/phodal/coca/core/domain/evaluate/evaluator"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"path/filepath"
"testing"
)
......@@ -20,7 +20,7 @@ func TestAnalyser_Analysis(t *testing.T) {
analyser := NewEvaluateAnalyser()
codePath := "../../../_fixtures/evaluate/service.json"
codePath = filepath.FromSlash(codePath)
file := support.ReadFile(codePath)
file := infrastructure.ReadFile(codePath)
_ = json.Unmarshal(file, &parsedDeps)
analyser.Analysis(parsedDeps, nil)
......@@ -35,7 +35,7 @@ func Test_Service_LifeCycle(t *testing.T) {
analyser := NewEvaluateAnalyser()
codePath := "../../../_fixtures/evaluate/service_lifecycle.json"
codePath = filepath.FromSlash(codePath)
file := support.ReadFile(codePath)
file := infrastructure.ReadFile(codePath)
_ = json.Unmarshal(file, &parsedDeps)
result := analyser.Analysis(parsedDeps, nil)
......@@ -52,7 +52,7 @@ func Test_Service_Same_Return_Type(t *testing.T) {
analyser := NewEvaluateAnalyser()
codePath := "../../../_fixtures/evaluate/service_same_return_type.json"
codePath = filepath.FromSlash(codePath)
file := support.ReadFile(codePath)
file := infrastructure.ReadFile(codePath)
_ = json.Unmarshal(file, &parsedDeps)
results := analyser.Analysis(parsedDeps, nil)
......@@ -67,7 +67,7 @@ func Test_Long_Parameters(t *testing.T) {
analyser := NewEvaluateAnalyser()
codePath := "../../../_fixtures/evaluate/service_long_parameters.json"
codePath = filepath.FromSlash(codePath)
file := support.ReadFile(codePath)
file := infrastructure.ReadFile(codePath)
_ = json.Unmarshal(file, &parsedDeps)
result := analyser.Analysis(parsedDeps, nil)
......
package evaluator
import (
"github.com/phodal/coca/config"
"github.com/phodal/coca/core/infrastructure/apriori"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/support/apriori"
"strings"
)
......@@ -103,7 +103,7 @@ func (s Service) buildLifecycle(methodNameArray [][]string) map[string][]string
}
firstWord := nameArray[0]
if !(support.IsTechStopWords(firstWord)) {
if !(IsTechStopWords(firstWord)) {
nameMap[firstWord] = append(nameMap[firstWord], strings.Join(nameArray, ""))
}
if len(nameMap[firstWord]) > 1 {
......@@ -114,6 +114,16 @@ func (s Service) buildLifecycle(methodNameArray [][]string) map[string][]string
return hadLifecycle
}
func IsTechStopWords(firstWord string) bool {
for _, word := range config.TechStopWords {
if word == firstWord {
return true;
}
}
return false;
}
func (s Service) enableLifecycle() bool {
return true
}
......
......@@ -2,7 +2,7 @@ package gitt
import (
"fmt"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"regexp"
)
......@@ -16,7 +16,7 @@ var (
func ShowChangeLogSummary(commits []CommitMessage) {
changeMap := BuildChangeMap(commits)
for key, value := range changeMap {
sortValue := support.RankByWordCount(value)
sortValue := infrastructure.RankByWordCount(value)
maxSize := len(sortValue)
if maxSize > 10 {
maxSize = 10
......
......@@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/phodal/coca/core/support/apriori"
"github.com/phodal/coca/core/infrastructure/apriori"
"log"
"sort"
"strings"
......
......@@ -6,7 +6,7 @@ import (
"github.com/antlr/antlr4/runtime/Go/antlr"
base2 "github.com/phodal/coca/core/domain/refactor/base"
models2 "github.com/phodal/coca/core/domain/refactor/base/models"
utils2 "github.com/phodal/coca/core/support"
utils2 "github.com/phodal/coca/core/infrastructure"
"io"
"io/ioutil"
"log"
......
......@@ -3,7 +3,7 @@ package unused
import (
support3 "github.com/phodal/coca/core/domain/refactor/rename/support"
. "github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"io/ioutil"
"log"
"strings"
......@@ -25,7 +25,7 @@ func RenameMethodApp(deps []JClassNode, p string) *RemoveMethodApp {
}
func (j *RemoveMethodApp) Start() {
configBytes := support.ReadFile(configPath)
configBytes := infrastructure.ReadFile(configPath)
if configBytes == nil {
return
}
......
......@@ -5,7 +5,7 @@ import (
"github.com/antlr/antlr4/runtime/Go/antlr"
base2 "github.com/phodal/coca/core/domain/refactor/base"
models2 "github.com/phodal/coca/core/domain/refactor/base/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"io/ioutil"
"os"
"path/filepath"
......@@ -25,7 +25,7 @@ func NewRemoveUnusedImportApp(pPath string) *RemoveUnusedImportApp {
}
func (j *RemoveUnusedImportApp) Analysis() []models2.JFullIdentifier {
files := support.GetJavaFiles(configPath)
files := infrastructure.GetJavaFiles(configPath)
var nodes []models2.JFullIdentifier = nil
for index := range files {
......@@ -35,7 +35,7 @@ func (j *RemoveUnusedImportApp) Analysis() []models2.JFullIdentifier {
displayName := filepath.Base(file)
fmt.Println("Start parse java call: " + displayName)
parser := support.ProcessFile(file)
parser := infrastructure.ProcessFile(file)
context := parser.CompilationUnit()
node := models2.NewJFullIdentifier()
......
......@@ -4,7 +4,7 @@ import (
"encoding/json"
. "github.com/onsi/gomega"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"path/filepath"
"testing"
)
......@@ -16,7 +16,7 @@ func TestRefactoring(t *testing.T) {
var parsedDeps []models.JClassNode
codePath := "../../../../_fixtures/count/call.json"
codePath = filepath.FromSlash(codePath)
file := support.ReadFile(codePath)
file := infrastructure.ReadFile(codePath)
_ = json.Unmarshal(file, &parsedDeps)
results := Refactoring(parsedDeps)
......
......@@ -3,7 +3,7 @@ package suggest
import (
"encoding/json"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"log"
"path/filepath"
"testing"
......@@ -18,7 +18,7 @@ func TestConceptAnalyser_Analysis(t *testing.T) {
analyser := NewSuggestApp()
codePath := "../../../_fixtures/suggest/factory/factory_suggest.json"
codePath = filepath.FromSlash(codePath)
file := support.ReadFile(codePath)
file := infrastructure.ReadFile(codePath)
if file == nil {
log.Fatal("lost file")
}
......
......@@ -5,7 +5,7 @@ import (
"github.com/phodal/coca/core/adapter"
"github.com/phodal/coca/core/adapter/call"
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
"path/filepath"
"testing"
)
......@@ -111,7 +111,7 @@ func TestTbsApp_CallAssertInClassTests(t *testing.T) {
}
func buildTbsResult(codePath string) []TestBadSmell {
files := support.GetJavaTestFiles(codePath)
files := infrastructure.GetJavaTestFiles(codePath)
var identifiers []models.JIdentifier
identifiers = adapter.LoadTestIdentify(files)
......
......@@ -5,7 +5,7 @@ import (
"github.com/antlr/antlr4/runtime/Go/antlr"
"github.com/phodal/coca/core/domain/gitt"
"github.com/phodal/coca/core/domain/todo/astitodo"
"github.com/phodal/coca/core/support"
"github.com/phodal/coca/core/infrastructure"
. "github.com/phodal/coca/languages/java"
"log"
"os/exec"
......@@ -66,7 +66,7 @@ func (a TodoApp) BuildWithGitHistory(todos []*astitodo.TODO) []TodoDetail {
func buildComment(path string) []*astitodo.TODO {
var todos []*astitodo.TODO
files := support.GetJavaFiles(path)
files := infrastructure.GetJavaFiles(path)
for index := range files {
file := files[index]
......
package support
package infrastructure
import "sort"
......
package support
import "github.com/phodal/coca/config"
func IsTechStopWords(firstWord string) bool {
for _, word := range config.TechStopWords {
if word == firstWord {
return true;
}
}
return false;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册