From 58985af334a1ec2e82fd9c14a4821ded4ad18159 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Mon, 28 Sep 2020 22:12:03 +0900 Subject: [PATCH] Upgrade StyleCop.Analyzers to 1.2.0-beta.205 to check new syntaxes introduced since C# 8. [changelog skip] --- .../Libplanet.RocksDBStore.Tests.csproj | 2 +- Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj | 2 +- Libplanet.Stun.Tests/Libplanet.Stun.Tests.csproj | 2 +- Libplanet.Stun/Libplanet.Stun.csproj | 2 +- Libplanet.Stun/Stun/Messages/StunMessage.cs | 10 +++++----- Libplanet.Tests.ruleset | 4 ++++ Libplanet.Tests/Action/ActionContextTest.cs | 4 ++-- Libplanet.Tests/Blockchain/BlockChainTest.cs | 4 ++-- Libplanet.Tests/Libplanet.Tests.csproj | 2 +- Libplanet.ruleset | 4 ++++ Libplanet/KeyStore/Kdfs/Pbkdf2.cs | 2 +- Libplanet/KeyStore/ProtectedPrivateKey.cs | 4 ++-- Libplanet/Libplanet.csproj | 2 +- 13 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Libplanet.RocksDBStore.Tests/Libplanet.RocksDBStore.Tests.csproj b/Libplanet.RocksDBStore.Tests/Libplanet.RocksDBStore.Tests.csproj index a75d5996f52..ae7e4490410 100644 --- a/Libplanet.RocksDBStore.Tests/Libplanet.RocksDBStore.Tests.csproj +++ b/Libplanet.RocksDBStore.Tests/Libplanet.RocksDBStore.Tests.csproj @@ -43,7 +43,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj b/Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj index 1438e15c41f..ccb432afd28 100644 --- a/Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj +++ b/Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj @@ -42,7 +42,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/Libplanet.Stun.Tests/Libplanet.Stun.Tests.csproj b/Libplanet.Stun.Tests/Libplanet.Stun.Tests.csproj index cf275fbf2ae..3e25929b4a9 100644 --- a/Libplanet.Stun.Tests/Libplanet.Stun.Tests.csproj +++ b/Libplanet.Stun.Tests/Libplanet.Stun.Tests.csproj @@ -37,7 +37,7 @@ all - + all runtime; build; native; contentfiles; analyzers diff --git a/Libplanet.Stun/Libplanet.Stun.csproj b/Libplanet.Stun/Libplanet.Stun.csproj index 23dfb3f5545..a6b21945a5a 100644 --- a/Libplanet.Stun/Libplanet.Stun.csproj +++ b/Libplanet.Stun/Libplanet.Stun.csproj @@ -30,7 +30,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers diff --git a/Libplanet.Stun/Stun/Messages/StunMessage.cs b/Libplanet.Stun/Stun/Messages/StunMessage.cs index 88e849f7bf3..eee6d74b608 100644 --- a/Libplanet.Stun/Stun/Messages/StunMessage.cs +++ b/Libplanet.Stun/Stun/Messages/StunMessage.cs @@ -115,21 +115,21 @@ public static async Task 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) @@ -252,7 +252,7 @@ internal static IEnumerable 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)) diff --git a/Libplanet.Tests.ruleset b/Libplanet.Tests.ruleset index d8c645a02da..69d8060e189 100644 --- a/Libplanet.Tests.ruleset +++ b/Libplanet.Tests.ruleset @@ -12,6 +12,10 @@ + + + + diff --git a/Libplanet.Tests/Action/ActionContextTest.cs b/Libplanet.Tests/Action/ActionContextTest.cs index b23b07cebaa..89309f29e64 100644 --- a/Libplanet.Tests/Action/ActionContextTest.cs +++ b/Libplanet.Tests/Action/ActionContextTest.cs @@ -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), @@ -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"), diff --git a/Libplanet.Tests/Blockchain/BlockChainTest.cs b/Libplanet.Tests/Blockchain/BlockChainTest.cs index c8987f8d526..7b62d9e49c1 100644 --- a/Libplanet.Tests/Blockchain/BlockChainTest.cs +++ b/Libplanet.Tests/Blockchain/BlockChainTest.cs @@ -2248,7 +2248,7 @@ public async void BlockActionWithMultipleAddress() /// 10 addresses[4] Present /// /// - internal static (Address, Address[] addresses, BlockChain chain) + internal static (Address, Address[] Addresses, BlockChain Chain) MakeIncompleteBlockStates( IStore store, IBlockStatesStore blockStatesStore, @@ -2333,7 +2333,7 @@ void BuildIndex(Guid id, Block block) return (signer, addresses, chain); } - private (Address, Address[] addresses, BlockChain chain) + private (Address, Address[] Addresses, BlockChain Chain) MakeIncompleteBlockStates() => MakeIncompleteBlockStates(_fx.Store, _fx.BlockStatesStore); diff --git a/Libplanet.Tests/Libplanet.Tests.csproj b/Libplanet.Tests/Libplanet.Tests.csproj index 02c847775bc..21bbadc693e 100644 --- a/Libplanet.Tests/Libplanet.Tests.csproj +++ b/Libplanet.Tests/Libplanet.Tests.csproj @@ -42,7 +42,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/Libplanet.ruleset b/Libplanet.ruleset index af8e36a6f55..5eabda05dab 100644 --- a/Libplanet.ruleset +++ b/Libplanet.ruleset @@ -15,6 +15,10 @@ + + + + diff --git a/Libplanet/KeyStore/Kdfs/Pbkdf2.cs b/Libplanet/KeyStore/Kdfs/Pbkdf2.cs index 991e6105ea8..077411241bf 100644 --- a/Libplanet/KeyStore/Kdfs/Pbkdf2.cs +++ b/Libplanet/KeyStore/Kdfs/Pbkdf2.cs @@ -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}\"."), }; } } diff --git a/Libplanet/KeyStore/ProtectedPrivateKey.cs b/Libplanet/KeyStore/ProtectedPrivateKey.cs index 0152211d6b1..91fc35b3d77 100644 --- a/Libplanet/KeyStore/ProtectedPrivateKey.cs +++ b/Libplanet/KeyStore/ProtectedPrivateKey.cs @@ -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; @@ -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) diff --git a/Libplanet/Libplanet.csproj b/Libplanet/Libplanet.csproj index bc35810dbcb..de62ae6e21b 100644 --- a/Libplanet/Libplanet.csproj +++ b/Libplanet/Libplanet.csproj @@ -81,7 +81,7 @@ https://docs.libplanet.io/ - + all runtime; build; native; contentfiles; analyzers