From 6d068c6c7f8adc484f6f4e21e024e0ac92785ddc Mon Sep 17 00:00:00 2001 From: Mateusz Machalica Date: Mon, 16 May 2016 14:43:53 -0700 Subject: [PATCH] Clang-format config, script and initial re-formatting. (#27) --- .clang-format | 87 +++++++++++++++++++ CONTRIBUTING | 11 +-- devtools/format_all.sh | 11 +++ reactive-streams-cpp/Mocks.h | 1 - reactive-streams-cpp/Publisher.h | 8 +- reactive-streams-cpp/Subscriber.h | 9 +- reactive-streams-cpp/Subscription.h | 1 - reactive-streams-cpp/examples/Examples.cpp | 1 - .../test/AllowanceSemaphoreTest.cpp | 2 - reactive-streams-cpp/test/OwnershipTest.cpp | 2 - .../test/SmartPointersTest.cpp | 2 - .../utilities/AllowanceSemaphore.h | 1 - reactive-streams-cpp/utilities/Ownership.h | 1 - .../utilities/SmartPointers.h | 1 - .../src/AbstractStreamAutomaton.cpp | 1 - .../src/AbstractStreamAutomaton.h | 1 - .../src/ConnectionAutomaton.cpp | 1 - reactivesocket-cpp/src/ConnectionAutomaton.h | 1 - reactivesocket-cpp/src/DuplexConnection.h | 1 - reactivesocket-cpp/src/Frame.cpp | 1 - reactivesocket-cpp/src/Frame.h | 1 - reactivesocket-cpp/src/Payload.h | 1 - reactivesocket-cpp/src/ReactiveSocket.cpp | 1 - reactivesocket-cpp/src/ReactiveSocket.h | 1 - .../src/ReactiveStreamsCompat.h | 1 - reactivesocket-cpp/src/RequestHandler.h | 1 - .../src/automata/ChannelRequester.cpp | 1 - .../src/automata/ChannelRequester.h | 1 - .../src/automata/ChannelResponder.cpp | 1 - .../src/automata/ChannelResponder.h | 1 - .../src/automata/SubscriptionRequester.cpp | 1 - .../src/automata/SubscriptionRequester.h | 1 - .../src/automata/SubscriptionResponder.cpp | 1 - .../src/automata/SubscriptionResponder.h | 1 - .../src/mixins/ConsumerMixin-inl.h | 1 - reactivesocket-cpp/src/mixins/ConsumerMixin.h | 1 - reactivesocket-cpp/src/mixins/ExecutorMixin.h | 1 - .../src/mixins/IntrusiveDeleter.h | 1 - reactivesocket-cpp/src/mixins/LoggingMixin.h | 1 - reactivesocket-cpp/src/mixins/MemoryMixin.h | 1 - .../src/mixins/MixinTerminator.h | 4 +- .../src/mixins/PublisherMixin.h | 1 - reactivesocket-cpp/src/mixins/SinkIfMixin.h | 1 - reactivesocket-cpp/src/mixins/SourceIfMixin.h | 1 - reactivesocket-cpp/src/mixins/StreamIfMixin.h | 1 - reactivesocket-cpp/test/FrameTest.cpp | 2 - reactivesocket-cpp/test/InlineConnection.cpp | 1 - reactivesocket-cpp/test/InlineConnection.h | 1 - .../test/InlineConnectionTest.cpp | 2 - .../test/MockDuplexConnection.h | 1 - reactivesocket-cpp/test/MockRequestHandler.h | 1 - .../test/ReactiveSocketTest.cpp | 20 ++--- .../test/ReactiveStreamsMocksCompat.h | 1 - 53 files changed, 122 insertions(+), 79 deletions(-) create mode 100644 .clang-format create mode 100755 devtools/format_all.sh diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..1307bf22e --- /dev/null +++ b/.clang-format @@ -0,0 +1,87 @@ +--- +AccessModifierOffset: -1 +AlignAfterOpenBracket: AlwaysBreak +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlinesLeft: true +AlignOperands: false +AlignTrailingComments: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: true +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: false +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, ] +IncludeCategories: + - Regex: '^<.*\.h(pp)?>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IndentCaseLabels: true +IndentWidth: 2 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: false +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +ReflowComments: true +SortIncludes: true +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +TabWidth: 8 +UseTab: Never +... diff --git a/CONTRIBUTING b/CONTRIBUTING index 1b5ebb70c..4acff69ee 100644 --- a/CONTRIBUTING +++ b/CONTRIBUTING @@ -13,7 +13,8 @@ We actively welcome your pull requests. 3. If you've changed APIs, update the documentation. 4. Ensure the test suite passes. 5. Make sure your code lints. -6. If you haven't already, complete the Contributor License Agreement ("CLA"). +6. Make sure your code is properly formatted by running `devtools/format_all.sh`. +7. If you haven't already, complete the Contributor License Agreement ("CLA"). ## Contributor License Agreement ("CLA") In order to accept your pull request, we need you to submit a CLA. You only need @@ -29,10 +30,10 @@ Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. In those cases, please go through the process outlined on that page and do not file a public issue. -## Coding Style -* 2 spaces for indentation rather than tabs -* 80 character line length -* ... +## Coding Style +Most of the code formatting will be handled for you by marvellous `clang-format`, which, at least on OSX, you can obtain from Homebrew via `brew install clang-format`. To ensure proper formatting, simply run `devtools/format_all.sh` before submitting a patch. + +As far as naming conventions are concerned, please try matching existing code as much as possible. ## License By contributing to reactivesocket-cpp, you agree that your contributions will be licensed diff --git a/devtools/format_all.sh b/devtools/format_all.sh new file mode 100755 index 000000000..c33ee41b7 --- /dev/null +++ b/devtools/format_all.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -xue + +cd "$(dirname "$0")/.." +find \ + reactive-streams-cpp \ + reactivesocket-cpp \ + -type f \( -name "*.cpp" -o -name "*.h" \) \ + -exec clang-format -i {} \; + +# EOF diff --git a/reactive-streams-cpp/Mocks.h b/reactive-streams-cpp/Mocks.h index 43d8821de..ca843bbd6 100644 --- a/reactive-streams-cpp/Mocks.h +++ b/reactive-streams-cpp/Mocks.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactive-streams-cpp/Publisher.h b/reactive-streams-cpp/Publisher.h index 13e07f827..493d21604 100644 --- a/reactive-streams-cpp/Publisher.h +++ b/reactive-streams-cpp/Publisher.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include @@ -19,9 +18,10 @@ class Subscriber; /// /// Life cycle considerations: /// 1. The Publisher is not owned by Subscriber or Subscription. -/// 2. The Publisher can be a temporary object, as it is only used to capture the -/// indirection in creation of the Subscription instance. Publisher's lifetime -/// does not need to extend beyond a lifetime of any of the Subscribers. +/// 2. The Publisher can be a temporary object, as it is only used to capture +/// the indirection in creation of the Subscription instance. Publisher's +/// lifetime does not need to extend beyond a lifetime of any of the +/// Subscribers. template class Publisher { public: diff --git a/reactive-streams-cpp/Subscriber.h b/reactive-streams-cpp/Subscriber.h index 6256a3e33..d28ad4bec 100644 --- a/reactive-streams-cpp/Subscriber.h +++ b/reactive-streams-cpp/Subscriber.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include @@ -64,16 +63,16 @@ class Subscriber { /// Called by or on behalf of Publisher when it wishes to terminate the /// abstract subscription gracefully. /// - /// Subscriber pointer passed to the Publisher::subscribe may become invalid as - /// a result of this call. No other method of the Subscriber can be called + /// Subscriber pointer passed to the Publisher::subscribe may become invalid + /// as a result of this call. No other method of the Subscriber can be called /// after or during an invocation of ::onComplete. virtual void onComplete() = 0; /// Called by or on behalf of Publisher when it wishes to terminate the /// abstract subscription with an error. /// - /// Subscriber pointer passed to the Publisher::subscribe may become invalid as - /// a result of this call. No other method of the Subscriber can be called + /// Subscriber pointer passed to the Publisher::subscribe may become invalid + /// as a result of this call. No other method of the Subscriber can be called /// after or during an invocation of ::onError. virtual void onError(E ex) = 0; }; diff --git a/reactive-streams-cpp/Subscription.h b/reactive-streams-cpp/Subscription.h index d95ed0b61..cd3f9bd8b 100644 --- a/reactive-streams-cpp/Subscription.h +++ b/reactive-streams-cpp/Subscription.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactive-streams-cpp/examples/Examples.cpp b/reactive-streams-cpp/examples/Examples.cpp index 88b5203e7..8feb7eded 100644 --- a/reactive-streams-cpp/examples/Examples.cpp +++ b/reactive-streams-cpp/examples/Examples.cpp @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #include "reactive-streams-cpp/Mocks.h" #include diff --git a/reactive-streams-cpp/test/AllowanceSemaphoreTest.cpp b/reactive-streams-cpp/test/AllowanceSemaphoreTest.cpp index b8f24f38d..c50a47716 100644 --- a/reactive-streams-cpp/test/AllowanceSemaphoreTest.cpp +++ b/reactive-streams-cpp/test/AllowanceSemaphoreTest.cpp @@ -1,7 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - - #include #include diff --git a/reactive-streams-cpp/test/OwnershipTest.cpp b/reactive-streams-cpp/test/OwnershipTest.cpp index 98217e08c..8a161aed3 100644 --- a/reactive-streams-cpp/test/OwnershipTest.cpp +++ b/reactive-streams-cpp/test/OwnershipTest.cpp @@ -1,7 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - - #include #include diff --git a/reactive-streams-cpp/test/SmartPointersTest.cpp b/reactive-streams-cpp/test/SmartPointersTest.cpp index 90129134c..d640b12bc 100644 --- a/reactive-streams-cpp/test/SmartPointersTest.cpp +++ b/reactive-streams-cpp/test/SmartPointersTest.cpp @@ -1,7 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - - #include #include #include diff --git a/reactive-streams-cpp/utilities/AllowanceSemaphore.h b/reactive-streams-cpp/utilities/AllowanceSemaphore.h index bf848bcef..b075a8842 100644 --- a/reactive-streams-cpp/utilities/AllowanceSemaphore.h +++ b/reactive-streams-cpp/utilities/AllowanceSemaphore.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactive-streams-cpp/utilities/Ownership.h b/reactive-streams-cpp/utilities/Ownership.h index 141e5f958..affa7dc48 100644 --- a/reactive-streams-cpp/utilities/Ownership.h +++ b/reactive-streams-cpp/utilities/Ownership.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactive-streams-cpp/utilities/SmartPointers.h b/reactive-streams-cpp/utilities/SmartPointers.h index 66b675a76..528ad267f 100644 --- a/reactive-streams-cpp/utilities/SmartPointers.h +++ b/reactive-streams-cpp/utilities/SmartPointers.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/AbstractStreamAutomaton.cpp b/reactivesocket-cpp/src/AbstractStreamAutomaton.cpp index 0409113cf..355095ec0 100644 --- a/reactivesocket-cpp/src/AbstractStreamAutomaton.cpp +++ b/reactivesocket-cpp/src/AbstractStreamAutomaton.cpp @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #include "AbstractStreamAutomaton.h" #include diff --git a/reactivesocket-cpp/src/AbstractStreamAutomaton.h b/reactivesocket-cpp/src/AbstractStreamAutomaton.h index 706d04cca..e2f03be79 100644 --- a/reactivesocket-cpp/src/AbstractStreamAutomaton.h +++ b/reactivesocket-cpp/src/AbstractStreamAutomaton.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/ConnectionAutomaton.cpp b/reactivesocket-cpp/src/ConnectionAutomaton.cpp index f29f3f8f3..ed5c8a174 100644 --- a/reactivesocket-cpp/src/ConnectionAutomaton.cpp +++ b/reactivesocket-cpp/src/ConnectionAutomaton.cpp @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #include "reactivesocket-cpp/src/ConnectionAutomaton.h" #include diff --git a/reactivesocket-cpp/src/ConnectionAutomaton.h b/reactivesocket-cpp/src/ConnectionAutomaton.h index 2eb3e1e56..494395763 100644 --- a/reactivesocket-cpp/src/ConnectionAutomaton.h +++ b/reactivesocket-cpp/src/ConnectionAutomaton.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/DuplexConnection.h b/reactivesocket-cpp/src/DuplexConnection.h index 9883f40c4..d15b461d0 100644 --- a/reactivesocket-cpp/src/DuplexConnection.h +++ b/reactivesocket-cpp/src/DuplexConnection.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include "reactivesocket-cpp/src/Payload.h" diff --git a/reactivesocket-cpp/src/Frame.cpp b/reactivesocket-cpp/src/Frame.cpp index a71057e32..6e64abc41 100644 --- a/reactivesocket-cpp/src/Frame.cpp +++ b/reactivesocket-cpp/src/Frame.cpp @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #include "reactivesocket-cpp/src/Frame.h" #include diff --git a/reactivesocket-cpp/src/Frame.h b/reactivesocket-cpp/src/Frame.h index 3cacdf274..4865d92cd 100644 --- a/reactivesocket-cpp/src/Frame.h +++ b/reactivesocket-cpp/src/Frame.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/Payload.h b/reactivesocket-cpp/src/Payload.h index d6d058be9..1508605a3 100644 --- a/reactivesocket-cpp/src/Payload.h +++ b/reactivesocket-cpp/src/Payload.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/ReactiveSocket.cpp b/reactivesocket-cpp/src/ReactiveSocket.cpp index 9dcc9c17a..b4990638c 100644 --- a/reactivesocket-cpp/src/ReactiveSocket.cpp +++ b/reactivesocket-cpp/src/ReactiveSocket.cpp @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #include "reactivesocket-cpp/src/ReactiveSocket.h" #include diff --git a/reactivesocket-cpp/src/ReactiveSocket.h b/reactivesocket-cpp/src/ReactiveSocket.h index 6170f80b6..68fdc6fd0 100644 --- a/reactivesocket-cpp/src/ReactiveSocket.h +++ b/reactivesocket-cpp/src/ReactiveSocket.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/ReactiveStreamsCompat.h b/reactivesocket-cpp/src/ReactiveStreamsCompat.h index 5eeffb549..171ad0df2 100644 --- a/reactivesocket-cpp/src/ReactiveStreamsCompat.h +++ b/reactivesocket-cpp/src/ReactiveStreamsCompat.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include "reactive-streams-cpp/Publisher.h" diff --git a/reactivesocket-cpp/src/RequestHandler.h b/reactivesocket-cpp/src/RequestHandler.h index 6436194df..630bd03c4 100644 --- a/reactivesocket-cpp/src/RequestHandler.h +++ b/reactivesocket-cpp/src/RequestHandler.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include "reactivesocket-cpp/src/Payload.h" diff --git a/reactivesocket-cpp/src/automata/ChannelRequester.cpp b/reactivesocket-cpp/src/automata/ChannelRequester.cpp index 65e47e480..28cf8c485 100644 --- a/reactivesocket-cpp/src/automata/ChannelRequester.cpp +++ b/reactivesocket-cpp/src/automata/ChannelRequester.cpp @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #include "ChannelRequester.h" #include diff --git a/reactivesocket-cpp/src/automata/ChannelRequester.h b/reactivesocket-cpp/src/automata/ChannelRequester.h index 04c87cf48..4fb9ebe67 100644 --- a/reactivesocket-cpp/src/automata/ChannelRequester.h +++ b/reactivesocket-cpp/src/automata/ChannelRequester.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/automata/ChannelResponder.cpp b/reactivesocket-cpp/src/automata/ChannelResponder.cpp index 4936cad0b..1c85f4898 100644 --- a/reactivesocket-cpp/src/automata/ChannelResponder.cpp +++ b/reactivesocket-cpp/src/automata/ChannelResponder.cpp @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #include "ChannelResponder.h" #include diff --git a/reactivesocket-cpp/src/automata/ChannelResponder.h b/reactivesocket-cpp/src/automata/ChannelResponder.h index c37ccebc2..297208b5b 100644 --- a/reactivesocket-cpp/src/automata/ChannelResponder.h +++ b/reactivesocket-cpp/src/automata/ChannelResponder.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/automata/SubscriptionRequester.cpp b/reactivesocket-cpp/src/automata/SubscriptionRequester.cpp index ce1d7e083..ebe790d72 100644 --- a/reactivesocket-cpp/src/automata/SubscriptionRequester.cpp +++ b/reactivesocket-cpp/src/automata/SubscriptionRequester.cpp @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #include "SubscriptionRequester.h" #include diff --git a/reactivesocket-cpp/src/automata/SubscriptionRequester.h b/reactivesocket-cpp/src/automata/SubscriptionRequester.h index 66f8ff734..fb01140fa 100644 --- a/reactivesocket-cpp/src/automata/SubscriptionRequester.h +++ b/reactivesocket-cpp/src/automata/SubscriptionRequester.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/automata/SubscriptionResponder.cpp b/reactivesocket-cpp/src/automata/SubscriptionResponder.cpp index 6c7ac3e72..a96efe69d 100644 --- a/reactivesocket-cpp/src/automata/SubscriptionResponder.cpp +++ b/reactivesocket-cpp/src/automata/SubscriptionResponder.cpp @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #include "SubscriptionResponder.h" #include diff --git a/reactivesocket-cpp/src/automata/SubscriptionResponder.h b/reactivesocket-cpp/src/automata/SubscriptionResponder.h index 33addcc93..22d06026e 100644 --- a/reactivesocket-cpp/src/automata/SubscriptionResponder.h +++ b/reactivesocket-cpp/src/automata/SubscriptionResponder.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/mixins/ConsumerMixin-inl.h b/reactivesocket-cpp/src/mixins/ConsumerMixin-inl.h index b5a8079a0..c9d564397 100644 --- a/reactivesocket-cpp/src/mixins/ConsumerMixin-inl.h +++ b/reactivesocket-cpp/src/mixins/ConsumerMixin-inl.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include "ConsumerMixin.h" diff --git a/reactivesocket-cpp/src/mixins/ConsumerMixin.h b/reactivesocket-cpp/src/mixins/ConsumerMixin.h index 4708a2c7b..5ba5c3f39 100644 --- a/reactivesocket-cpp/src/mixins/ConsumerMixin.h +++ b/reactivesocket-cpp/src/mixins/ConsumerMixin.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/mixins/ExecutorMixin.h b/reactivesocket-cpp/src/mixins/ExecutorMixin.h index d8c9f9f65..aa245b79d 100644 --- a/reactivesocket-cpp/src/mixins/ExecutorMixin.h +++ b/reactivesocket-cpp/src/mixins/ExecutorMixin.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/mixins/IntrusiveDeleter.h b/reactivesocket-cpp/src/mixins/IntrusiveDeleter.h index 887025885..9e5ed43b2 100644 --- a/reactivesocket-cpp/src/mixins/IntrusiveDeleter.h +++ b/reactivesocket-cpp/src/mixins/IntrusiveDeleter.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/mixins/LoggingMixin.h b/reactivesocket-cpp/src/mixins/LoggingMixin.h index 4d4412734..1488d51f8 100644 --- a/reactivesocket-cpp/src/mixins/LoggingMixin.h +++ b/reactivesocket-cpp/src/mixins/LoggingMixin.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/mixins/MemoryMixin.h b/reactivesocket-cpp/src/mixins/MemoryMixin.h index b3c3b7c89..aba78970e 100644 --- a/reactivesocket-cpp/src/mixins/MemoryMixin.h +++ b/reactivesocket-cpp/src/mixins/MemoryMixin.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/mixins/MixinTerminator.h b/reactivesocket-cpp/src/mixins/MixinTerminator.h index 0df33545e..6b39ef4f1 100644 --- a/reactivesocket-cpp/src/mixins/MixinTerminator.h +++ b/reactivesocket-cpp/src/mixins/MixinTerminator.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include @@ -40,8 +39,7 @@ class MixinTerminator struct Parameters { Parameters() = default; Parameters(ConnectionAutomaton* _connection, StreamId _streamId) - : connection(_connection), - streamId(_streamId) {} + : connection(_connection), streamId(_streamId) {} ConnectionAutomaton* connection{nullptr}; StreamId streamId{0}; diff --git a/reactivesocket-cpp/src/mixins/PublisherMixin.h b/reactivesocket-cpp/src/mixins/PublisherMixin.h index 721cde581..8944b2714 100644 --- a/reactivesocket-cpp/src/mixins/PublisherMixin.h +++ b/reactivesocket-cpp/src/mixins/PublisherMixin.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/mixins/SinkIfMixin.h b/reactivesocket-cpp/src/mixins/SinkIfMixin.h index e92235cc5..22dd24303 100644 --- a/reactivesocket-cpp/src/mixins/SinkIfMixin.h +++ b/reactivesocket-cpp/src/mixins/SinkIfMixin.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/src/mixins/SourceIfMixin.h b/reactivesocket-cpp/src/mixins/SourceIfMixin.h index 88ae59089..c7e13ce98 100644 --- a/reactivesocket-cpp/src/mixins/SourceIfMixin.h +++ b/reactivesocket-cpp/src/mixins/SourceIfMixin.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include "reactivesocket-cpp/src/Payload.h" diff --git a/reactivesocket-cpp/src/mixins/StreamIfMixin.h b/reactivesocket-cpp/src/mixins/StreamIfMixin.h index fb7db20ca..c4879a3cf 100644 --- a/reactivesocket-cpp/src/mixins/StreamIfMixin.h +++ b/reactivesocket-cpp/src/mixins/StreamIfMixin.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include "reactivesocket-cpp/src/AbstractStreamAutomaton.h" diff --git a/reactivesocket-cpp/test/FrameTest.cpp b/reactivesocket-cpp/test/FrameTest.cpp index e7e376212..0397ed54b 100644 --- a/reactivesocket-cpp/test/FrameTest.cpp +++ b/reactivesocket-cpp/test/FrameTest.cpp @@ -1,7 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - - #include #include diff --git a/reactivesocket-cpp/test/InlineConnection.cpp b/reactivesocket-cpp/test/InlineConnection.cpp index f701b5ef1..a2ebc7962 100644 --- a/reactivesocket-cpp/test/InlineConnection.cpp +++ b/reactivesocket-cpp/test/InlineConnection.cpp @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #include "reactivesocket-cpp/test/InlineConnection.h" #include diff --git a/reactivesocket-cpp/test/InlineConnection.h b/reactivesocket-cpp/test/InlineConnection.h index 81199e130..c44688c48 100644 --- a/reactivesocket-cpp/test/InlineConnection.h +++ b/reactivesocket-cpp/test/InlineConnection.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/test/InlineConnectionTest.cpp b/reactivesocket-cpp/test/InlineConnectionTest.cpp index 9ec18f5a2..24f0d3d6c 100644 --- a/reactivesocket-cpp/test/InlineConnectionTest.cpp +++ b/reactivesocket-cpp/test/InlineConnectionTest.cpp @@ -1,7 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - - #include #include diff --git a/reactivesocket-cpp/test/MockDuplexConnection.h b/reactivesocket-cpp/test/MockDuplexConnection.h index 927af27b7..764c0c2ef 100644 --- a/reactivesocket-cpp/test/MockDuplexConnection.h +++ b/reactivesocket-cpp/test/MockDuplexConnection.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/test/MockRequestHandler.h b/reactivesocket-cpp/test/MockRequestHandler.h index aa3e2ca04..d6e0ac4f0 100644 --- a/reactivesocket-cpp/test/MockRequestHandler.h +++ b/reactivesocket-cpp/test/MockRequestHandler.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include diff --git a/reactivesocket-cpp/test/ReactiveSocketTest.cpp b/reactivesocket-cpp/test/ReactiveSocketTest.cpp index 2d92fff48..06a8ba9d0 100644 --- a/reactivesocket-cpp/test/ReactiveSocketTest.cpp +++ b/reactivesocket-cpp/test/ReactiveSocketTest.cpp @@ -1,7 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - - #include #include #include @@ -124,12 +122,12 @@ TEST(ReactiveSocketTest, RequestChannel) { })); EXPECT_CALL(serverOutputSub, cancel_()).InSequence(s0); EXPECT_CALL(serverInput, onComplete_()).InSequence(s1); - EXPECT_CALL(clientInput, onComplete_()).InSequence(s2).WillOnce(Invoke([&]() { - clientInputSub->cancel(); - })); - EXPECT_CALL(clientOutputSub, cancel_()).InSequence(s3).WillOnce(Invoke([&]() { - clientOutput->onComplete(); - })); + EXPECT_CALL(clientInput, onComplete_()) + .InSequence(s2) + .WillOnce(Invoke([&]() { clientInputSub->cancel(); })); + EXPECT_CALL(clientOutputSub, cancel_()) + .InSequence(s3) + .WillOnce(Invoke([&]() { clientOutput->onComplete(); })); // Kick off the magic. clientOutput = &clientSock->requestChannel(clientInput); @@ -205,9 +203,9 @@ TEST(ReactiveSocketTest, RequestSubscription) { .InSequence(s, s0, s1) // Client closes the channel in response. .WillOnce(Invoke([&](Payload&) { clientInputSub->cancel(); })); - EXPECT_CALL(serverOutputSub, cancel_()).InSequence(s0).WillOnce(Invoke([&]() { - serverOutput->onComplete(); - })); + EXPECT_CALL(serverOutputSub, cancel_()) + .InSequence(s0) + .WillOnce(Invoke([&]() { serverOutput->onComplete(); })); EXPECT_CALL(clientInput, onComplete_()).InSequence(s1); // Kick off the magic. diff --git a/reactivesocket-cpp/test/ReactiveStreamsMocksCompat.h b/reactivesocket-cpp/test/ReactiveStreamsMocksCompat.h index 53eafdfab..e0ea2b2e8 100644 --- a/reactivesocket-cpp/test/ReactiveStreamsMocksCompat.h +++ b/reactivesocket-cpp/test/ReactiveStreamsMocksCompat.h @@ -1,6 +1,5 @@ // Copyright 2004-present Facebook. All Rights Reserved. - #pragma once #include "reactive-streams-cpp/Mocks.h"