Skip to content

Commit

Permalink
Fix MA0048 reporting on all types (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
meziantou authored Oct 2, 2023
1 parent ecbaab8 commit 4e703c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private static void AnalyzeSymbol(SymbolAnalysisContext context)

private static ReadOnlySpan<char> GetFileName(ReadOnlySpan<char> filePath)
{
var fileNameIndex = filePath.IndexOfAny('/', '\\');
var fileNameIndex = filePath.LastIndexOfAny('/', '\\');
if (fileNameIndex > 0)
{
filePath = filePath[(fileNameIndex + 1)..];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ await CreateProjectBuilder()
.WithSourceCode("Sample.xaml.cs", @"
class Sample
{
}")
.ValidateAsync();
}

[Fact]
public async Task MatchFileName()
{
await CreateProjectBuilder()
.WithSourceCode("Root\\Foo/Bar.cs", @"
class Bar
{
}")
.ValidateAsync();
}
Expand Down

0 comments on commit 4e703c6

Please sign in to comment.