Skip to content

Commit

Permalink
Split poetry update from the addRepoToPyprojectFile function
Browse files Browse the repository at this point in the history
  • Loading branch information
EyalDelarea committed Mar 10, 2024
1 parent 685c9c3 commit ad2f5ac
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions utils/python/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,20 @@ func ConfigPoetryRepo(url, username, password, configRepoName string) error {
if err != nil {
return errorutils.CheckError(err)
}
return addRepoToPyprojectFile(filepath.Join(currentDir, pyproject), configRepoName, url)
if err = addRepoToPyprojectFile(filepath.Join(currentDir, pyproject), configRepoName, url); err != nil {
return err
}
return poetryUpdate(err)
}

func poetryUpdate(err error) error {

Check failure on line 90 in utils/python/utils.go

View workflow job for this annotation

GitHub Actions / Static-Check

`poetryUpdate` - `err` is unused (unparam)
log.Info("Running Poetry update")
cmd := io.NewCommand("poetry", "update", []string{"--verbose"})
err = gofrogcmd.RunCmd(cmd)

Check failure on line 93 in utils/python/utils.go

View workflow job for this annotation

GitHub Actions / Static-Check

SA4009(related information): assignment to err (staticcheck)
if err != nil {
return errorutils.CheckErrorf("Poetry config command failed with: %s", err.Error())
}
return nil
}

func runPoetryConfigCommand(args []string, maskArgs bool) error {
Expand Down Expand Up @@ -113,11 +126,5 @@ func addRepoToPyprojectFile(filepath, poetryRepoName, repoUrl string) error {
return errorutils.CheckErrorf("Failed to add tool.poetry.source to pyproject.toml: %s", err.Error())
}
log.Info(fmt.Sprintf("Added tool.poetry.source name:%q url:%q", poetryRepoName, repoUrl))
log.Info("Running Poetry update")
cmd := io.NewCommand("poetry", "update", []string{})
err = gofrogcmd.RunCmd(cmd)
if err != nil {
return errorutils.CheckErrorf("Poetry config command failed with: %s", err.Error())
}
return err
}

0 comments on commit ad2f5ac

Please sign in to comment.