-
Notifications
You must be signed in to change notification settings - Fork 7
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
TFNFR11 - Category: Code Style - Null Comparison Toggle #29
base: main
Are you sure you want to change the base?
Conversation
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.
LGTM, thanks @neil-yechenwei !
@matt-FFFFFF Would you please give this rule a review? Thanks!
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.
Some comments for discussion
} | ||
|
||
func (t *NullComparisonToggleRule) Link() string { | ||
return "https://azure.github.io/Azure-Verified-Modules/specs/terraform/#id-tfnfr11---category-code-style---null-comparison-toggle" |
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 no mention of the local
workaround in the spec here - do we need to update this as well?
break | ||
} | ||
|
||
if v, ok := dynamicVal.(hcl.TraverseAttr); ok && strings.HasSuffix(strings.ToLower(v.Name), "_id") { |
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.
Should we change this condition to all string values - rather than only those traversals that end with _id
?
--- PASS: TestNullComparisonToggle/object_variable_exists,_ok (0.00s)
--- PASS: TestNullComparisonToggle/string_local_exists,_ok (0.00s)
--- PASS: TestNullComparisonToggle/string_variable_and_another_condition_exist,_not_ok (0.00s)
--- PASS: TestNullComparisonToggle/string_variable_exists,_not_ok (0.00s)
--- PASS: TestNullComparisonToggle/string_variable_exists_and_the_expression_starts_with_null,not_ok (0.00s)
--- PASS: TestNullComparisonToggle/string_variable_with
!=
_exists,_not_ok (0.00s)