fix: fix more lint issues

上级 9869d2af
......@@ -28,9 +28,8 @@ var tbsCmd = &cobra.Command{
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
files := cocafile.GetJavaTestFiles(tbsCmdConfig.Path)
var identifiers []domain.JIdentifier
identifiers = cmd_util.LoadTestIdentify(files)
identifiers := cmd_util.LoadTestIdentify(files)
identifiersMap := domain.BuildIdentifierMap(identifiers)
var classes []string = nil
......
......@@ -44,7 +44,7 @@ func (d *DepAnalysisApp) AnalysisPath(path string, nodes []domain.JClassNode) []
var needRemoveMap = make(map[int]int)
for depIndex, dep := range mavenDeps {
for key, _ := range importMap {
for key := range importMap {
if strings.Contains(key, dep.GroupId) {
needRemoveMap[depIndex] = depIndex
continue
......
......@@ -34,9 +34,7 @@ func UpdateMessageForChange(changedFile string) (string, string, string) {
var oldLastChanged = changed[4]
// TODO: support for Windows rename
if changed[2] == "" {
if strings.HasPrefix(oldLastChanged, "/") {
oldLastChanged = oldLastChanged[1:]
}
oldLastChanged = strings.TrimPrefix(oldLastChanged, "/")
}
oldFileName = changed[1] + changed[2] + oldLastChanged
......
......@@ -85,7 +85,7 @@ func (s *JavaRefactorListener) EnterTypeType(ctx *TypeTypeContext) {
func (s *JavaRefactorListener) EnterClassOrInterfaceType(ctx *ClassOrInterfaceTypeContext) {
identifiers := ctx.AllIDENTIFIER()
for index, _ := range identifiers {
for index := range identifiers {
context := ctx.IDENTIFIER(index)
name := context.GetText()
startLine := ctx.GetStart().GetLine()
......@@ -108,7 +108,7 @@ func (s *JavaRefactorListener) EnterAnnotation(ctx *AnnotationContext) {
func (s *JavaRefactorListener) EnterLambdaParameters(ctx *LambdaParametersContext) {
identifiers := ctx.AllIDENTIFIER()
for index, _ := range identifiers {
for index := range identifiers {
context := ctx.IDENTIFIER(index)
name := context.GetText()
startLine := ctx.GetStart().GetLine()
......@@ -153,7 +153,7 @@ func (s *JavaRefactorListener) EnterStatement(ctx *StatementContext) {
func (s *JavaRefactorListener) EnterCreatedName(ctx *CreatedNameContext) {
identifiers := ctx.AllIDENTIFIER()
for index, _ := range identifiers {
for index := range identifiers {
context := ctx.IDENTIFIER(index)
name := context.GetText()
startLine := ctx.GetStart().GetLine()
......
......@@ -35,6 +35,6 @@ func Refactoring(parsedDeps []JClassNode) []string {
}
}
sort.Sort(sort.StringSlice(excludePackage))
sort.Strings(excludePackage)
return excludePackage
}
......@@ -141,9 +141,8 @@ func buildTbsResult(codePath string) []TestBadSmell {
func BuildTestAnalysisResultsByPath(codePath string) (map[string]domain.JIdentifier, []domain.JClassNode) {
files := cocafile.GetJavaTestFiles(codePath)
var identifiers []domain.JIdentifier
identifiers = cmd_util.LoadTestIdentify(files)
identifiers := cmd_util.LoadTestIdentify(files)
identifiersMap := domain.BuildIdentifierMap(identifiers)
var classes []string = nil
......
......@@ -296,9 +296,7 @@ func (a *Apriori) generateRelationRecords(relationRecords chan RelationRecord, s
func (a *Apriori) createNextCandidates(prevCandidates [][]string, length int) [][]string {
var items []string
for _, candidate := range prevCandidates {
for _, item := range candidate {
items = append(items, item)
}
items = append(items, candidate...)
}
sort.Strings(items)
items = a.uniqueItems(items)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册