-
Notifications
You must be signed in to change notification settings - Fork 757
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
Add use-safe-access linter rule #14322
Conversation
Test this change out locally with the following install scripts (Action run 9552149357) VSCode
Azure CLI
|
|
||
[TestMethod] | ||
public void Codefix_fixes_syntax_which_can_be_simplified() => AssertCodeFix(""" | ||
param foo object |
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.
nit: Since """ removes leading spaces, it would be nice to have these indented.
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.
My preference is not to indent, even though it is supported by C#. For some tests, the preceding whitespace is meaningful to Bicep. I also like to be able to copy+paste directly from .bicep
file <-> code block; I find the formatting is often broken by the editor when attempting to indent.
nice |
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.
Don't forget to add a bug for documentation thx
[TestMethod] | ||
public void Rule_ignores_syntax_which_cannot_be_simplified() => AssertNoDiagnostics(""" | ||
param foo object | ||
var test = contains(foo, 'bar') ? foo.baz : 'baz' |
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.
Is property access in Azure case-sensitive?
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.
No
2431efa
to
e4058e8
Compare
e4058e8
to
2b2dc9e
Compare
Recommends against the following:
And instead suggests:
Microsoft Reviewers: Open in CodeFlow