Skip to content

Commit

Permalink
#13619 SecureParameter linter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlloyduk authored and David Lloyd committed Mar 25, 2024
1 parent 191c794 commit b8b21e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
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);
}

}
}
Original file line number Diff line number Diff line change
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;
}
else if (defaultValue is ObjectSyntax objectSyntax && !objectSyntax.Properties.Any())
{
// Empty object - okay
Expand Down

0 comments on commit b8b21e1

Please sign in to comment.