Skip to content

Commit 487cd48

Browse files
committed
refactor(main.go, npm_test.go): remove processProjectFile, use processProjectFileByType directly
Eliminate redundant processProjectFile function and update its usages and tests to call processProjectFileByType directly, simplifying project file handling logic.
1 parent abe9601 commit 487cd48

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

main.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ func processCargoPackage(packagePath string) error {
1919
return nil
2020
}
2121

22-
func processProjectFile() error {
23-
return processProjectFileByType(Ctx.ProjectType, Ctx.ProjectFilePath)
24-
}
25-
2622
func processProjectFileByType(projectType TypeOfProject, projectFilePath string) error {
2723
switch projectType {
2824
case NPM:
@@ -87,7 +83,7 @@ func main() {
8783
foundSupported, err := scanProjectFiles(entries, func(projectType TypeOfProject, projectFilePath string) error {
8884
Ctx.ProjectType = projectType
8985
Ctx.ProjectFilePath = projectFilePath
90-
return processProjectFile()
86+
return processProjectFileByType(Ctx.ProjectType, Ctx.ProjectFilePath)
9187
})
9288

9389
if err != nil {

npm_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,10 @@ func TestProcessNPMPackage(t *testing.T) {
462462
})
463463
}
464464

465-
func TestProcessProjectFile(t *testing.T) {
465+
func TestProcessProjectFileByType(t *testing.T) {
466466
withTestContext(t, Context{ProjectType: NotSupported, ProjectFilePath: "unknown.lock"})
467467

468-
err := processProjectFile()
468+
err := processProjectFileByType(Ctx.ProjectType, Ctx.ProjectFilePath)
469469
if err == nil {
470470
t.Fatal("expected unsupported project type to return an error")
471471
}

0 commit comments

Comments
 (0)