Skip to content

Commit

Permalink
Ran code analysis and fixed suggestions that showed up.
Browse files Browse the repository at this point in the history
  • Loading branch information
natekford committed Jan 26, 2024
1 parent 34fb431 commit cd9b81b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions samples/NarrativeCharts.Bookworm/Meta/Time/BookwormTime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public static class BookwormTime

public static ImmutableDictionary<string, int> Aliases { get; }
// source: https://w.atwiki.jp/booklove/pages/195.html#footnote_body_2
public static ImmutableArray<int> Lengths { get; } = new[]
{
public static ImmutableArray<int> Lengths { get; } =
[
4,
3,
3,
Expand All @@ -27,7 +27,7 @@ public static class BookwormTime
2,
3,
4,
}.ToImmutableArray();
];

static BookwormTime()
{
Expand Down
2 changes: 1 addition & 1 deletion src/NarrativeCharts.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private static async Task Main(string[] args)
{
try
{
await new Program(args.ToImmutableArray()).RunAsync().ConfigureAwait(false);
await new Program([.. args]).RunAsync().ConfigureAwait(false);
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion src/NarrativeCharts/Models/Meta/AliasAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ public sealed class AliasAttribute(params string[] aliases) : Attribute
/// <summary>
/// The aliases to use.
/// </summary>
public ImmutableArray<string> Aliases { get; } = aliases.ToImmutableArray();
public ImmutableArray<string> Aliases { get; } = [.. aliases];
}
4 changes: 1 addition & 3 deletions src/NarrativeCharts/Models/Meta/MetaUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ public static ImmutableDictionary<string, T> GetAliases<T>(
aliases.TryAdd(convertValue(value), value);
}

var cAliases = prop.GetCustomAttribute<AliasAttribute>()?.Aliases
?? ImmutableArray<string>.Empty;
foreach (var alias in cAliases)
foreach (var alias in prop.GetCustomAttribute<AliasAttribute>()?.Aliases ?? [])
{
aliases.Add(alias, value);
}
Expand Down
1 change: 1 addition & 0 deletions tests/NarrativeCharts.Tests/NarrativeCharts.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<CollectCoverage>true</CollectCoverage>
<CoverletOutputFormat>lcov</CoverletOutputFormat>
<CoverletOutput>./lcov.info</CoverletOutput>
<NeutralLanguage>en-US</NeutralLanguage>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/NarrativeCharts.Tests/Scripting/Scripting_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public async Task ScriptDefinitionsSaveAndLoad_Valid()
[GeneratedRegex(@"P(\d+)V(\d+)")]
private static partial Regex BookNumberRegex();

private async Task CreateFakeFilesAsync(
private static async Task CreateFakeFilesAsync(
ScriptDefinitions defs,
IEnumerable<FakeScriptConverter> scripts)
{
Expand Down

0 comments on commit cd9b81b

Please sign in to comment.