-
Notifications
You must be signed in to change notification settings - Fork 232
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 (#8973)
- Loading branch information
1 parent
b993838
commit 8a64975
Showing
5 changed files
with
131 additions
and
16 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
11 changes: 11 additions & 0 deletions
11
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,11 @@ | ||
@* the next line is necessary for the razor generator to properly interpret the asp-for attribute *@ | ||
@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
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