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

Staticcheck fixes in terraform package #27429

Merged
merged 1 commit into from
Jan 8, 2021
Merged

Staticcheck fixes in terraform package #27429

merged 1 commit into from
Jan 8, 2021

Conversation

pselle
Copy link
Contributor

@pselle pselle commented Jan 6, 2021

Fixes within the terraform package to remove staticcheck errors from running staticcheck github.com/hashicorp/terraform/terraform.

The following notices were fixed:

  • Makes error last return
  • Unused value
  • Unnecessary type transformation
  • Errors are lowercase and don't end in punctuation

On the last item, it means that some error appearances will change:

        Plugin reinitialization required. Please run "terraform init".
        
        [... cut for brevity...]
        
        2 problems:
        
        - failed to instantiate provider "registry.terraform.io/hashicorp/unknown" to obtain schema: unknown provider "registry.terraform.io/hashicorp/unknown"

(These bulleted items are now lowercase)

@pselle pselle changed the title Staticcheck fixes Staticcheck fixes in terraform package Jan 6, 2021
Fixes within the terraform package to remove staticcheck errors
@pselle pselle force-pushed the pselle/staticcheck branch from bc360fc to fb5f7b9 Compare January 7, 2021 15:29
@codecov
Copy link

codecov bot commented Jan 7, 2021

Codecov Report

Merging #27429 (fb5f7b9) into master (0a31fa0) will increase coverage by 0.00%.
The diff coverage is 54.83%.

Impacted Files Coverage Δ
terraform/transform_import_state.go 87.12% <0.00%> (ø)
terraform/transform_provider.go 81.43% <ø> (-0.08%) ⬇️
terraform/transform_vertex.go 45.45% <0.00%> (ø)
terraform/schemas.go 65.13% <25.00%> (ø)
terraform/node_resource_abstract_instance.go 71.98% <55.55%> (ø)
terraform/node_resource_apply_instance.go 49.76% <100.00%> (ø)
terraform/node_resource_destroy.go 61.79% <100.00%> (ø)
terraform/node_resource_destroy_deposed.go 56.75% <100.00%> (ø)
terraform/node_resource_plan.go 96.11% <0.00%> (-1.95%) ⬇️
internal/providercache/dir.go 73.46% <0.00%> (+6.12%) ⬆️

Copy link
Member

@jbardin jbardin left a comment

Choose a reason for hiding this comment

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

Thanks @pselle! The staticcheck CI PR adds a script and make target which skips all the of the "style" related checks, and legacy packages as a starting point.

The error messages originally broke the recommended style, because they were often meant to be displayed as the full message in the UI. Since we now have other means of formatting errors (primarily using tfdiags) we can slowly convert them as needed, but there are a lot to cover.

@pselle
Copy link
Contributor Author

pselle commented Jan 8, 2021

@jbardin Thanks for the reminder about the staticcheck PR! I'm looking forward to when that lands.

@pselle pselle merged commit d175e67 into master Jan 8, 2021
@pselle pselle deleted the pselle/staticcheck branch January 8, 2021 16:10
@ghost
Copy link

ghost commented Feb 8, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Feb 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants