-
Notifications
You must be signed in to change notification settings - Fork 226
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
24ec493
commit 7e0dada
Showing
6 changed files
with
72 additions
and
4 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; | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
analyzers/tests/SonarAnalyzer.TestFramework.Test/TestCases/Dummy.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,5 +29,5 @@ | |
|
||
@functions | ||
{ | ||
private static int RaiseHere() => 42; | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,5 +29,5 @@ | |
|
||
@code | ||
{ | ||
private static int RaiseHere() => 42; | ||
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