Skip to content

Commit

Permalink
Apply dotnet format
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed Aug 30, 2023
1 parent 60a71f4 commit f993401
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ThisAssembly.Constants/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ record Area(string Name, string Prefix)
{
public List<Area> NestedAreas { get; init; } = new();
public List<Constant> Values { get; init; } = new();
private static string EscapeIdentifier(string identifier)

static string EscapeIdentifier(string identifier)
{
if (string.IsNullOrWhiteSpace(identifier))
{
return "_";
}

var replaced = identifier
.Select(c => SyntaxFacts.IsIdentifierPartCharacter(c) ? c : '_')
.ToArray();
Expand All @@ -35,7 +35,7 @@ private static string EscapeIdentifier(string identifier)
if (!SyntaxFacts.IsIdentifierStartCharacter(result[0]))
{
result = "_" + result;
}
}

return result;
}
Expand All @@ -50,7 +50,7 @@ public static Area Load(List<Constant> constants, string rootArea = "Constants")
var parts = constant.Name.Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries)
.Select(EscapeIdentifier)
.ToArray();

if (parts.Length <= 1)
{
root.Values.Add(constant with { Name = EscapeIdentifier(constant.Name) });
Expand Down

0 comments on commit f993401

Please sign in to comment.