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

Typos and simplified logic #2313

Merged
merged 3 commits into from
Aug 14, 2024
Merged

Typos and simplified logic #2313

merged 3 commits into from
Aug 14, 2024

Conversation

iwahbe
Copy link
Member

@iwahbe iwahbe commented Aug 14, 2024

This PR fixes 2 typos and removes a redundant check. 372e0ba contains a message explaining why it is safe.

Refactored out of #2309.

The body is `tfbridge.IsMaxItemsOne` is:

```go
func IsMaxItemsOne(tfs shim.Schema, info *SchemaInfo) bool {
	if tfs == nil {
		return false
	}
	if tfs.Type() != shim.TypeList && tfs.Type() != shim.TypeSet {
		return false
	}
	if info != nil && info.MaxItemsOne != nil {
		return *info.MaxItemsOne
	}
	return tfs.MaxItems() == 1
}
```

Thus, checking if `tfs` is of `shim.Type{List,Set}` before calling
`tfbridge.IsMaxItemsOne` is redundant.
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 56.86%. Comparing base (8b54f9b) to head (372e0ba).

Files Patch % Lines
pkg/tfgen/docs.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2313      +/-   ##
==========================================
- Coverage   56.87%   56.86%   -0.01%     
==========================================
  Files         365      365              
  Lines       49964    49962       -2     
==========================================
- Hits        28415    28413       -2     
  Misses      20004    20004              
  Partials     1545     1545              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@iwahbe iwahbe merged commit 992ffd4 into master Aug 14, 2024
11 checks passed
@iwahbe iwahbe deleted the iwahbe/misc-fixes branch August 14, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants