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

#13619 secure parameter linter fix #13717

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -201,5 +201,18 @@ public void HandlesSyntaxErrors(int diagnosticCount, string text)
AssertLinterRuleDiagnostics(SecureParameterDefaultRule.Code, text, diagnosticCount, new Options(OnCompileErrors.Ignore));
}

[DataRow(0, @"
@secure()
output param1 string

@secure()
output param2 string = param1
")]
[DataTestMethod]
public void VariableAssignment_TestPasses(int diagnosticCount, string text)
{
AssertLinterRuleDiagnostics(SecureParameterDefaultRule.Code, text, diagnosticCount);
}

}
}
Expand Up @@ -34,6 +34,11 @@ override public IEnumerable<IDiagnostic> AnalyzeInternal(SemanticModel model, Di
// Empty string - okay
continue;
}
else if (defaultValue is VariableAccessSyntax variableAccessSyntax)
{
// Variable - okay
continue;
}
anthony-c-martin marked this conversation as resolved.
Show resolved Hide resolved
else if (defaultValue is ObjectSyntax objectSyntax && !objectSyntax.Properties.Any())
{
// Empty object - okay
Expand Down