Skip to content

Commit

Permalink
Update generator formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Romfos committed Sep 15, 2024
1 parent 9b9679a commit 99873a7
Show file tree
Hide file tree
Showing 63 changed files with 238 additions and 224 deletions.
4 changes: 2 additions & 2 deletions codegen/templates/dotnet.dotnet.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ public sealed record <%= class_name(key) %>
isValueType = type_for(class_name(key), property_name, property) == 'long' || type_for(class_name(key), property_name, property) == 'bool' || property['enum'] != nil
-%>
<%- if !isValueType && required -%>
this.<%= capitalize(property_name) %> = <%= property_name %> ?? throw new ArgumentNullException("<%= capitalize(property_name) %>", "<%= class_name(key) %>.<%= capitalize(property_name) %> cannot be null");
<%= capitalize(property_name) %> = <%= property_name %> ?? throw new ArgumentNullException("<%= capitalize(property_name) %>", "<%= class_name(key) %>.<%= capitalize(property_name) %> cannot be null");
<%- else -%>
this.<%= capitalize(property_name) %> = <%= property_name %>;
<%= capitalize(property_name) %> = <%= property_name %>;
<%- end -%>
<%- end -%>
}
Expand Down
6 changes: 4 additions & 2 deletions codegen/templates/dotnet.enum.dotnet.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ namespace Io.Cucumber.Messages.Types;
// the code is regenerated.
// ------------------------------------------------------------------------------

public enum <%= enum[:name] %> {
public enum <%= enum[:name] %>
{
<% enum[:values].each.with_index(1) do |value, index| -%>

[Description("<%= value%>")]
Expand All @@ -21,7 +22,8 @@ public enum <%= enum[:name] %> {

public static class <%= enum[:name] %>Extensions
{
public static string Value(this <%= enum[:name] %> v) {
public static string Value(this <%= enum[:name] %> v)
{
var attribute = v.GetType().GetField(v.ToString())?.GetCustomAttribute<DescriptionAttribute>();
return attribute == null ? v.ToString() : attribute.Description;
}
Expand Down
16 changes: 8 additions & 8 deletions dotnet/Cucumber.Messages/generated/Attachment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ public Attachment(
string? url
)
{
this.Body = body ?? throw new ArgumentNullException("Body", "Attachment.Body cannot be null");
this.ContentEncoding = contentEncoding;
this.FileName = fileName;
this.MediaType = mediaType ?? throw new ArgumentNullException("MediaType", "Attachment.MediaType cannot be null");
this.Source = source;
this.TestCaseStartedId = testCaseStartedId;
this.TestStepId = testStepId;
this.Url = url;
Body = body ?? throw new ArgumentNullException("Body", "Attachment.Body cannot be null");
ContentEncoding = contentEncoding;
FileName = fileName;
MediaType = mediaType ?? throw new ArgumentNullException("MediaType", "Attachment.MediaType cannot be null");
Source = source;
TestCaseStartedId = testCaseStartedId;
TestStepId = testStepId;
Url = url;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ namespace Io.Cucumber.Messages.Types;
// the code is regenerated.
// ------------------------------------------------------------------------------

public enum AttachmentContentEncoding {
public enum AttachmentContentEncoding
{

[Description("IDENTITY")]
IDENTITY,
Expand All @@ -20,7 +21,8 @@ public enum AttachmentContentEncoding {

public static class AttachmentContentEncodingExtensions
{
public static string Value(this AttachmentContentEncoding v) {
public static string Value(this AttachmentContentEncoding v)
{
var attribute = v.GetType().GetField(v.ToString())?.GetCustomAttribute<DescriptionAttribute>();
return attribute == null ? v.ToString() : attribute.Description;
}
Expand Down
12 changes: 6 additions & 6 deletions dotnet/Cucumber.Messages/generated/Background.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public Background(
string id
)
{
this.Location = location ?? throw new ArgumentNullException("Location", "Background.Location cannot be null");
this.Keyword = keyword ?? throw new ArgumentNullException("Keyword", "Background.Keyword cannot be null");
this.Name = name ?? throw new ArgumentNullException("Name", "Background.Name cannot be null");
this.Description = description ?? throw new ArgumentNullException("Description", "Background.Description cannot be null");
this.Steps = steps ?? throw new ArgumentNullException("Steps", "Background.Steps cannot be null");
this.Id = id ?? throw new ArgumentNullException("Id", "Background.Id cannot be null");
Location = location ?? throw new ArgumentNullException("Location", "Background.Location cannot be null");
Keyword = keyword ?? throw new ArgumentNullException("Keyword", "Background.Keyword cannot be null");
Name = name ?? throw new ArgumentNullException("Name", "Background.Name cannot be null");
Description = description ?? throw new ArgumentNullException("Description", "Background.Description cannot be null");
Steps = steps ?? throw new ArgumentNullException("Steps", "Background.Steps cannot be null");
Id = id ?? throw new ArgumentNullException("Id", "Background.Id cannot be null");
}
}
8 changes: 4 additions & 4 deletions dotnet/Cucumber.Messages/generated/Ci.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public Ci(
Git? git
)
{
this.Name = name ?? throw new ArgumentNullException("Name", "Ci.Name cannot be null");
this.Url = url;
this.BuildNumber = buildNumber;
this.Git = git;
Name = name ?? throw new ArgumentNullException("Name", "Ci.Name cannot be null");
Url = url;
BuildNumber = buildNumber;
Git = git;
}
}
4 changes: 2 additions & 2 deletions dotnet/Cucumber.Messages/generated/Comment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Comment(
string text
)
{
this.Location = location ?? throw new ArgumentNullException("Location", "Comment.Location cannot be null");
this.Text = text ?? throw new ArgumentNullException("Text", "Comment.Text cannot be null");
Location = location ?? throw new ArgumentNullException("Location", "Comment.Location cannot be null");
Text = text ?? throw new ArgumentNullException("Text", "Comment.Text cannot be null");
}
}
4 changes: 2 additions & 2 deletions dotnet/Cucumber.Messages/generated/DataTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public DataTable(
List<TableRow> rows
)
{
this.Location = location ?? throw new ArgumentNullException("Location", "DataTable.Location cannot be null");
this.Rows = rows ?? throw new ArgumentNullException("Rows", "DataTable.Rows cannot be null");
Location = location ?? throw new ArgumentNullException("Location", "DataTable.Location cannot be null");
Rows = rows ?? throw new ArgumentNullException("Rows", "DataTable.Rows cannot be null");
}
}
8 changes: 4 additions & 4 deletions dotnet/Cucumber.Messages/generated/DocString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public DocString(
string delimiter
)
{
this.Location = location ?? throw new ArgumentNullException("Location", "DocString.Location cannot be null");
this.MediaType = mediaType;
this.Content = content ?? throw new ArgumentNullException("Content", "DocString.Content cannot be null");
this.Delimiter = delimiter ?? throw new ArgumentNullException("Delimiter", "DocString.Delimiter cannot be null");
Location = location ?? throw new ArgumentNullException("Location", "DocString.Location cannot be null");
MediaType = mediaType;
Content = content ?? throw new ArgumentNullException("Content", "DocString.Content cannot be null");
Delimiter = delimiter ?? throw new ArgumentNullException("Delimiter", "DocString.Delimiter cannot be null");
}
}
4 changes: 2 additions & 2 deletions dotnet/Cucumber.Messages/generated/Duration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Duration(
long nanos
)
{
this.Seconds = seconds;
this.Nanos = nanos;
Seconds = seconds;
Nanos = nanos;
}
}
34 changes: 17 additions & 17 deletions dotnet/Cucumber.Messages/generated/Envelope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,22 +451,22 @@ public Envelope(
UndefinedParameterType? undefinedParameterType
)
{
this.Attachment = attachment;
this.GherkinDocument = gherkinDocument;
this.Hook = hook;
this.Meta = meta;
this.ParameterType = parameterType;
this.ParseError = parseError;
this.Pickle = pickle;
this.Source = source;
this.StepDefinition = stepDefinition;
this.TestCase = testCase;
this.TestCaseFinished = testCaseFinished;
this.TestCaseStarted = testCaseStarted;
this.TestRunFinished = testRunFinished;
this.TestRunStarted = testRunStarted;
this.TestStepFinished = testStepFinished;
this.TestStepStarted = testStepStarted;
this.UndefinedParameterType = undefinedParameterType;
Attachment = attachment;
GherkinDocument = gherkinDocument;
Hook = hook;
Meta = meta;
ParameterType = parameterType;
ParseError = parseError;
Pickle = pickle;
Source = source;
StepDefinition = stepDefinition;
TestCase = testCase;
TestCaseFinished = testCaseFinished;
TestCaseStarted = testCaseStarted;
TestRunFinished = testRunFinished;
TestRunStarted = testRunStarted;
TestStepFinished = testStepFinished;
TestStepStarted = testStepStarted;
UndefinedParameterType = undefinedParameterType;
}
}
16 changes: 8 additions & 8 deletions dotnet/Cucumber.Messages/generated/Examples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public Examples(
string id
)
{
this.Location = location ?? throw new ArgumentNullException("Location", "Examples.Location cannot be null");
this.Tags = tags ?? throw new ArgumentNullException("Tags", "Examples.Tags cannot be null");
this.Keyword = keyword ?? throw new ArgumentNullException("Keyword", "Examples.Keyword cannot be null");
this.Name = name ?? throw new ArgumentNullException("Name", "Examples.Name cannot be null");
this.Description = description ?? throw new ArgumentNullException("Description", "Examples.Description cannot be null");
this.TableHeader = tableHeader;
this.TableBody = tableBody ?? throw new ArgumentNullException("TableBody", "Examples.TableBody cannot be null");
this.Id = id ?? throw new ArgumentNullException("Id", "Examples.Id cannot be null");
Location = location ?? throw new ArgumentNullException("Location", "Examples.Location cannot be null");
Tags = tags ?? throw new ArgumentNullException("Tags", "Examples.Tags cannot be null");
Keyword = keyword ?? throw new ArgumentNullException("Keyword", "Examples.Keyword cannot be null");
Name = name ?? throw new ArgumentNullException("Name", "Examples.Name cannot be null");
Description = description ?? throw new ArgumentNullException("Description", "Examples.Description cannot be null");
TableHeader = tableHeader;
TableBody = tableBody ?? throw new ArgumentNullException("TableBody", "Examples.TableBody cannot be null");
Id = id ?? throw new ArgumentNullException("Id", "Examples.Id cannot be null");
}
}
6 changes: 3 additions & 3 deletions dotnet/Cucumber.Messages/generated/Exception.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public Exception(
string? stackTrace
)
{
this.Type = type ?? throw new ArgumentNullException("Type", "Exception.Type cannot be null");
this.Message = message;
this.StackTrace = stackTrace;
Type = type ?? throw new ArgumentNullException("Type", "Exception.Type cannot be null");
Message = message;
StackTrace = stackTrace;
}
}
14 changes: 7 additions & 7 deletions dotnet/Cucumber.Messages/generated/Feature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public Feature(
List<FeatureChild> children
)
{
this.Location = location ?? throw new ArgumentNullException("Location", "Feature.Location cannot be null");
this.Tags = tags ?? throw new ArgumentNullException("Tags", "Feature.Tags cannot be null");
this.Language = language ?? throw new ArgumentNullException("Language", "Feature.Language cannot be null");
this.Keyword = keyword ?? throw new ArgumentNullException("Keyword", "Feature.Keyword cannot be null");
this.Name = name ?? throw new ArgumentNullException("Name", "Feature.Name cannot be null");
this.Description = description ?? throw new ArgumentNullException("Description", "Feature.Description cannot be null");
this.Children = children ?? throw new ArgumentNullException("Children", "Feature.Children cannot be null");
Location = location ?? throw new ArgumentNullException("Location", "Feature.Location cannot be null");
Tags = tags ?? throw new ArgumentNullException("Tags", "Feature.Tags cannot be null");
Language = language ?? throw new ArgumentNullException("Language", "Feature.Language cannot be null");
Keyword = keyword ?? throw new ArgumentNullException("Keyword", "Feature.Keyword cannot be null");
Name = name ?? throw new ArgumentNullException("Name", "Feature.Name cannot be null");
Description = description ?? throw new ArgumentNullException("Description", "Feature.Description cannot be null");
Children = children ?? throw new ArgumentNullException("Children", "Feature.Children cannot be null");
}
}
6 changes: 3 additions & 3 deletions dotnet/Cucumber.Messages/generated/FeatureChild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public FeatureChild(
Scenario? scenario
)
{
this.Rule = rule;
this.Background = background;
this.Scenario = scenario;
Rule = rule;
Background = background;
Scenario = scenario;
}
}
6 changes: 3 additions & 3 deletions dotnet/Cucumber.Messages/generated/GherkinDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public GherkinDocument(
List<Comment> comments
)
{
this.Uri = uri;
this.Feature = feature;
this.Comments = comments ?? throw new ArgumentNullException("Comments", "GherkinDocument.Comments cannot be null");
Uri = uri;
Feature = feature;
Comments = comments ?? throw new ArgumentNullException("Comments", "GherkinDocument.Comments cannot be null");
}
}
8 changes: 4 additions & 4 deletions dotnet/Cucumber.Messages/generated/Git.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public Git(
string? tag
)
{
this.Remote = remote ?? throw new ArgumentNullException("Remote", "Git.Remote cannot be null");
this.Revision = revision ?? throw new ArgumentNullException("Revision", "Git.Revision cannot be null");
this.Branch = branch;
this.Tag = tag;
Remote = remote ?? throw new ArgumentNullException("Remote", "Git.Remote cannot be null");
Revision = revision ?? throw new ArgumentNullException("Revision", "Git.Revision cannot be null");
Branch = branch;
Tag = tag;
}
}
6 changes: 3 additions & 3 deletions dotnet/Cucumber.Messages/generated/Group.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public Group(
string? value
)
{
this.Children = children ?? throw new ArgumentNullException("Children", "Group.Children cannot be null");
this.Start = start;
this.Value = value;
Children = children ?? throw new ArgumentNullException("Children", "Group.Children cannot be null");
Start = start;
Value = value;
}
}
8 changes: 4 additions & 4 deletions dotnet/Cucumber.Messages/generated/Hook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public Hook(
string? tagExpression
)
{
this.Id = id ?? throw new ArgumentNullException("Id", "Hook.Id cannot be null");
this.Name = name;
this.SourceReference = sourceReference ?? throw new ArgumentNullException("SourceReference", "Hook.SourceReference cannot be null");
this.TagExpression = tagExpression;
Id = id ?? throw new ArgumentNullException("Id", "Hook.Id cannot be null");
Name = name;
SourceReference = sourceReference ?? throw new ArgumentNullException("SourceReference", "Hook.SourceReference cannot be null");
TagExpression = tagExpression;
}
}
6 changes: 3 additions & 3 deletions dotnet/Cucumber.Messages/generated/JavaMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public JavaMethod(
List<string> methodParameterTypes
)
{
this.ClassName = className ?? throw new ArgumentNullException("ClassName", "JavaMethod.ClassName cannot be null");
this.MethodName = methodName ?? throw new ArgumentNullException("MethodName", "JavaMethod.MethodName cannot be null");
this.MethodParameterTypes = methodParameterTypes ?? throw new ArgumentNullException("MethodParameterTypes", "JavaMethod.MethodParameterTypes cannot be null");
ClassName = className ?? throw new ArgumentNullException("ClassName", "JavaMethod.ClassName cannot be null");
MethodName = methodName ?? throw new ArgumentNullException("MethodName", "JavaMethod.MethodName cannot be null");
MethodParameterTypes = methodParameterTypes ?? throw new ArgumentNullException("MethodParameterTypes", "JavaMethod.MethodParameterTypes cannot be null");
}
}
6 changes: 3 additions & 3 deletions dotnet/Cucumber.Messages/generated/JavaStackTraceElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public JavaStackTraceElement(
string methodName
)
{
this.ClassName = className ?? throw new ArgumentNullException("ClassName", "JavaStackTraceElement.ClassName cannot be null");
this.FileName = fileName ?? throw new ArgumentNullException("FileName", "JavaStackTraceElement.FileName cannot be null");
this.MethodName = methodName ?? throw new ArgumentNullException("MethodName", "JavaStackTraceElement.MethodName cannot be null");
ClassName = className ?? throw new ArgumentNullException("ClassName", "JavaStackTraceElement.ClassName cannot be null");
FileName = fileName ?? throw new ArgumentNullException("FileName", "JavaStackTraceElement.FileName cannot be null");
MethodName = methodName ?? throw new ArgumentNullException("MethodName", "JavaStackTraceElement.MethodName cannot be null");
}
}
4 changes: 2 additions & 2 deletions dotnet/Cucumber.Messages/generated/Location.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Location(
long? column
)
{
this.Line = line;
this.Column = column;
Line = line;
Column = column;
}
}
12 changes: 6 additions & 6 deletions dotnet/Cucumber.Messages/generated/Meta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public Meta(
Ci? ci
)
{
this.ProtocolVersion = protocolVersion ?? throw new ArgumentNullException("ProtocolVersion", "Meta.ProtocolVersion cannot be null");
this.Implementation = implementation ?? throw new ArgumentNullException("Implementation", "Meta.Implementation cannot be null");
this.Runtime = runtime ?? throw new ArgumentNullException("Runtime", "Meta.Runtime cannot be null");
this.Os = os ?? throw new ArgumentNullException("Os", "Meta.Os cannot be null");
this.Cpu = cpu ?? throw new ArgumentNullException("Cpu", "Meta.Cpu cannot be null");
this.Ci = ci;
ProtocolVersion = protocolVersion ?? throw new ArgumentNullException("ProtocolVersion", "Meta.ProtocolVersion cannot be null");
Implementation = implementation ?? throw new ArgumentNullException("Implementation", "Meta.Implementation cannot be null");
Runtime = runtime ?? throw new ArgumentNullException("Runtime", "Meta.Runtime cannot be null");
Os = os ?? throw new ArgumentNullException("Os", "Meta.Os cannot be null");
Cpu = cpu ?? throw new ArgumentNullException("Cpu", "Meta.Cpu cannot be null");
Ci = ci;
}
}
12 changes: 6 additions & 6 deletions dotnet/Cucumber.Messages/generated/ParameterType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public ParameterType(
SourceReference? sourceReference
)
{
this.Name = name ?? throw new ArgumentNullException("Name", "ParameterType.Name cannot be null");
this.RegularExpressions = regularExpressions ?? throw new ArgumentNullException("RegularExpressions", "ParameterType.RegularExpressions cannot be null");
this.PreferForRegularExpressionMatch = preferForRegularExpressionMatch;
this.UseForSnippets = useForSnippets;
this.Id = id ?? throw new ArgumentNullException("Id", "ParameterType.Id cannot be null");
this.SourceReference = sourceReference;
Name = name ?? throw new ArgumentNullException("Name", "ParameterType.Name cannot be null");
RegularExpressions = regularExpressions ?? throw new ArgumentNullException("RegularExpressions", "ParameterType.RegularExpressions cannot be null");
PreferForRegularExpressionMatch = preferForRegularExpressionMatch;
UseForSnippets = useForSnippets;
Id = id ?? throw new ArgumentNullException("Id", "ParameterType.Id cannot be null");
SourceReference = sourceReference;
}
}
4 changes: 2 additions & 2 deletions dotnet/Cucumber.Messages/generated/ParseError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ParseError(
string message
)
{
this.Source = source ?? throw new ArgumentNullException("Source", "ParseError.Source cannot be null");
this.Message = message ?? throw new ArgumentNullException("Message", "ParseError.Message cannot be null");
Source = source ?? throw new ArgumentNullException("Source", "ParseError.Source cannot be null");
Message = message ?? throw new ArgumentNullException("Message", "ParseError.Message cannot be null");
}
}
Loading

0 comments on commit 99873a7

Please sign in to comment.