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

Fix and enable tfproviderlint R001 check: Use String Literals in Set() Calls #9951

Closed
ryndaniels opened this issue Sep 2, 2019 · 2 comments
Labels
linter Pertains to changes to or issues with the various linters. technical-debt Addresses areas of the codebase that need refactoring or redesign.

Comments

@ryndaniels
Copy link
Contributor

Description

As per tfproviderlint check R001, we want to make sure that we are passing string literals to Set() calls, rather than complex key arguments.

Failing example:

keys := []string{"example1", "example2"}
values := []string{"value1", "value2"}

for idx, key := range keys {
    d.Set(key, values[idx])
}

Should become:

d.Set("example1", "value1")
d.Set("example2", "value2")

Definition of Done

  • In GNUmakefile, add -R001 to tfproviderlint command under lint target and have TravisCI testing pass
@ryndaniels ryndaniels added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. technical-debt Addresses areas of the codebase that need refactoring or redesign. labels Sep 2, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 2, 2019
@ryndaniels ryndaniels removed the needs-triage Waiting for first response or review from a maintainer. label Sep 2, 2019
@ryndaniels ryndaniels changed the title Use String Literals in Set() Calls in Acceptance Tests Use String Literals in Set() Calls Sep 2, 2019
@ryndaniels ryndaniels removed the tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. label Sep 2, 2019
@bflad bflad changed the title Use String Literals in Set() Calls Fix and enable tfproviderlint R001 check: Use String Literals in Set() Calls Feb 3, 2020
bflad added a commit that referenced this issue Feb 3, 2020
Gaps in `tfproviderlint` checking are covered by the following issues:

Reference: #9950 (fix and enable AT003)
Reference: #11862 (fix and enable AT005)
Reference: #9951 (fix and enable R001)
Reference: #9952 (fix and enable R002)
Reference: #9953 (fix and enable R003)
Reference: #9954 (fix and enable R004)
Reference: #11863 (fix and enable R005)
Reference: #11864 (fix and enable R006)
Reference: #9955 (fix and enable S006)
Reference: #9956 (fix and enable S018)
Reference: #11865 (fix and enable S020)
Reference: #11866 (fix and enable S022)
Reference: #11867 (fix and enable S023)
Reference: #11868 (fix and enable S024)
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)
Reference: #11872 (fix and enable V001)
Reference: #11844 (fix and enable V002, V004, V005, V007, V008)
bflad added a commit that referenced this issue Feb 4, 2020
Gaps in `tfproviderlint` checking are covered by the following issues:

Reference: #9950 (fix and enable AT003)
Reference: #11862 (fix and enable AT005)
Reference: #9951 (fix and enable R001)
Reference: #9952 (fix and enable R002)
Reference: #9953 (fix and enable R003)
Reference: #9954 (fix and enable R004)
Reference: #11863 (fix and enable R005)
Reference: #11864 (fix and enable R006)
Reference: #9955 (fix and enable S006)
Reference: #9956 (fix and enable S018)
Reference: #11865 (fix and enable S020)
Reference: #11866 (fix and enable S022)
Reference: #11867 (fix and enable S023)
Reference: #11868 (fix and enable S024)
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)
Reference: #11872 (fix and enable V001)
Reference: #11844 (fix and enable V002, V004, V005, V007, V008)
bflad added a commit that referenced this issue Feb 19, 2020
Reference: #12074

Gaps in `tfproviderlint`/`awsproviderlint` checking are covered by the following issues:

Reference: #11888 (fix and enable AWSAT001)
Reference: #9950 (fix and enable AT003)
Reference: #11862 (fix and enable AT005)
Reference: #9951 (fix and enable R001)
Reference: #9952 (fix and enable R002)
Reference: #9953 (fix and enable R003)
Reference: #11863 (fix and enable R005)
Reference: #11864 (fix and enable R006)
Reference: #12083 (fix and enable R007, R008)
Reference: #9955 (fix and enable S006)
Reference: #9956 (fix and enable S018)
Reference: #11865 (fix and enable S020)
Reference: #11866 (fix and enable S022)
Reference: #11867 (fix and enable S023)
Reference: #11868 (fix and enable S024)
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)
Reference: #11872 (fix and enable V001)
Reference: #11844 (fix and enable V002, V004, V005, V007, V008)
bflad added a commit that referenced this issue Mar 10, 2020
Reference: #12074

Gaps in `tfproviderlint`/`awsproviderlint` checking are covered by the following issues:

Reference: #11888 (fix and enable AWSAT001)
Reference: #9950 (fix and enable AT003)
Reference: #11862 (fix and enable AT005)
Reference: #9951 (fix and enable R001)
Reference: #9952 (fix and enable R002)
Reference: #9953 (fix and enable R003)
Reference: #11863 (fix and enable R005)
Reference: #11864 (fix and enable R006)
Reference: #12083 (fix and enable R007, R008)
Reference: #9955 (fix and enable S006)
Reference: #9956 (fix and enable S018)
Reference: #11865 (fix and enable S020)
Reference: #11866 (fix and enable S022)
Reference: #11867 (fix and enable S023)
Reference: #11868 (fix and enable S024)
Reference: #11869 (fix and enable S031)
Reference: #11870 (fix and enable S032)
Reference: #11871 (fix and enable S033)
Reference: #11872 (fix and enable V001)
Reference: #11844 (fix and enable V002, V004, V005, V007, V008)
@anGie44 anGie44 self-assigned this May 11, 2020
bflad added a commit that referenced this issue Jul 14, 2020
…nd platform_princial hash removal

Reference: #3894
Reference: #9951
Reference: #12085
Reference: #13406

This also attempts to prevent the SetPlatformApplicationAttributes API call if no API updates need to occur. While we are in the midst of breaking changes and since this resource cannot be acceptance tested by the HashiCorp maintainers, this also fixes some other technical debt issues.
@bflad
Copy link
Contributor

bflad commented Aug 24, 2020

Snapshot of current reports:

aws/data_source_aws_vpc_dhcp_options.go:114:10: R001: ResourceData.Set() key argument should be string literal
aws/data_source_aws_vpc_dhcp_options.go:116:20: R001: ResourceData.Set() key argument should be string literal
aws/data_source_aws_vpc_dhcp_options.go:120:20: R001: ResourceData.Set() key argument should be string literal
aws/data_source_aws_vpc_dhcp_options.go:124:10: R001: ResourceData.Set() key argument should be string literal
aws/data_source_aws_vpc_dhcp_options.go:126:20: R001: ResourceData.Set() key argument should be string literal
aws/opsworks_layers.go:569:11: R001: ResourceData.Set() key argument should be string literal
aws/opsworks_layers.go:573:12: R001: ResourceData.Set() key argument should be string literal
aws/opsworks_layers.go:576:12: R001: ResourceData.Set() key argument should be string literal
aws/opsworks_layers.go:583:11: R001: ResourceData.Set() key argument should be string literal
aws/opsworks_layers.go:591:10: R001: ResourceData.Set() key argument should be string literal
aws/resource_aws_autoscaling_group_waiting_test.go:126:20: R001: ResourceData.Set() key argument should be string literal
aws/resource_aws_autoscaling_group_waiting_test.go:208:20: R001: ResourceData.Set() key argument should be string literal
aws/resource_aws_flow_log.go:234:9: R001: ResourceData.Set() key argument should be string literal
aws/resource_aws_sns_sms_preferences.go:137:9: R001: ResourceData.Set() key argument should be string literal
aws/resource_aws_sns_sms_preferences.go:144:10: R001: ResourceData.Set() key argument should be string literal
aws/resource_aws_vpc_dhcp_options.go:183:10: R001: ResourceData.Set() key argument should be string literal
aws/resource_aws_vpc_dhcp_options.go:190:10: R001: ResourceData.Set() key argument should be string literal

@breathingdust breathingdust added the linter Pertains to changes to or issues with the various linters. label Oct 27, 2020
@anGie44 anGie44 removed their assignment Sep 29, 2021
@github-actions
Copy link

github-actions bot commented Jun 7, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
linter Pertains to changes to or issues with the various linters. technical-debt Addresses areas of the codebase that need refactoring or redesign.
Projects
None yet
Development

No branches or pull requests

5 participants