Skip to content

Commit 73d8eab

Browse files
committed
Remove unncessary use of String() method
1 parent 796cf1a commit 73d8eab

File tree

5 files changed

+22
-21
lines changed

5 files changed

+22
-21
lines changed

check/check.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818

1919
// RunChecks runs all checks for the given project and outputs the results.
2020
func RunChecks(project project.Type) {
21-
fmt.Printf("Checking %s in %s\n", project.ProjectType.String(), project.Path.String())
21+
fmt.Printf("Checking %s in %s\n", project.ProjectType, project.Path)
2222

2323
checkdata.Initialize(project)
2424

configuration/checkmode/checkmode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func Modes(defaultCheckModes map[projecttype.Type]map[Type]bool, customCheckMode
3030
} else {
3131
checkModes[key] = defaultValue
3232
}
33-
logrus.Tracef("Check mode option %s set to %t\n", key.String(), checkModes[key])
33+
logrus.Tracef("Check mode option %s set to %t\n", key, checkModes[key])
3434
}
3535

3636
// This mode is always enabled

configuration/configuration.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ func Initialize() {
2727
// superprojectType = projecttype.All
2828

2929
outputFormat = "text"
30+
//outputFormat = "json"
3031
//reportFilePath = paths.New("report.json")
3132

3233
feedback.SetFormat(feedback.JSON)
3334
logrus.SetLevel(logrus.PanicLevel)
3435

3536
logrus.WithFields(logrus.Fields{
36-
"superproject type filter": SuperprojectTypeFilter().String(),
37+
"superproject type filter": SuperprojectTypeFilter(),
3738
"recursive": Recursive(),
38-
"projects path": TargetPath().String(),
39+
"projects path": TargetPath(),
3940
}).Debug("Configuration initialized")
4041
}
4142

project/project.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ func FindProjects() ([]Type, error) {
4848
return foundProjects, nil
4949
}
5050

51-
return nil, fmt.Errorf("specified path %s is not an Arduino project", targetPath.String())
51+
return nil, fmt.Errorf("specified path %s is not an Arduino project", targetPath)
5252
}
5353

5454
foundProjects = append(foundProjects, findProjectsUnderPath(targetPath, superprojectTypeFilter, recursive)...)
5555

5656
if foundProjects == nil {
57-
return nil, fmt.Errorf("no projects found under %s", targetPath.String())
57+
return nil, fmt.Errorf("no projects found under %s", targetPath)
5858
}
5959

6060
return foundProjects, nil
@@ -66,7 +66,7 @@ func findProjectsUnderPath(targetPath *paths.Path, projectType projecttype.Type,
6666

6767
isProject, foundProjectType := isProject(targetPath, projectType)
6868
if isProject {
69-
logrus.Tracef("%s is %s", targetPath.String(), projectType.String())
69+
logrus.Tracef("%s is %s", targetPath, projectType)
7070
foundProject := Type{
7171
Path: targetPath,
7272
ProjectType: foundProjectType,
@@ -132,40 +132,40 @@ func findSubprojects(superproject Type, apexSuperprojectType projecttype.Type) [
132132

133133
// isProject determines if a path contains an Arduino project, and if so which type.
134134
func isProject(potentialProjectPath *paths.Path, projectType projecttype.Type) (bool, projecttype.Type) {
135-
logrus.Tracef("Checking if %s is %s", potentialProjectPath.String(), projectType.String())
135+
logrus.Tracef("Checking if %s is %s", potentialProjectPath, projectType)
136136
if (projectType == projecttype.All || projectType == projecttype.Sketch) && isSketch(potentialProjectPath) {
137-
logrus.Tracef("%s is %s", potentialProjectPath.String(), projecttype.Sketch.String())
137+
logrus.Tracef("%s is %s", potentialProjectPath, projecttype.Sketch)
138138
return true, projecttype.Sketch
139139
} else if (projectType == projecttype.All || projectType == projecttype.Library) && isLibrary(potentialProjectPath) {
140-
logrus.Tracef("%s is %s", potentialProjectPath.String(), projecttype.Library.String())
140+
logrus.Tracef("%s is %s", potentialProjectPath, projecttype.Library)
141141
return true, projecttype.Library
142142
} else if (projectType == projecttype.All || projectType == projecttype.Platform) && isPlatform(potentialProjectPath) {
143-
logrus.Tracef("%s is %s", potentialProjectPath.String(), projecttype.Platform.String())
143+
logrus.Tracef("%s is %s", potentialProjectPath, projecttype.Platform)
144144
return true, projecttype.Platform
145145
} else if (projectType == projecttype.All || projectType == projecttype.PackageIndex) && isPackageIndex(potentialProjectPath) {
146-
logrus.Tracef("%s is %s", potentialProjectPath.String(), projecttype.PackageIndex.String())
146+
logrus.Tracef("%s is %s", potentialProjectPath, projecttype.PackageIndex)
147147
return true, projecttype.PackageIndex
148148
}
149149
return false, projecttype.Not
150150
}
151151

152152
// isProject determines if a file is the indicator file for an Arduino project, and if so which type.
153153
func isProjectIndicatorFile(potentialProjectFilePath *paths.Path, projectType projecttype.Type) (bool, projecttype.Type) {
154-
logrus.Tracef("Checking if %s is %s indicator file", potentialProjectFilePath.String(), projectType.String())
154+
logrus.Tracef("Checking if %s is %s indicator file", potentialProjectFilePath, projectType)
155155
if (projectType == projecttype.All || projectType == projecttype.Sketch) && isSketchIndicatorFile(potentialProjectFilePath) {
156-
logrus.Tracef("%s is %s indicator file", potentialProjectFilePath.String(), projecttype.Sketch.String())
156+
logrus.Tracef("%s is %s indicator file", potentialProjectFilePath, projecttype.Sketch)
157157
return true, projecttype.Sketch
158158
} else if (projectType == projecttype.All || projectType == projecttype.Library) && isLibraryIndicatorFile(potentialProjectFilePath) {
159-
logrus.Tracef("%s is %s indicator file", potentialProjectFilePath.String(), projecttype.Library.String())
159+
logrus.Tracef("%s is %s indicator file", potentialProjectFilePath, projecttype.Library)
160160
return true, projecttype.Library
161161
} else if (projectType == projecttype.All || projectType == projecttype.Platform) && isPlatformIndicatorFile(potentialProjectFilePath) {
162-
logrus.Tracef("%s is %s indicator file", potentialProjectFilePath.String(), projecttype.Platform.String())
162+
logrus.Tracef("%s is %s indicator file", potentialProjectFilePath, projecttype.Platform)
163163
return true, projecttype.Platform
164164
} else if (projectType == projecttype.All || projectType == projecttype.PackageIndex) && isPackageIndexIndicatorFile(potentialProjectFilePath) {
165-
logrus.Tracef("%s is %s indicator file", potentialProjectFilePath.String(), projecttype.PackageIndex.String())
165+
logrus.Tracef("%s is %s indicator file", potentialProjectFilePath, projecttype.PackageIndex)
166166
return true, projecttype.PackageIndex
167167
}
168-
logrus.Tracef("%s is not indicator file", potentialProjectFilePath.String())
168+
logrus.Tracef("%s is not indicator file", potentialProjectFilePath)
169169
return false, projecttype.Not
170170
}
171171

result/result.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ func Record(checkedProject project.Type, checkConfiguration checkconfigurations.
8484
os.Exit(errorcodes.ErrGeneric)
8585
}
8686

87-
summaryText := fmt.Sprintf("%v\n", checkResult.String())
87+
summaryText := fmt.Sprintf("%s\n", checkResult)
8888

8989
if checkResult == checkresult.NotRun {
9090
// TODO: make the check functions output an explanation for why they didn't run
91-
summaryText += fmt.Sprintf("%s: %s\n", checklevel.Notice.String(), checkOutput)
91+
summaryText += fmt.Sprintf("%s: %s\n", checklevel.Notice, checkOutput)
9292
} else if checkResult != checkresult.Pass {
93-
summaryText += fmt.Sprintf("%s: %s\n", checkLevel.String(), checkMessage)
93+
summaryText += fmt.Sprintf("%s: %s\n", checkLevel, checkMessage)
9494
}
9595

9696
checkReport := checkReportType{

0 commit comments

Comments
 (0)