-
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.
Fix S3247 FP: Rule should not trigger when variable is used for data …
…binding on Razor/MVC views
- Loading branch information
1 parent
81bdd15
commit 996c0d3
Showing
4 changed files
with
52 additions
and
21 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
10 changes: 10 additions & 0 deletions
10
analyzers/tests/SonarAnalyzer.Test/TestCases/CastShouldNotBeDuplicated.cshtml
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,10 @@ | ||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers | ||
@model Base | ||
|
||
@if (Model is Derived) // Compliant | ||
{ | ||
<div> | ||
<input class="form-control" type="text" asp-for="@(((Derived)Model).Prop)" /> @* // Compliant *@ | ||
<span asp-validation-for="@(((Derived)Model).Prop)" class="text-danger"></span> @* // Compliant *@ | ||
</div> | ||
} |
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