Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp: operation 'snake-free' in progress #1231

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

geffersonFerraz
Copy link
Member

Melhoria do spec_manipulator para que possamos avançar na remoção dos scripts em python.

Verified

This commit was signed with the committer’s verified signature.
geffersonFerraz Gefferson Ferraz
@geffersonFerraz geffersonFerraz self-assigned this Nov 5, 2024
@geffersonFerraz geffersonFerraz added enhancement New feature or request scripts scripts related issues labels Nov 5, 2024
@publi0 publi0 requested a review from Copilot December 11, 2024 14:13
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 7 out of 18 changed files in this pull request and generated 5 suggestions.

Files not reviewed (11)
  • mgc/spec_manipulator/build.sh: Language not supported
  • mgc/spec_manipulator/go.mod: Language not supported
  • mgc/spec_manipulator/cmd/download.go: Evaluated as low risk
  • mgc/spec_manipulator/cmd/spec/common.go: Evaluated as low risk
  • mgc/spec_manipulator/cmd/pipeline/gen_expected_cli_dump_tree.go: Evaluated as low risk
  • mgc/spec_manipulator/cmd/pipeline/root_pipeline.go: Evaluated as low risk
  • mgc/spec_manipulator/cmd/root.go: Evaluated as low risk
  • mgc/spec_manipulator/cmd/spec/add.go: Evaluated as low risk
  • mgc/spec_manipulator/cmd/pipeline/gen_expected_cli_doc_output.go: Evaluated as low risk
  • mgc/spec_manipulator/cmd/spec/delete.go: Evaluated as low risk
  • mgc/spec_manipulator/cmd/spec/downgrade.go: Evaluated as low risk
Comments skipped due to low confidence (2)

mgc/spec_manipulator/cmd/spec/prepare.go:75

  • The function CurrentDir() should handle errors and return a valid directory path or an error. Ensure the error is checked before using the path.
fmt.Println(filepath.Join(CurrentDir(), v.File))

mgc/spec_manipulator/cmd/spec/prepare.go:80

  • The function CurrentDir() should handle errors and return a valid directory path or an error. Ensure the error is checked before using the path.
file := filepath.Join(CurrentDir(), v.File)

func runPrepare(cmd *cobra.Command, args []string) {
_ = verificarEAtualizarDiretorio(currentDir())
func RunPrepare(cmd *cobra.Command, args []string) {
_ = verificarEAtualizarDiretorio(CurrentDir())
Copy link
Preview

Copilot AI Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function verificarEAtualizarDiretorio should handle the error returned by CurrentDir() to avoid potential runtime panics.

Suggested change
_ = verificarEAtualizarDiretorio(CurrentDir())
if dir, err := CurrentDir(); err == nil { _ = verificarEAtualizarDiretorio(dir) } else { /* handle error */ }

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

@@ -39,7 +39,7 @@ func runPrepare(cmd *cobra.Command, args []string) {
return
}

finalFile := filepath.Join(currentDir(), "specs.go.tmp")
finalFile := filepath.Join(CurrentDir(), "specs.go.tmp")
Copy link
Preview

Copilot AI Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function CurrentDir() should handle errors and return a valid directory path or an error. Ensure the error is checked before using the path.

Suggested change
finalFile := filepath.Join(CurrentDir(), "specs.go.tmp")
finalFile, err := filepath.Join(CurrentDir(), "specs.go.tmp")

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

@@ -193,7 +193,7 @@ func runPrepare(cmd *cobra.Command, args []string) {

fileStringBase64 = b64.StdEncoding.EncodeToString(fileBytes)

err = os.WriteFile(filepath.Join(currentDir(), v.File), fileBytes, 0644)
err = os.WriteFile(filepath.Join(CurrentDir(), v.File), fileBytes, 0644)
Copy link
Preview

Copilot AI Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function CurrentDir() should handle errors and return a valid directory path or an error. Ensure the error is checked before using the path.

Suggested change
err = os.WriteFile(filepath.Join(CurrentDir(), v.File), fileBytes, 0644)
currentDir, err := CurrentDir(); if err != nil { fmt.Println(err); return }; err = os.WriteFile(filepath.Join(currentDir, v.File), fileBytes, 0644)

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Run: func(cmd *cobra.Command, args []string) {
_ = verificarEAtualizarDiretorio(currentDir())
_ = verificarEAtualizarDiretorio(CurrentDir())
Copy link
Preview

Copilot AI Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function call verificarEAtualizarDiretorio(CurrentDir()) should handle the error returned by verificarEAtualizarDiretorio to avoid potential issues if the directory creation fails.

Suggested change
_ = verificarEAtualizarDiretorio(CurrentDir())
if err := verificarEAtualizarDiretorio(CurrentDir()); err != nil { log.Fatalf("Failed to update directory: %v", err) }

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

}

for _, v := range currentConfig {
_ = getAndSaveFile(v.Url, filepath.Join(CurrentDir(), v.File))
Copy link
Preview

Copilot AI Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error returned by getAndSaveFile is being ignored. This can lead to silent failures and make debugging difficult. Consider handling the error appropriately, such as logging it or returning it.

Suggested change
_ = getAndSaveFile(v.Url, filepath.Join(CurrentDir(), v.File))
if err := getAndSaveFile(v.Url, filepath.Join(CurrentDir(), v.File)); err != nil { fmt.Println(err) }

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request scripts scripts related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant