-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60eb092
commit 723b37e
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
...s/tests/SonarAnalyzer.TestFramework.Test/TestCases/Dummy.SecondaryLocation_CSharp10.razor
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,15 @@ | ||
|
||
<p>The solution to all problems is: @(RaiseHere(21))</p> | ||
@* ^^^^^^^^^ *@ | ||
@* ^^ Secondary@-1 *@ | ||
|
||
@code | ||
{ | ||
private int magicNumber = RaiseHere(42); | ||
// ^^^^^^^^^ | ||
// ^^ Secondary@-1 | ||
private static int RaiseHere(int nb) | ||
{ | ||
return nb; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
analyzers/tests/SonarAnalyzer.TestFramework.Test/TestCases/DummyExpressions_CSharp10.razor
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,33 @@ | ||
<p>Explicit expression: @(RaiseHere())</p> @* Noncompliant *@ | ||
@* ^^^^^^^^^ *@ | ||
|
||
<p>Implicit expression: @RaiseHere()</p> @* Noncompliant *@ | ||
@* ^^^^^^^^^ *@ | ||
|
||
<p>Multi-statement block: @{ var result = RaiseHere(); }</p> | ||
@* ^^^^^^^^^ *@ | ||
|
||
<p>Control structures: @if(RaiseHere() == 42) { <text>42</text> }</p> | ||
@* ^^^^^^^^^ *@ | ||
|
||
<p>Loops: @for(var i = 0; i < RaiseHere(); i++) { <text>@i</text> }</p> | ||
@* ^^^^^^^^^ *@ | ||
|
||
<p>Code blocks: @{ RaiseHere(); }</p> | ||
@* ^^^^^^^^^ *@ | ||
|
||
<p>Lambda expression: @((Func<int>)(() => RaiseHere()))()</p> @* Noncompliant *@ | ||
@* ^^^^^^^^^ *@ | ||
|
||
<p>Nested multi-statement block: @{ var result2 = RaiseHere(); var result3 = RaiseHere(); }</p> | ||
@* ^^^^^^^^^ *@ | ||
@* ^^^^^^^^^@-1 *@ | ||
|
||
<p>Nested control structures: @if(RaiseHere() == 42) { <text>@(RaiseHere() + 1)</text> }</p> | ||
@* ^^^^^^^^^ *@ | ||
@* ^^^^^^^^^@-1 *@ | ||
|
||
@code | ||
{ | ||
private static int RaiseHere() { return 42; } | ||
} |
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