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

chore: fix typo in method names #212

Merged
merged 1 commit into from
Aug 22, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override IEnumerable<FluentAssertionsCSharpSyntaxVisitor> Visitors

public class AnyShouldBeFalseSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public AnyShouldBeFalseSyntaxVisitor() : base(MemberValidator.MathodNotContainingLambda("Any"), MemberValidator.Should, new MemberValidator("BeFalse"))
public AnyShouldBeFalseSyntaxVisitor() : base(MemberValidator.MethodNotContainingLambda("Any"), MemberValidator.Should, new MemberValidator("BeFalse"))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected override IEnumerable<FluentAssertionsCSharpSyntaxVisitor> Visitors

public class OrderByShouldEqualSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public OrderByShouldEqualSyntaxVisitor() : base(MemberValidator.MathodContainingLambda("OrderBy"), MemberValidator.Should, MemberValidator.ArgumentIsVariable("Equal"))
public OrderByShouldEqualSyntaxVisitor() : base(MemberValidator.MethodContainingLambda("OrderBy"), MemberValidator.Should, MemberValidator.ArgumentIsVariable("Equal"))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected override IEnumerable<FluentAssertionsCSharpSyntaxVisitor> Visitors

public class OrderByDescendingShouldEqualSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public OrderByDescendingShouldEqualSyntaxVisitor() : base(MemberValidator.MathodContainingLambda("OrderByDescending"), MemberValidator.Should, MemberValidator.ArgumentIsVariable("Equal"))
public OrderByDescendingShouldEqualSyntaxVisitor() : base(MemberValidator.MethodContainingLambda("OrderByDescending"), MemberValidator.Should, MemberValidator.ArgumentIsVariable("Equal"))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ protected override IEnumerable<FluentAssertionsCSharpSyntaxVisitor> Visitors

public class AnyShouldBeTrueSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public AnyShouldBeTrueSyntaxVisitor() : base(MemberValidator.MathodContainingLambda("Any"), MemberValidator.Should, new MemberValidator("BeTrue"))
public AnyShouldBeTrueSyntaxVisitor() : base(MemberValidator.MethodContainingLambda("Any"), MemberValidator.Should, new MemberValidator("BeTrue"))
{
}
}

public class WhereShouldNotBeEmptySyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public WhereShouldNotBeEmptySyntaxVisitor() : base(MemberValidator.MathodContainingLambda("Where"), MemberValidator.Should, new MemberValidator("NotBeEmpty"))
public WhereShouldNotBeEmptySyntaxVisitor() : base(MemberValidator.MethodContainingLambda("Where"), MemberValidator.Should, new MemberValidator("NotBeEmpty"))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected override bool ShouldAnalyzeVariableNamedType(INamedTypeSymbol type, Se

public class WhereShouldHaveCount1SyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public WhereShouldHaveCount1SyntaxVisitor() : base(MemberValidator.MathodContainingLambda("Where"), MemberValidator.Should, MemberValidator.ArgumentIsLiteral("HaveCount", 1))
public WhereShouldHaveCount1SyntaxVisitor() : base(MemberValidator.MethodContainingLambda("Where"), MemberValidator.Should, MemberValidator.ArgumentIsLiteral("HaveCount", 1))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override IEnumerable<FluentAssertionsCSharpSyntaxVisitor> Visitors
public class SelectShouldEqualOtherCollectionSelectSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public SelectShouldEqualOtherCollectionSelectSyntaxVisitor()
: base(MemberValidator.MathodContainingLambda("Select"), MemberValidator.Should, new MemberValidator("Equal", MathodContainingArgumentInvokingLambda))
: base(MemberValidator.MethodContainingLambda("Select"), MemberValidator.Should, new MemberValidator("Equal", MathodContainingArgumentInvokingLambda))
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ protected override IEnumerable<FluentAssertionsCSharpSyntaxVisitor> Visitors

public class CountShouldBe0SyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public CountShouldBe0SyntaxVisitor() : base(MemberValidator.MathodNotContainingLambda("Count"), MemberValidator.Should, MemberValidator.ArgumentIsLiteral("Be", 0))
public CountShouldBe0SyntaxVisitor() : base(MemberValidator.MethodNotContainingLambda("Count"), MemberValidator.Should, MemberValidator.ArgumentIsLiteral("Be", 0))
{
}
}

public class CountShouldBe1SyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public CountShouldBe1SyntaxVisitor() : base(MemberValidator.MathodNotContainingLambda("Count"), MemberValidator.Should, MemberValidator.ArgumentIsLiteral("Be", 1))
public CountShouldBe1SyntaxVisitor() : base(MemberValidator.MethodNotContainingLambda("Count"), MemberValidator.Should, MemberValidator.ArgumentIsLiteral("Be", 1))
{
}
}

public class CountShouldBeSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public CountShouldBeSyntaxVisitor() : base(MemberValidator.MathodNotContainingLambda("Count"), MemberValidator.Should, new MemberValidator("Be"))
public CountShouldBeSyntaxVisitor() : base(MemberValidator.MethodNotContainingLambda("Count"), MemberValidator.Should, new MemberValidator("Be"))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class IndexerShouldBeSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor

public class SkipFirstShouldBeSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public SkipFirstShouldBeSyntaxVisitor() : base(new MemberValidator("Skip"), MemberValidator.MathodNotContainingLambda("First"), MemberValidator.Should, new MemberValidator("Be"))
public SkipFirstShouldBeSyntaxVisitor() : base(new MemberValidator("Skip"), MemberValidator.MethodNotContainingLambda("First"), MemberValidator.Should, new MemberValidator("Be"))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override IEnumerable<FluentAssertionsCSharpSyntaxVisitor> Visitors

public class AnyShouldBeTrueSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public AnyShouldBeTrueSyntaxVisitor() : base(MemberValidator.MathodNotContainingLambda("Any"), MemberValidator.Should, new MemberValidator("BeTrue"))
public AnyShouldBeTrueSyntaxVisitor() : base(MemberValidator.MethodNotContainingLambda("Any"), MemberValidator.Should, new MemberValidator("BeTrue"))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected override IEnumerable<FluentAssertionsCSharpSyntaxVisitor> Visitors

public class SelectShouldNotContainNullsSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public SelectShouldNotContainNullsSyntaxVisitor() : base(MemberValidator.MathodContainingLambda("Select"), MemberValidator.Should, new MemberValidator("NotContainNulls"))
public SelectShouldNotContainNullsSyntaxVisitor() : base(MemberValidator.MethodContainingLambda("Select"), MemberValidator.Should, new MemberValidator("NotContainNulls"))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ protected override IEnumerable<FluentAssertionsCSharpSyntaxVisitor> Visitors

public class AnyShouldBeFalseSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public AnyShouldBeFalseSyntaxVisitor() : base(MemberValidator.MathodContainingLambda("Any"), MemberValidator.Should, new MemberValidator("BeFalse"))
public AnyShouldBeFalseSyntaxVisitor() : base(MemberValidator.MethodContainingLambda("Any"), MemberValidator.Should, new MemberValidator("BeFalse"))
{
}
}

public class WhereShouldBeEmptySyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public WhereShouldBeEmptySyntaxVisitor() : base(MemberValidator.MathodContainingLambda("Where"), MemberValidator.Should, new MemberValidator("BeEmpty"))
public WhereShouldBeEmptySyntaxVisitor() : base(MemberValidator.MethodContainingLambda("Where"), MemberValidator.Should, new MemberValidator("BeEmpty"))
{
}
}

public class ShouldOnlyContainSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public ShouldOnlyContainSyntaxVisitor() : base(MemberValidator.Should, MemberValidator.MathodContainingLambda("OnlyContain"))
public ShouldOnlyContainSyntaxVisitor() : base(MemberValidator.Should, MemberValidator.MethodContainingLambda("OnlyContain"))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected override IEnumerable<FluentAssertionsCSharpSyntaxVisitor> Visitors

public class AllShouldBeTrueSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public AllShouldBeTrueSyntaxVisitor() : base(MemberValidator.MathodContainingLambda("All"), MemberValidator.Should, new MemberValidator("BeTrue"))
public AllShouldBeTrueSyntaxVisitor() : base(MemberValidator.MethodContainingLambda("All"), MemberValidator.Should, new MemberValidator("BeTrue"))
{
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private static bool ArgumentInvokesDistinctMethod(SeparatedSyntaxList<ArgumentSy
var visitor = new FluentAssertionsCSharpSyntaxVisitor(new MemberValidator(nameof(Enumerable.Distinct)));
invocation.Accept(visitor);

return visitor.IsValid(invocation) && VariableNameExtractor.ExtractVariabeName(arguments.First()) == VariableNameExtractor.ExtractVariabeName(invocation);
return visitor.IsValid(invocation) && VariableNameExtractor.ExtractVariableName(arguments.First()) == VariableNameExtractor.ExtractVariableName(invocation);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected override IEnumerable<FluentAssertionsCSharpSyntaxVisitor> Visitors

public class SelectShouldOnlyHaveUniqueItemsSyntaxVisitor : FluentAssertionsCSharpSyntaxVisitor
{
public SelectShouldOnlyHaveUniqueItemsSyntaxVisitor() : base(MemberValidator.MathodContainingLambda("Select"), MemberValidator.Should, new MemberValidator("OnlyHaveUniqueItems"))
public SelectShouldOnlyHaveUniqueItemsSyntaxVisitor() : base(MemberValidator.MethodContainingLambda("Select"), MemberValidator.Should, new MemberValidator("OnlyHaveUniqueItems"))
{
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/FluentAssertions.Analyzers/Utilities/MemberValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public bool MatchesElementAccessExpression(ElementAccessExpressionSyntax element
public static MemberValidator Which { get; } = new MemberValidator(nameof(Which));
public static MemberValidator Should { get; } = new MemberValidator(nameof(Should));

public static MemberValidator MathodNotContainingLambda(string name) => new MemberValidator(name, MethodNotContainingLambdaPredicate);
public static MemberValidator MathodContainingLambda(string name) => new MemberValidator(name, MethodContainingLambdaPredicate);
public static MemberValidator MethodNotContainingLambda(string name) => new MemberValidator(name, MethodNotContainingLambdaPredicate);
public static MemberValidator MethodContainingLambda(string name) => new MemberValidator(name, MethodContainingLambdaPredicate);
public static MemberValidator ArgumentIsVariable(string name) => new MemberValidator(name, ArgumentIsVariablePredicate);
public static MemberValidator ArgumentIsLiteral<T>(string name, T value) => new MemberValidator(name, (arguments, semanticModel) => ArgumentIsLiteralPredicate(arguments, value));
public static MemberValidator ArgumentIsIdentifierOrLiteral(string name) => new MemberValidator(name, ArgumentIsIdentifierOrLiteralPredicate);
Expand Down Expand Up @@ -74,7 +74,7 @@ public static bool ArgumentIsVariablePredicate(ArgumentSyntax argument)
{
var argumentName = identifier.Identifier.Text;

var variableName = VariableNameExtractor.ExtractVariabeName(argument);
var variableName = VariableNameExtractor.ExtractVariableName(argument);

return variableName == argumentName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ public override void Visit(SyntaxNode node)
}
}

public static string ExtractVariabeName(ArgumentSyntax argument)
public static string ExtractVariableName(ArgumentSyntax argument)
{
if (argument.Parent is ArgumentListSyntax argumentList && argumentList.Parent is InvocationExpressionSyntax invocation)
{
return ExtractVariabeName(invocation);
return ExtractVariableName(invocation);
}
return null;
}

public static string ExtractVariabeName(InvocationExpressionSyntax invocation)
public static string ExtractVariableName(InvocationExpressionSyntax invocation)
{
var variableExtractor = new VariableNameExtractor();
invocation.Accept(variableExtractor);
Expand Down
Loading