From 196aa63a4a81c6340501ec5dd14040af0176f8f3 Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Thu, 15 Aug 2019 16:00:04 +0200 Subject: [PATCH] [ci skip] Fixed the last of the ReSharper code issues --- .../ReSharper/JetBrains.Annotations.cs | 3 ++- Tapeti.Flow/Default/FlowHandlerContext.cs | 3 +-- Tapeti.Flow/Default/NonPersistentFlowRepository.cs | 1 + Tapeti.Flow/FlowHelpers/LockCollection.cs | 2 +- Tapeti.Flow/IFlowProvider.cs | 1 - Tapeti.Flow/ReSharper/JetBrains.Annotations.cs | 3 ++- Tapeti.Tests/Helpers/ConnectionStringParser.cs | 2 +- Tapeti.Transient/ITransientPublisher.cs | 2 ++ Tapeti.Transient/TransientPublisher.cs | 2 +- Tapeti/Connection/TapetiSubscriber.cs | 11 +++++------ Tapeti/Default/TypeNameRoutingKeyStrategy.cs | 1 + Tapeti/TapetiConnection.cs | 2 +- Tapeti/TapetiConnectionParams.cs | 12 ++++++------ Test/FlowEndController.cs | 2 +- Test/MarcoController.cs | 3 ++- Test/Program.cs | 4 +++- 16 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Tapeti.Annotations/ReSharper/JetBrains.Annotations.cs b/Tapeti.Annotations/ReSharper/JetBrains.Annotations.cs index 0876167..2790b2e 100644 --- a/Tapeti.Annotations/ReSharper/JetBrains.Annotations.cs +++ b/Tapeti.Annotations/ReSharper/JetBrains.Annotations.cs @@ -30,6 +30,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System; +// ReSharper disable InheritdocConsiderUsage #pragma warning disable 1591 // ReSharper disable UnusedMember.Global @@ -142,7 +143,7 @@ namespace JetBrains.Annotations /// InstantiatedWithFixedConstructorSignature = 4, /// Indicates implicit instantiation of a type. - InstantiatedNoFixedConstructorSignature = 8, + InstantiatedNoFixedConstructorSignature = 8 } /// diff --git a/Tapeti.Flow/Default/FlowHandlerContext.cs b/Tapeti.Flow/Default/FlowHandlerContext.cs index 360318c..fc35b68 100644 --- a/Tapeti.Flow/Default/FlowHandlerContext.cs +++ b/Tapeti.Flow/Default/FlowHandlerContext.cs @@ -1,5 +1,4 @@ -using System; -using System.Reflection; +using System.Reflection; using Tapeti.Config; namespace Tapeti.Flow.Default diff --git a/Tapeti.Flow/Default/NonPersistentFlowRepository.cs b/Tapeti.Flow/Default/NonPersistentFlowRepository.cs index e65946d..b20bfd6 100644 --- a/Tapeti.Flow/Default/NonPersistentFlowRepository.cs +++ b/Tapeti.Flow/Default/NonPersistentFlowRepository.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; namespace Tapeti.Flow.Default { + /// /// /// Default implementation for IFlowRepository. Does not persist any state, relying on the FlowStore's cache instead. /// diff --git a/Tapeti.Flow/FlowHelpers/LockCollection.cs b/Tapeti.Flow/FlowHelpers/LockCollection.cs index 06bb831..d7f929a 100644 --- a/Tapeti.Flow/FlowHelpers/LockCollection.cs +++ b/Tapeti.Flow/FlowHelpers/LockCollection.cs @@ -27,7 +27,7 @@ namespace Tapeti.Flow.FlowHelpers var nextLi = new LockItem(locks, key); try { - bool continueImmediately = false; + var continueImmediately = false; lock (locks) { if (!locks.TryGetValue(key, out var li)) diff --git a/Tapeti.Flow/IFlowProvider.cs b/Tapeti.Flow/IFlowProvider.cs index 5e56c21..fa5f0a6 100644 --- a/Tapeti.Flow/IFlowProvider.cs +++ b/Tapeti.Flow/IFlowProvider.cs @@ -1,7 +1,6 @@ using System; using System.Linq.Expressions; using System.Threading.Tasks; -using Tapeti.Config; // ReSharper disable UnusedMember.Global diff --git a/Tapeti.Flow/ReSharper/JetBrains.Annotations.cs b/Tapeti.Flow/ReSharper/JetBrains.Annotations.cs index 0876167..ef47d40 100644 --- a/Tapeti.Flow/ReSharper/JetBrains.Annotations.cs +++ b/Tapeti.Flow/ReSharper/JetBrains.Annotations.cs @@ -38,6 +38,7 @@ using System; // ReSharper disable IntroduceOptionalParameters.Global // ReSharper disable MemberCanBeProtected.Global // ReSharper disable InconsistentNaming +// ReSharper disable InheritdocConsiderUsage // ReSharper disable once CheckNamespace namespace JetBrains.Annotations @@ -142,7 +143,7 @@ namespace JetBrains.Annotations /// InstantiatedWithFixedConstructorSignature = 4, /// Indicates implicit instantiation of a type. - InstantiatedNoFixedConstructorSignature = 8, + InstantiatedNoFixedConstructorSignature = 8 } /// diff --git a/Tapeti.Tests/Helpers/ConnectionStringParser.cs b/Tapeti.Tests/Helpers/ConnectionStringParser.cs index b0084de..dfd942f 100644 --- a/Tapeti.Tests/Helpers/ConnectionStringParser.cs +++ b/Tapeti.Tests/Helpers/ConnectionStringParser.cs @@ -126,7 +126,7 @@ namespace Tapeti.Tests.Helpers AssertConnectionString("HostName=rabbit.com;Username=\"myApplication\"", new TapetiConnectionParams { HostName = "rabbit.com", - Username = "myApplication", + Username = "myApplication" }); } diff --git a/Tapeti.Transient/ITransientPublisher.cs b/Tapeti.Transient/ITransientPublisher.cs index 494a9b4..7c01409 100644 --- a/Tapeti.Transient/ITransientPublisher.cs +++ b/Tapeti.Transient/ITransientPublisher.cs @@ -1,5 +1,7 @@ using System.Threading.Tasks; +// ReSharper disable UnusedMember.Global + namespace Tapeti.Transient { /// diff --git a/Tapeti.Transient/TransientPublisher.cs b/Tapeti.Transient/TransientPublisher.cs index 007d27d..525e887 100644 --- a/Tapeti.Transient/TransientPublisher.cs +++ b/Tapeti.Transient/TransientPublisher.cs @@ -23,7 +23,7 @@ namespace Tapeti.Transient /// public async Task RequestResponse(TRequest request) { - return (TResponse)(await router.RequestResponse(publisher, request)); + return (TResponse)await router.RequestResponse(publisher, request); } } } diff --git a/Tapeti/Connection/TapetiSubscriber.cs b/Tapeti/Connection/TapetiSubscriber.cs index 583c8ca..a6184b1 100644 --- a/Tapeti/Connection/TapetiSubscriber.cs +++ b/Tapeti/Connection/TapetiSubscriber.cs @@ -96,14 +96,13 @@ namespace Tapeti.Connection public async Task BindDynamic(Type messageClass, string queuePrefix = null) { var result = await DeclareDynamicQueue(messageClass, queuePrefix); + if (!result.IsNewMessageClass) + return result.QueueName; - if (result.IsNewMessageClass) - { - var routingKey = RoutingKeyStrategy.GetRoutingKey(messageClass); - var exchange = ExchangeStrategy.GetExchange(messageClass); + var routingKey = RoutingKeyStrategy.GetRoutingKey(messageClass); + var exchange = ExchangeStrategy.GetExchange(messageClass); - await ClientFactory().DynamicQueueBind(result.QueueName, new QueueBinding(exchange, routingKey)); - } + await ClientFactory().DynamicQueueBind(result.QueueName, new QueueBinding(exchange, routingKey)); return result.QueueName; } diff --git a/Tapeti/Default/TypeNameRoutingKeyStrategy.cs b/Tapeti/Default/TypeNameRoutingKeyStrategy.cs index de51fc2..5b8af1f 100644 --- a/Tapeti/Default/TypeNameRoutingKeyStrategy.cs +++ b/Tapeti/Default/TypeNameRoutingKeyStrategy.cs @@ -6,6 +6,7 @@ using System.Text.RegularExpressions; namespace Tapeti.Default { + /// /// /// IRoutingKeyStrategy implementation which transforms the class name into a dot-separated routing key based /// on the casing. Accounts for acronyms. If the class name ends with 'Message' it is not included in the routing key. diff --git a/Tapeti/TapetiConnection.cs b/Tapeti/TapetiConnection.cs index 8a24080..3e167c5 100644 --- a/Tapeti/TapetiConnection.cs +++ b/Tapeti/TapetiConnection.cs @@ -150,7 +150,7 @@ namespace Tapeti Task.Run(() => { - subscriber?.ApplyBindings().ContinueWith((t) => + subscriber?.ApplyBindings().ContinueWith(t => { reconnectedEvent.Invoke(this, e); }); diff --git a/Tapeti/TapetiConnectionParams.cs b/Tapeti/TapetiConnectionParams.cs index cdc60aa..162fbaf 100644 --- a/Tapeti/TapetiConnectionParams.cs +++ b/Tapeti/TapetiConnectionParams.cs @@ -67,12 +67,12 @@ namespace Tapeti Port = uri.Port; var userInfo = uri.UserInfo.Split(':'); - if (userInfo.Length > 0) - { - Username = userInfo[0]; - if (userInfo.Length > 1) - Password = userInfo[1]; - } + if (userInfo.Length <= 0) + return; + + Username = userInfo[0]; + if (userInfo.Length > 1) + Password = userInfo[1]; } } } diff --git a/Test/FlowEndController.cs b/Test/FlowEndController.cs index ad72d4f..0184339 100644 --- a/Test/FlowEndController.cs +++ b/Test/FlowEndController.cs @@ -29,7 +29,7 @@ namespace Test //never true return flowProvider .YieldWithRequestSync - (new PingConfirmationRequestMessage() { StoredInState = "Ping:" }, + (new PingConfirmationRequestMessage { StoredInState = "Ping:" }, HandlePingConfirmationResponse); } diff --git a/Test/MarcoController.cs b/Test/MarcoController.cs index 3368f59..e16a1eb 100644 --- a/Test/MarcoController.cs +++ b/Test/MarcoController.cs @@ -81,7 +81,7 @@ namespace Test .AddRequestSync(new PoloConfirmationRequestMessage { StoredInState = StateTestGuid, - EnumValue = TestEnum.Value1, + EnumValue = TestEnum.Value1 }, HandlePoloConfirmationResponse1) @@ -124,6 +124,7 @@ namespace Test * This will automatically include the correlationId in the response and * use the replyTo header of the request if provided. */ + [DurableQueue("tapeti.test.durable")] public async Task PoloConfirmation(PoloConfirmationRequestMessage message) { Console.WriteLine(">> PoloConfirmation (returning confirmation)"); diff --git a/Test/Program.cs b/Test/Program.cs index 771a4a0..b1291c1 100644 --- a/Test/Program.cs +++ b/Test/Program.cs @@ -26,6 +26,7 @@ namespace Test .WithFlow() .WithDataAnnotations() .WithTransient(TimeSpan.FromSeconds(30)) + .EnableDeclareDurableQueues() .RegisterAllControllers() //.DisablePublisherConfirms() -> you probably never want to do this if you're using Flow or want requeues when a publish fails .Build(); @@ -74,7 +75,8 @@ namespace Test //var emitter = container.GetInstance(); //emitter.Run().Wait(); - + Console.WriteLine("Press any Enter to continue"); + Console.ReadLine(); } } //catch (Exception e)