Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FP S3878: #6893 and #6894 #9395

Merged
merged 8 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
160 changes: 0 additions & 160 deletions analyzers/its/expected/Ember-MM/S3878-Ember Media Manager.json

This file was deleted.

28 changes: 0 additions & 28 deletions analyzers/its/expected/Ember-MM/S3878-generic.EmberCore.NMT.json

This file was deleted.

82 changes: 0 additions & 82 deletions analyzers/its/expected/Ember-MM/S3878-multi.EmberExtras.json

This file was deleted.

52 changes: 0 additions & 52 deletions analyzers/its/expected/Ember-MM/S3878-scraper.EmberCore.XML.json

This file was deleted.

This file was deleted.

12 changes: 6 additions & 6 deletions analyzers/src/SonarAnalyzer.CSharp/Rules/ArrayPassedAsParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ public sealed class ArrayPassedAsParams : ArrayPassedAsParamsBase<SyntaxKind, Ar
protected override ILanguageFacade<SyntaxKind> Language => CSharpFacade.Instance;

protected override SyntaxKind[] ExpressionKinds { get; } =
{
[
SyntaxKind.ObjectCreationExpression,
SyntaxKind.InvocationExpression,
SyntaxKindEx.ImplicitObjectCreationExpression
};
];

protected override ArgumentSyntax LastArgumentIfArrayCreation(SyntaxNode expression) =>
LastArgumentIfArrayCreation(ArgumentList(expression));

private static ArgumentSyntax LastArgumentIfArrayCreation(BaseArgumentListSyntax argumentList) =>
argumentList is { Arguments: { Count: > 0 } arguments }
ArgumentList(expression) is { Arguments: { Count: > 0 } arguments }
&& arguments.Last() is var lastArgument
&& IsArrayCreation(lastArgument.Expression)
? lastArgument
: null;

protected override ITypeSymbol ArrayElementType(ArgumentSyntax argument, SemanticModel model) =>
model.GetTypeInfo(((ArrayCreationExpressionSyntax)argument.Expression).Type.ElementType).Type;

private static BaseArgumentListSyntax ArgumentList(SyntaxNode expression) =>
expression switch
{
Expand Down
Loading
Loading