-
Notifications
You must be signed in to change notification settings - Fork 568
support PLANOUT #2077
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
support PLANOUT #2077
Changes from 5 commits
0e4c1ea
af41122
a61cd78
b90269b
e4c90db
5062781
e69c284
94e494f
05c88b0
20aff88
d317ac7
480b5e5
eee9a3c
329ac93
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -192,7 +192,7 @@ func (d DiggerExecutor) RetrievePlanJson() (string, error) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| showArgs := make([]string, 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| terraformPlanOutput, _, _ := executor.TerraformExecutor.Show(showArgs, executor.CommandEnvVars, *storedPlanPath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| terraformPlanOutput, _, _ := executor.TerraformExecutor.Show(showArgs, executor.CommandEnvVars, *storedPlanPath, true) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code ignores the error returned from the The
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return terraformPlanOutput, nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
194
to
196
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The The fix adds proper error handling to check if the
Suggested change
Comment on lines
194
to
196
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the The method calls This is particularly problematic because the method assumes that the output from The fix properly captures and returns the error from the
Suggested change
Comment on lines
194
to
196
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The If the The fix adds proper error handling to check if the
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -202,7 +202,7 @@ func (d DiggerExecutor) RetrievePlanJson() (string, error) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func (d DiggerExecutor) Plan() (*iac_utils.IacSummary, bool, bool, string, string, error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| plan := "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| terraformPlanOutput := "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| terraformPlanOutputJsonString := "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variable The function already calls The fix adds a call to the Show command to populate the variable with the JSON output before returning it.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the The bug is that the value from This is a bug because the return value is expected to contain the JSON output from Terraform's plan, but it's always returning an empty string, which could cause issues for any code that depends on this value.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| planSummary := &iac_utils.IacSummary{} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isEmptyPlan := true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var planSteps []scheduler.Step | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -219,6 +219,11 @@ func (d DiggerExecutor) Plan() (*iac_utils.IacSummary, bool, bool, string, strin | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| hasPlanStep := lo.ContainsBy(planSteps, func(step scheduler.Step) bool { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return step.Action == "plan" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for _, step := range planSteps { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slog.Info("Running step", "action", step.Action) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if step.Action == "init" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -234,46 +239,20 @@ func (d DiggerExecutor) Plan() (*iac_utils.IacSummary, bool, bool, string, strin | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // TODO remove those only for pulumi project | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| planArgs = append(planArgs, step.ExtraArgs...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _, stdout, stderr, err := d.TerraformExecutor.Plan(planArgs, d.CommandEnvVars, d.PlanPathProvider.LocalPlanFilePath(), d.PlanStage.FilterRegex) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _, _, _, err := d.TerraformExecutor.Plan(planArgs, d.CommandEnvVars, d.PlanPathProvider.LocalPlanFilePath(), d.PlanStage.FilterRegex) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _, _, _, err := d.TerraformExecutor.Plan(planArgs, d.CommandEnvVars, d.PlanPathProvider.LocalPlanFilePath(), d.PlanStage.FilterRegex) | |
| var filterRegex *string | |
| if d.PlanStage != nil { | |
| filterRegex = d.PlanStage.FilterRegex | |
| } | |
| _, _, _, err := d.TerraformExecutor.Plan(planArgs, d.CommandEnvVars, d.PlanPathProvider.LocalPlanFilePath(), filterRegex) |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a potential nil pointer dereference in the Plan method of DiggerExecutor. On line 241, d.PlanStage.FilterRegex is accessed without first checking if d.PlanStage is nil.
While there is a check at the beginning of the method (lines 209-220) to initialize planSteps if d.PlanStage is nil, there's no similar check when accessing d.PlanStage.FilterRegex directly in the call to d.TerraformExecutor.Plan().
If d.PlanStage is nil at this point, accessing d.PlanStage.FilterRegex would cause a nil pointer dereference and result in a panic.
The fix adds a check to safely handle the case where d.PlanStage might be nil by creating a local variable filterRegex that is only set from d.PlanStage.FilterRegex if d.PlanStage is not nil.
| _, _, _, err := d.TerraformExecutor.Plan(planArgs, d.CommandEnvVars, d.PlanPathProvider.LocalPlanFilePath(), d.PlanStage.FilterRegex) | |
| var filterRegex *string | |
| if d.PlanStage != nil { | |
| filterRegex = d.PlanStage.FilterRegex | |
| } | |
| _, _, _, err := d.TerraformExecutor.Plan(planArgs, d.CommandEnvVars, d.PlanPathProvider.LocalPlanFilePath(), filterRegex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When there's no explicit plan step (hasPlanStep is false), the code still tries to post-process the plan by calling d.postProcessPlan(plan). However, the postProcessPlan function attempts to read and process a plan file at d.PlanPathProvider.LocalPlanFilePath() which wouldn't exist if no plan step was executed.
This will lead to errors when trying to read a non-existent file in the postProcessPlan function, specifically at line 317 where it calls os.ReadFile(d.PlanPathProvider.LocalPlanFilePath()). The error is properly caught and returned, but it's an unnecessary error condition that could be avoided by simply not attempting to post-process when there's no plan step.
| if !hasPlanStep { | |
| var err error | |
| plan, planSummary, isEmptyPlan, err = d.postProcessPlan(plan) | |
| if err != nil { | |
| slog.Debug("error post processing plan", | |
| "error", err, | |
| "plan", plan, | |
| "planSummary", planSummary, | |
| "isEmptyPlan", isEmptyPlan, | |
| ) | |
| return nil, false, false, "", "", fmt.Errorf("error post processing plan: %v", err) //nolint:wrapcheck // err | |
| } | |
| } | |
| if !hasPlanStep { | |
| // Skip post-processing if there was no plan step, as there won't be a plan file to process | |
| slog.Debug("No plan step found, skipping post-processing") | |
| } |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the postProcessPlan method, there's no check to ensure that the plan file exists before trying to read it. This can lead to errors if the plan file doesn't exist, as the Show method will attempt to read a non-existent file.
The fix adds a check using os.Stat to verify the file exists before proceeding with the Show command. If the file doesn't exist, it returns an appropriate error message that includes the path that was checked, making debugging easier.
| showArgs := make([]string, 0) | |
| terraformPlanOutput, _, _ := d.TerraformExecutor.Show(showArgs, d.CommandEnvVars, d.PlanPathProvider.LocalPlanFilePath(), true) | |
| showArgs := make([]string, 0) | |
| // Check if plan file exists before trying to read it | |
| if _, err := os.Stat(d.PlanPathProvider.LocalPlanFilePath()); os.IsNotExist(err) { | |
| return "", nil, false, fmt.Errorf("plan file does not exist at %s: %v", d.PlanPathProvider.LocalPlanFilePath(), err) | |
| } | |
| terraformPlanOutput, _, _ := d.TerraformExecutor.Show(showArgs, d.CommandEnvVars, d.PlanPathProvider.LocalPlanFilePath(), true) |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the postProcessPlan method, errors from the Show command are also ignored. If the Show command fails, the error is silently ignored and the method continues processing with potentially empty or invalid plan output. This could lead to incorrect plan summaries or other downstream issues.
The fix adds proper error handling to check if the Show command fails and returns an appropriate error message that includes both the error and stderr output for better debugging.
| showArgs := make([]string, 0) | |
| terraformPlanOutput, _, _ := d.TerraformExecutor.Show(showArgs, d.CommandEnvVars, d.PlanPathProvider.LocalPlanFilePath(), true) | |
| showArgs := make([]string, 0) | |
| terraformPlanOutput, stderr, err := d.TerraformExecutor.Show(showArgs, d.CommandEnvVars, d.PlanPathProvider.LocalPlanFilePath(), true) | |
| if err != nil { | |
| return "", nil, false, fmt.Errorf("error showing plan: %v, stderr: %s", err, stderr) | |
| } |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Logic error: 'err' variable is nil at this point (last assignment was from Show() call), but you're checking if err != nil. This will never execute the error logging.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an inconsistent error handling pattern in the postProcessPlan function. At line 332-334, there's an if err != nil check that logs an error but doesn't return it. This is problematic because:
- The
errvariable being checked was already handled earlier in the function (at lines 301-304) and would have been returned if it was non-nil. - By this point in the code,
errshould always be nil unless there's a logic error elsewhere. - The error message "error publishing comment" doesn't match any operation being performed in this section of code.
This appears to be a leftover error check that should be removed, as it's checking an error that has already been handled and is using an error message that doesn't match the current operation.
| // TODO: move this function to iacUtils interface and implement for pulumi | |
| cleanedUpPlan := cleanupTerraformPlan(stdout) | |
| if err != nil { | |
| slog.Error("error publishing comment", "error", err) | |
| } | |
| // TODO: move this function to iacUtils interface and implement for pulumi | |
| cleanedUpPlan := cleanupTerraformPlan(stdout) |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bug in the postProcessPlan method where there's an error check at line 332-334 that doesn't make sense. The err variable being checked is not defined in the local scope at this point - the last err variable was defined and handled at line 323-327 for the StorePlanFile operation.
This error check is meaningless and should be removed as it's checking a variable that's already been handled earlier in the function. The code will never log an error here because if there was an error with StorePlanFile, the function would have already returned with an error.
| // TODO: move this function to iacUtils interface and implement for pulumi | |
| cleanedUpPlan := cleanupTerraformPlan(stdout) | |
| if err != nil { | |
| slog.Error("error publishing comment", "error", err) | |
| } | |
| // TODO: move this function to iacUtils interface and implement for pulumi | |
| cleanedUpPlan := cleanupTerraformPlan(stdout) |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bug in the postProcessPlan function where there's an if err != nil check at line 339 that logs an error but doesn't return it. This is problematic because:
- The
errvariable being checked is from the previousStorePlanFilecall at line 330, which already has its own error handling that returns the error. - If there was an error in
StorePlanFile, the function would have already returned before reaching this check. - This means the error check is redundant and misleading - it's checking a variable that would never contain an error at this point in the code.
This could lead to confusion during debugging and code maintenance. The error check should be removed or commented out to clarify that it's not needed.
| // TODO: move this function to iacUtils interface and implement for pulumi | |
| cleanedUpPlan := cleanupTerraformPlan(stdout) | |
| if err != nil { | |
| slog.Error("error publishing comment", "error", err) | |
| } | |
| // TODO: move this function to iacUtils interface and implement for pulumi | |
| cleanedUpPlan := cleanupTerraformPlan(stdout) | |
| // This err check is incorrect - err is from StorePlanFile above and has already been handled | |
| // If there was an error, we would have already returned |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the postProcessPlan method in libs/execution/execution.go, there is an if err != nil check on line 340-342 after the cleanupTerraformPlan call. However, cleanupTerraformPlan doesn't return an error - it only returns a string. This means the error check is checking the previous error variable from line 330, which is unrelated to the cleanupTerraformPlan function call.
This is a bug because the error check is misplaced and is checking an error from a previous operation (the PlanStorage.StorePlanFile call) rather than being related to the cleanupTerraformPlan function. This could lead to confusing log messages where errors from storing the plan file are reported as "error publishing comment".
| // TODO: move this function to iacUtils interface and implement for pulumi | |
| cleanedUpPlan := cleanupTerraformPlan(stdout) | |
| if err != nil { | |
| slog.Error("error publishing comment", "error", err) | |
| } | |
| // TODO: move this function to iacUtils interface and implement for pulumi | |
| cleanedUpPlan := cleanupTerraformPlan(stdout) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,7 +63,7 @@ func (tf OpenTofu) Plan(params []string, envs map[string]string, planArtefactFil | |
| return statusCode == 2, stdout, stderr, nil | ||
| } | ||
|
|
||
| func (tf OpenTofu) Show(params []string, envs map[string]string, planArtefactFilePath string) (string, string, error) { | ||
| func (tf OpenTofu) Show(params []string, envs map[string]string, planArtefactFilePath string, b bool) (string, string, error) { | ||
| params = append(params, []string{"-no-color", "-json", planArtefactFilePath}...) | ||
|
||
| stdout, stderr, _, err := tf.runOpentofuCommand("show", false, envs, nil, params...) | ||
| if err != nil { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -62,7 +62,7 @@ func (terragrunt Terragrunt) Plan(params []string, envs map[string]string, planA | |||||
| return true, stdout, stderr, err | ||||||
| } | ||||||
|
|
||||||
| func (terragrunt Terragrunt) Show(params []string, envs map[string]string, planArtefactFilePath string) (string, string, error) { | ||||||
| func (terragrunt Terragrunt) Show(params []string, envs map[string]string, planArtefactFilePath string, b bool) (string, string, error) { | ||||||
|
||||||
| func (terragrunt Terragrunt) Show(params []string, envs map[string]string, planArtefactFilePath string, b bool) (string, string, error) { | |
| func (terragrunt Terragrunt) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Unlike the Terraform implementation, the -json flag is hardcoded here. Consider making this conditional based on the boolean parameter for consistency across executors.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,7 +16,7 @@ type TerraformExecutor interface { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Apply([]string, *string, map[string]string) (string, string, error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Destroy([]string, map[string]string) (string, string, error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Plan([]string, map[string]string, string, *string) (bool, string, string, error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Show([]string, map[string]string, string) (string, string, error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Show([]string, map[string]string, string, bool) (string, string, error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The boolean parameter in the Show method interface is not descriptive. It should be documented with a comment to indicate its purpose (returnJson) for better code readability and maintainability.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The TerraformExecutor interface in libs/execution/tf.go has a boolean parameter in the Show method signature without any documentation explaining its purpose. This makes it difficult for future developers to understand what this parameter does without digging through implementation code. Additionally, there's a typo in the implementation where the parameter is named The fix adds proper documentation to the interface method explaining that the boolean parameter controls whether the output should be in JSON format or human-readable format.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the TerraformExecutor interface, the parameter in the Show method is named simply 'bool', which is not descriptive of its purpose. In the implementation (Terraform.Show method), this parameter is named 'retrunJson' (which also has a typo - it should be 'returnJson'). The interface should be updated to use a more descriptive parameter name that matches its purpose, which is to indicate whether the output should be returned in JSON format. This improves code readability and makes the interface more self-documenting.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type Terraform struct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -167,8 +167,12 @@ func (tf Terraform) Plan(params []string, envs map[string]string, planArtefactFi | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return statusCode == 2, stdout, stderr, nil | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string) (string, string, error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| params = append(params, []string{"-no-color", "-json", planArtefactFilePath}...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | |
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter name retrunJson in the Terraform.Show method has a typo. It should be returnJson instead of retrunJson.
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | |
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter retrunJson in the Show method is misspelled and should be returnJson. This typo makes the code harder to maintain and understand. Correcting the spelling would improve code readability and consistency with the other implementations.
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | |
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the parameter name in the Terraform.Show method implementation. The parameter is named 'retrunJson' but should be 'returnJson'. This typo should be fixed to maintain consistent and correct naming throughout the codebase.
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | |
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the parameter name of the Show method in the Terraform struct. The parameter is named retrunJson instead of returnJson. This typo should be fixed for better code readability and consistency.
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if retrunJson { | |
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if returnJson { |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the parameter name 'retrunJson' in the Show method of the Terraform struct. The parameter should be named 'returnJson' instead. This typo could lead to confusion for developers maintaining the code, as it doesn't follow the standard naming convention and could be easily misread. Consistent parameter naming is important for code readability and maintainability.
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if retrunJson { | |
| params = append(params, "-json") | |
| } | |
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if returnJson { | |
| params = append(params, "-json") | |
| } |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the parameter name retrunJson in the Show method of the Terraform struct. The parameter should be named returnJson instead. This typo could cause confusion for developers who are trying to understand or use this method, as the parameter name doesn't clearly convey its purpose due to the misspelling.
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if retrunJson { | |
| params = append(params, "-json") | |
| } | |
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if returnJson { | |
| params = append(params, "-json") | |
| } |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the parameter name retrunJson in the Show method of the Terraform struct. The parameter name should be returnJson (with "return" spelled correctly). This typo could cause confusion for future developers who are trying to understand or modify this code, as it makes the code less readable and could lead to inconsistent naming conventions throughout the codebase.
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if retrunJson { | |
| params = append(params, "-json") | |
| } | |
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if returnJson { | |
| params = append(params, "-json") | |
| } |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a typo in the parameter name of the Show method implementation in the Terraform struct. The parameter is named retrunJson instead of returnJson, which is confusing and inconsistent with the intended meaning. This typo should be fixed to improve code readability and maintainability.
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if retrunJson { | |
| params = append(params, "-json") | |
| } | |
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if returnJson { | |
| params = append(params, "-json") | |
| } |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the parameter name retrunJson in the Show method of the Terraform struct. The parameter should be named returnJson instead. This typo could cause confusion for future developers who might expect the parameter to be named correctly. The typo is consistent throughout the method, so the code will still function correctly, but it's a readability and maintainability issue.
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if retrunJson { | |
| params = append(params, "-json") | |
| } | |
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if returnJson { | |
| params = append(params, "-json") | |
| } |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the parameter name in the Show method implementation in libs/execution/tf.go. The parameter is named retrunJson instead of returnJson. This is inconsistent with the correct spelling that would be expected and could cause confusion for developers working with this code. The typo appears in both the function signature and where the parameter is used in the conditional statement.
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if retrunJson { | |
| params = append(params, "-json") | |
| } | |
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if returnJson { | |
| params = append(params, "-json") | |
| } |
motatoes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter name retrunJson in the Show method of the Terraform struct is misspelled. It should be returnJson instead. This typo could cause confusion for developers maintaining the code and makes the codebase less consistent.
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, retrunJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if retrunJson { | |
| params = append(params, "-json") | |
| } | |
| func (tf Terraform) Show(params []string, envs map[string]string, planArtefactFilePath string, returnJson bool) (string, string, error) { | |
| params = append(params, "-no-color") | |
| if returnJson { | |
| params = append(params, "-json") | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Parameter name 'b' is non-descriptive. Consider using 'returnJson' or 'asJson' to match the intent of the real implementation.