-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX S2252 FP: Rule raises issue in case of non integer value in for l…
…oop. (#5523)
- Loading branch information
1 parent
0af0058
commit 13cdb8f
Showing
5 changed files
with
63 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
analyzers/tests/SonarAnalyzer.UnitTest/TestCases/ForLoopConditionAlwaysFalse.CSharp9.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
|
||
namespace Tests.Diagnostics | ||
{ | ||
class Program | ||
{ | ||
void LoopTest(int x, int y) | ||
{ | ||
for (nint i = 9; i >= 5;) { } // Compliant | ||
for (nuint i = 9; i >= 5;) { } // Compliant | ||
|
||
for (nint a = 0, b = 1; b < 1;) { } // Noncompliant | ||
for (nuint a = 0, b = 1; b < 1;) { } // Noncompliant | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters