Skip to content

Commit

Permalink
fix and make condition shorter
Browse files Browse the repository at this point in the history
  • Loading branch information
mary-georgiou-sonarsource committed Jul 31, 2023
1 parent 9f9c44d commit 9e26499
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ public override ProgramState ConditionEvaluated(SymbolicContext context)
return base.ConditionEvaluated(context);

static bool IsConstField(IOperation operation) =>
operation?.TrackedSymbol() is { } symbol
&& symbol as IFieldSymbol is { } field
operation?.TrackedSymbol() as IFieldSymbol is { } field
&& field.IsConst;

}

public override void ExecutionCompleted()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public static void M_Fixed(string path, int timeoutmilliseconds = 500)
do
{
try
{s
{
Console.WriteLine("May throw");
deletesuccess = true;
}
Expand Down Expand Up @@ -415,7 +415,7 @@ public void MemberBinding2(Exception ex)
{
}
else if (ex == null) // Compliant
{
{
}
else if (ex.Message != null) // FN
{
Expand All @@ -439,13 +439,13 @@ public void Foo()
string str = value;

if (str == null) // Compliant
{
{
Console.WriteLine("null");
}

bool? b = value;
if (b == null) // Compliant
{
{
Console.WriteLine("null");
}
}
Expand Down

0 comments on commit 9e26499

Please sign in to comment.