Skip to content

Commit

Permalink
refactor: remove unused functions, function rename
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-mlr committed Oct 31, 2024
1 parent 76c371f commit d126df4
Showing 1 changed file with 2 additions and 37 deletions.
39 changes: 2 additions & 37 deletions service/objectScanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func scanRepository(config *model.RemoteConfiguration, db *sqlx.DB) error {
continue
}

err = traverseRepo2(db, config, branch)
err = scanAndInsertRepositoryFiles(db, config, branch)
if err != nil {
log.Printf("Error traversing repository %s %s", config.RepositoryURL, err)
continue
Expand All @@ -71,7 +71,7 @@ func scanRepository(config *model.RemoteConfiguration, db *sqlx.DB) error {
return nil
}

func traverseRepo2(db *sqlx.DB, config *model.RemoteConfiguration, branch model.Branch) error {
func scanAndInsertRepositoryFiles(db *sqlx.DB, config *model.RemoteConfiguration, branch model.Branch) error {
var found []model.Found
var apps []model.AppJsonFile

Expand Down Expand Up @@ -165,41 +165,6 @@ func traverseRepo2(db *sqlx.DB, config *model.RemoteConfiguration, branch model.
return nil
}

func getAppJsonFiles(config *model.RemoteConfiguration) ([]model.AppJsonFile, error) {
apps := []model.AppJsonFile{}

err := Walk(config, func(f *object.File) error {
if !f.Mode.IsFile() {
return nil
}

if !strings.Contains(f.Name, "app.json") {
return nil
}

app := model.AppJsonFile{}

content, err := f.Contents()
if err != nil {
return err
}

err = json.Unmarshal([]byte(content), &app)
if err != nil {
return err
}

p := strings.Replace(f.Name, "app.json", "", 1)
app.BasePath = p

apps = append(apps, app)

return nil
})

return apps, err
}

func findMatches(lines *[]string, file string) (model.ObjectType, string, int, error) {
pattern := regexp.MustCompile(`^(\w+) (\d{1,6}) "?"?([^"]*)?"?`)

Expand Down

0 comments on commit d126df4

Please sign in to comment.