Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix enum contained flags check for partial matches in [RCS1258](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1258) ([PR](https://github.com/dotnet/roslynator/pull/1740) by @ovska)
- Fix analyzer [RCS1146](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1146) ([PR](https://github.com/dotnet/roslynator/pull/1747))
- Fix analyzer [RCS1194](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1194) ([PR](https://github.com/dotnet/roslynator/pull/1733))
- Fix analyzer [RCS1060](https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1060) to ignore classes marked with `file` modifier ([PR](https://github.com/dotnet/roslynator/pull/1777) by @cbersch)
- [CLI] Fix `fix` command ignoring `--include` / `--exclude` file filter ([PR](https://github.com/dotnet/roslynator/pull/1758) by @hashiiiii)

## [4.15.0] - 2025-12-14
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ void Analyze(SyntaxList<MemberDeclarationSyntax> members)
{
Analyze(namespaceDeclaration.Members);
}
else if (SyntaxFacts.IsTypeDeclaration(member.Kind()))
else if (SyntaxFacts.IsTypeDeclaration(member.Kind())
#if ROSLYN_4_4
&& !member.Modifiers.Contains(SyntaxKind.FileKeyword)
#endif
)
{
if (firstTypeDeclaration is null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,30 @@ namespace N;
public class C2
{
}
""");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.DeclareEachTypeInSeparateFile)]
public async Task Test_FirstClassWithFileKeyword_NoDiagnostic()
{
await VerifyNoDiagnosticAsync("""
namespace N
{
file class C1;
public class C2;
}
""");
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.DeclareEachTypeInSeparateFile)]
public async Task Test_LastClassWithFileKeyword_NoDiagnostic()
{
await VerifyNoDiagnosticAsync("""
namespace N
{
public class C1;
file class C2;
}
""");
}
}
Loading