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
18 changes: 0 additions & 18 deletions analyzers/its/expected/CSharpLatest/S2325-CSharpLatest-net8.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/CSharpLatest/CSharpLatest/CSharp9Features/CovariantReturn.cs#L38",
"Location": "Line 38 Position 17-24"
},
{
"Id": "S2325",
"Message": "Make \u0027TryParse\u0027 a static method.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/CSharpLatest/CSharpLatest/CSharp9Features/ExtendingPartial.cs#L25",
"Location": "Line 25 Position 27-35"
},
{
"Id": "S2325",
"Message": "Make \u0027Method\u0027 a static method.",
Expand Down Expand Up @@ -288,18 +282,6 @@
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/CSharpLatest/CSharpLatest/CSharp9Features/S3247.cs#L10",
"Location": "Line 10 Position 17-20"
},
{
"Id": "S2325",
"Message": "Make \u0027M11\u0027 a static method.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/CSharpLatest/CSharpLatest/CSharp9Features/S3251.Part2.cs#L22",
"Location": "Line 22 Position 24-27"
},
{
"Id": "S2325",
"Message": "Make \u0027M12\u0027 a static method.",
"Uri": "https://github.com/SonarSource/sonar-dotnet/blob/master/analyzers/its/Projects/CSharpLatest/CSharpLatest/CSharp9Features/S3251.Part2.cs#L27",
"Location": "Line 27 Position 25-28"
},
{
"Id": "S2325",
"Message": "Make \u0027SuggestSelectAndWhere\u0027 a static method.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@ public override ImmutableArray<SyntaxToken> LocalDeclarationIdentifiers(SyntaxNo
Cast<LocalDeclarationStatementSyntax>(node).Declaration.Variables.Select(x => x.Identifier).ToImmutableArray();

public override SyntaxKind[] ModifierKinds(SyntaxNode node) =>
node is TypeDeclarationSyntax typeDeclaration
? typeDeclaration.Modifiers.Select(x => x.Kind()).ToArray()
: Array.Empty<SyntaxKind>();
(node switch
{
TypeDeclarationSyntax x => x.Modifiers,
BaseMethodDeclarationSyntax x => x.Modifiers,
_ => [],
}).Select(x => x.Kind()).ToArray();

public override SyntaxNode NodeExpression(SyntaxNode node) =>
node switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ private static void CheckIssue<TDeclarationSyntax>(SonarSyntaxNodeReportingConte
where TDeclarationSyntax : MemberDeclarationSyntax
{
var declaration = (TDeclarationSyntax)context.Node;
if (IsEmptyMethod(declaration))
if (IsEmptyMethod(declaration)
|| CSharpFacade.Instance.Syntax.ModifierKinds(declaration).Contains(SyntaxKind.PartialKeyword))
{
return;
}
Expand Down Expand Up @@ -200,7 +201,7 @@ private static bool IsInstanceMember(ExpressionSyntax node, SemanticModel model)

// Checking for primary constructor parameters
static bool IsConstructorParameter(ISymbol symbol) =>
symbol is IParameterSymbol { ContainingSymbol: IMethodSymbol { MethodKind: MethodKind.Constructor } };
symbol is IParameterSymbol { ContainingSymbol: IMethodSymbol { MethodKind: MethodKind.Constructor } };
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,25 @@ public PropertyInitialization Create() // FN - because of the property initializ
return new PropertyInitialization { Prop = 42 };
}
}

// https://github.com/SonarSource/sonar-dotnet/issues/8025
partial class PartialClass
{
public void WriteEverything()
{
Console.WriteLine("Something");

WriteMore();
}

partial void WriteMore();
}

partial class PartialClass
{
partial void WriteMore() // Compliant
{
Console.WriteLine("More");
}
}
}