Skip to content

Commit

Permalink
Upgrade StyleCop.Analyzers to 1.2.0-beta.205
Browse files Browse the repository at this point in the history
to check new syntaxes introduced since C# 8.

[changelog skip]
  • Loading branch information
dahlia committed Sep 28, 2020
1 parent a80daf6 commit 58985af
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.XUnit" Version="1.0.7" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.205">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>
runtime; build; native; contentfiles; analyzers
Expand Down
2 changes: 1 addition & 1 deletion Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</IncludeAssets>
</PackageReference>
<PackageReference Include="Planetarium.RocksDbSharp" Version="6.2.2.3-planetarium" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.205">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>
runtime; build; native; contentfiles; analyzers
Expand Down
2 changes: 1 addition & 1 deletion Libplanet.Stun.Tests/Libplanet.Stun.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.205">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>
runtime; build; native; contentfiles; analyzers
Expand Down
2 changes: 1 addition & 1 deletion Libplanet.Stun/Libplanet.Stun.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.205">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>
runtime; build; native; contentfiles; analyzers
Expand Down
10 changes: 5 additions & 5 deletions Libplanet.Stun/Stun/Messages/StunMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,21 @@ public static async Task<StunMessage> Parse(Stream stream)
MessageMethod.Binding => new BindingSuccessResponse(),
MessageMethod.CreatePermission => new CreatePermissionSuccessResponse(),
MessageMethod.Refresh => new RefreshSuccessResponse(),
_ => rv
_ => rv,
},
MessageClass.ErrorResponse => method switch
{
MessageMethod.Allocate => new AllocateErrorResponse(),
MessageMethod.CreatePermission => new CreatePermissionErrorResponse(),
MessageMethod.Refresh => new RefreshErrorResponse(),
_ => rv
_ => rv,
},
MessageClass.Indication => method switch
{
MessageMethod.ConnectionAttempt => new ConnectionAttempt(),
_ => rv
_ => rv,
},
_ => rv
_ => rv,
};

if (rv is null)
Expand Down Expand Up @@ -252,7 +252,7 @@ internal static IEnumerable<Attribute> ParseAttributes(
XorRelayedAddress.Parse(payload, transactionId),
Attribute.AttributeType.ConnectionId => new ConnectionId(payload),
Attribute.AttributeType.Lifetime => new Lifetime((int)payload.ToUInt()),
_ => null
_ => null,
};

if (!(attr is null))
Expand Down
4 changes: 4 additions & 0 deletions Libplanet.Tests.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<Rule Id="SA1005" Action="None" />
<!-- Closing parenthesis should be on line of opening parenthesis -->
<Rule Id="SA1112" Action="None" />
<!-- Allow tuple types in signatures omit element names. -->
<Rule Id="SA1414" Action="None" />
<!-- Allow tuple fields to be referred by index (i.e. ItemN). -->
<Rule Id="SA1142" Action="None" />
<!-- Single-line comment should be preceded by blank line. -->
<Rule Id="SA1515" Action="None" />
<!-- TODO: Write copyright -->
Expand Down
4 changes: 2 additions & 2 deletions Libplanet.Tests/Action/ActionContextTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ActionContextTest
[Fact]
public void RandomShouldBeDeterministic()
{
(int seed, int expected)[] testCases =
(int Seed, int Expected)[] testCases =
{
(0, 1559595546),
(1, 534011718),
Expand Down Expand Up @@ -60,7 +60,7 @@ public void GuidShouldBeDeterministic()
randomSeed: 1
);

(Guid expected, Guid diff)[] testCases =
(Guid Expected, Guid Diff)[] testCases =
{
(
new Guid("6f460c1a-755d-48e4-ad67-65d5f519dbc8"),
Expand Down
4 changes: 2 additions & 2 deletions Libplanet.Tests/Blockchain/BlockChainTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2248,7 +2248,7 @@ public async void BlockActionWithMultipleAddress()
/// 10 addresses[4] Present
/// </code>
/// </summary>
internal static (Address, Address[] addresses, BlockChain<DumbAction> chain)
internal static (Address, Address[] Addresses, BlockChain<DumbAction> Chain)
MakeIncompleteBlockStates(
IStore store,
IBlockStatesStore blockStatesStore,
Expand Down Expand Up @@ -2333,7 +2333,7 @@ void BuildIndex(Guid id, Block<DumbAction> block)
return (signer, addresses, chain);
}

private (Address, Address[] addresses, BlockChain<DumbAction> chain)
private (Address, Address[] Addresses, BlockChain<DumbAction> Chain)
MakeIncompleteBlockStates() =>
MakeIncompleteBlockStates(_fx.Store, _fx.BlockStatesStore);

Expand Down
2 changes: 1 addition & 1 deletion Libplanet.Tests/Libplanet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.TestCorrelator" Version="3.2.0" />
<PackageReference Include="Serilog.Sinks.XUnit" Version="1.0.7" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.205">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>
runtime; build; native; contentfiles; analyzers
Expand Down
4 changes: 4 additions & 0 deletions Libplanet.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<Rule Id="SA1309" Action="None" />
<!-- Allow an expression not to declare parenthese. -->
<Rule Id="SA1407" Action="None" />
<!-- Allow tuple types in signatures omit element names. -->
<Rule Id="SA1414" Action="None" />
<!-- Allow tuple fields to be referred by index (i.e. ItemN). -->
<Rule Id="SA1142" Action="None" />
<!-- Allow a rich text in a XML doc comment's <summary>. -->
<Rule Id="SA1462" Action="None" />
<Rule Id="SA1642" Action="None" />
Expand Down
2 changes: 1 addition & 1 deletion Libplanet/KeyStore/Kdfs/Pbkdf2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ internal static IKdf FromJson(in JsonElement element)
throw new InvalidKeyJsonException(
"The \"prf\" field must not be null, but a string."),
_ =>
throw new UnsupportedKeyJsonException($"Unsupported \"prf\" type: \"{prf}\".")
throw new UnsupportedKeyJsonException($"Unsupported \"prf\" type: \"{prf}\"."),
};
}
}
Expand Down
4 changes: 2 additions & 2 deletions Libplanet/KeyStore/ProtectedPrivateKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ byte[] GetHexProperty(JsonElement element, string fieldName)
"aes-128-ctr" => Aes128Ctr.FromJson(cipherParamsElement),
_ =>
throw new UnsupportedKeyJsonException(
$"Unsupported cipher type: \"{cipherType}\".")
$"Unsupported cipher type: \"{cipherType}\"."),
};

IKdf kdf;
Expand All @@ -282,7 +282,7 @@ byte[] GetHexProperty(JsonElement element, string fieldName)
"scrypt" => Scrypt.FromJson(kdfParamsElement),
_ =>
throw new UnsupportedKeyJsonException(
$"Unsupported cipher type: \"{kdfType}\".")
$"Unsupported cipher type: \"{kdfType}\"."),
};
}
catch (ArgumentException e)
Expand Down
2 changes: 1 addition & 1 deletion Libplanet/Libplanet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ https://docs.libplanet.io/</Description>
<PackageReference Include="Planetarium.NetMQ" Version="4.0.0.260-planetarium" />
<PackageReference Include="Nito.AsyncEx" Version="5.0.0" />
<PackageReference Include="Serilog" Version="2.8.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.205">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>
runtime; build; native; contentfiles; analyzers
Expand Down

0 comments on commit 58985af

Please sign in to comment.