Skip to content

Conversation

@neil-yechenwei
Copy link
Contributor

@neil-yechenwei neil-yechenwei commented May 11, 2024

--- 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)

Copy link
Member

@lonegunmanb lonegunmanb left a 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!

Copy link
Member

@matt-FFFFFF matt-FFFFFF left a 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"
Copy link
Member

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") {
Copy link
Member

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?

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.

3 participants