Skip to content

Commit 4a7282f

Browse files
committed
CodeMaid cleanups.
1 parent c8df619 commit 4a7282f

File tree

12 files changed

+37
-63
lines changed

12 files changed

+37
-63
lines changed

dotnet/TagExpressions/ITagExpression.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ namespace Cucumber.TagExpressions;
55
/// </summary>
66
public interface ITagExpression
77
{
8-
/// <summary>
9-
/// Evaluates the tag expression against the provided input tags.
10-
/// </summary>
11-
/// <param name="inputs">A collection of input tags to evaluate against.</param>
12-
/// <returns><c>true</c> if the expression matches the inputs; otherwise, <c>false</c>.</returns>
13-
bool Evaluate(IEnumerable<string> inputs);
8+
/// <summary>
9+
/// Evaluates the tag expression against the provided input tags.
10+
/// </summary>
11+
/// <param name="inputs">A collection of input tags to evaluate against.</param>
12+
/// <returns><c>true</c> if the expression matches the inputs; otherwise, <c>false</c>.</returns>
13+
bool Evaluate(IEnumerable<string> inputs);
1414

15-
/// <summary>
16-
/// Returns the string representation of the tag expression.
17-
/// </summary>
18-
/// <returns>A string that represents the tag expression.</returns>
19-
string ToString();
15+
/// <summary>
16+
/// Returns the string representation of the tag expression.
17+
/// </summary>
18+
/// <returns>A string that represents the tag expression.</returns>
19+
string ToString();
2020
}
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
namespace Cucumber.TagExpressions
1+
namespace Cucumber.TagExpressions;
2+
3+
/// <summary>
4+
/// Defines a parser for tag expressions.
5+
/// </summary>
6+
public interface ITagExpressionParser
27
{
38
/// <summary>
4-
/// Defines a parser for tag expressions.
9+
/// Parses the specified text into an <see cref="ITagExpression"/>.
510
/// </summary>
6-
public interface ITagExpressionParser
7-
{
8-
/// <summary>
9-
/// Parses the specified text into an <see cref="ITagExpression"/>.
10-
/// </summary>
11-
/// <param name="text">The tag expression string to parse.</param>
12-
/// <returns>An <see cref="ITagExpression"/> representing the parsed expression.</returns>
13-
ITagExpression Parse(string text);
14-
}
11+
/// <param name="text">The tag expression string to parse.</param>
12+
/// <returns>An <see cref="ITagExpression"/> representing the parsed expression.</returns>
13+
ITagExpression Parse(string text);
1514
}

dotnet/TagExpressions/TagExpression.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
31
using System.Text;
42

53
namespace Cucumber.TagExpressions;
@@ -45,6 +43,7 @@ public class NullExpression : TagExpression
4543
{
4644
/// <inheritdoc/>
4745
public override string ToString() => "true";
46+
4847
/// <inheritdoc/>
4948
internal override bool EvaluateInternal(HashSet<string> inputs) => true;
5049
}
@@ -118,10 +117,12 @@ public class BinaryOpNode : TagExpression
118117
/// Gets the left operand of the binary operation.
119118
/// </summary>
120119
public ITagExpression Left { get; }
120+
121121
/// <summary>
122122
/// Gets the right operand of the binary operation.
123123
/// </summary>
124124
public ITagExpression Right { get; }
125+
125126
/// <summary>
126127
/// Gets the operator for the binary operation ("AND" or "OR").
127128
/// </summary>

dotnet/TagExpressions/TagExpressionException.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
4-
51
namespace Cucumber.TagExpressions;
62

73
public class TagExpressionException : ApplicationException

dotnet/TagExpressions/TagExpressionParser.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System.Text;
2-
31
namespace Cucumber.TagExpressions;
42

53
/// <summary>

dotnet/TagExpressions/TagLexer.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using System.Collections.Generic;
21
using System.Text;
32

43
namespace Cucumber.TagExpressions;
4+
55
internal class TagLexer
66
{
77
private readonly string _text;
@@ -68,20 +68,20 @@ private TagToken ReadToken(ref int pos)
6868
return new TagToken(TagTokenType.RParen, c.ToString(), pos - 1);
6969
}
7070

71-
// Operators
71+
// Operators
7272
var location = pos;
7373
var op = Operators
7474
.FirstOrDefault(o => _text.Substring(location).StartsWith(o, StringComparison.OrdinalIgnoreCase));
7575
if (op != null)
7676
{
7777
pos += op.Length;
7878
return new TagToken(op switch
79-
{
80-
"AND" => TagTokenType.And,
81-
"OR" => TagTokenType.Or,
82-
"NOT" => TagTokenType.Not,
83-
_ => throw new Exception("Unknown operator")
84-
},
79+
{
80+
"AND" => TagTokenType.And,
81+
"OR" => TagTokenType.Or,
82+
"NOT" => TagTokenType.Not,
83+
_ => throw new Exception("Unknown operator")
84+
},
8585
op,
8686
location);
8787
}

dotnet/TagExpressions/TagToken.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ public TagToken(TagTokenType type, string? value = null, int position = 0)
2424
Value = value;
2525
Position = position;
2626
}
27-
}
27+
}

dotnet/TagExpressionsTest/ErrorsTest.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
using System;
2-
using System.IO;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
71
using Cucumber.TagExpressions;
82

93
namespace Cucumber.TagExpressionsTest;
@@ -34,5 +28,4 @@ public void ParsedExpression_ShouldThrow(Dictionary<string, string> expectation)
3428
var ex = Assert.ThrowsException<TagExpressionException>(() => parser.Parse(expression));
3529
Assert.AreEqual(error, ex.Message);
3630
}
37-
3831
}

dotnet/TagExpressionsTest/EvaluationsTest.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
using System;
2-
using System.IO;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
71
using YamlDotNet.Serialization;
82
using YamlDotNet.Serialization.NamingConventions;
93

@@ -25,7 +19,7 @@ public class EvaluationsTest
2519
{
2620
foreach (var test in item.Tests)
2721
{
28-
yield return new object?[] { new Expectation { Expression = item.Expression, Result = test.Result, Variables = test.Variables} };
22+
yield return new object?[] { new Expectation { Expression = item.Expression, Result = test.Result, Variables = test.Variables } };
2923
}
3024
}
3125
}
@@ -39,18 +33,20 @@ public void EvaluatedExpression_MatchesExpectedResult(Expectation expectation)
3933
var result = expression.Evaluate(expectation.Variables);
4034
Assert.AreEqual(expectation.Result, result, $"Expression: {expectation.Expression}");
4135
}
42-
4336
}
37+
4438
public class TestCase
4539
{
4640
public string Expression { get; set; } = string.Empty;
4741
public List<Test> Tests { get; set; } = new List<Test>();
4842
}
43+
4944
public class Test
5045
{
5146
public List<string> Variables { get; set; } = new List<string>();
5247
public bool Result { get; set; }
5348
}
49+
5450
public class Expectation
5551
{
5652
public string Expression { get; set; } = string.Empty;

dotnet/TagExpressionsTest/ParsingTest.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Cucumber.TagExpressions;
2-
using YamlDotNet.Serialization;
32

43
namespace Cucumber.TagExpressionsTest;
54

0 commit comments

Comments
 (0)