From 168b802a5267acdcebf17655d2ed3e2e397e48ce Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Tue, 17 Oct 2023 04:42:15 -0700 Subject: [PATCH] Remove .clang-format overrides (#41025) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41025 Align all code on the shared .clang-format in the repo root. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D50322323 fbshipit-source-id: 1e10231c92072527fc5eaa5de7328ab7b400ad85 --- .../com/facebook/react/runtime/.clang-format | 91 ------------------- .../hermes/inspector-modern/.clang-format | 87 ------------------ .../chrome/ConnectionDemux.cpp | 6 +- .../inspector-modern/chrome/ConnectionDemux.h | 10 +- .../inspector-modern/chrome/Registration.cpp | 4 +- .../inspector-modern/chrome/Registration.h | 2 +- .../chrome/tests/ConnectionDemuxTests.cpp | 8 +- 7 files changed, 15 insertions(+), 193 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/.clang-format delete mode 100644 packages/react-native/ReactCommon/hermes/inspector-modern/.clang-format diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/.clang-format b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/.clang-format deleted file mode 100644 index bc20b078f0e..00000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/.clang-format +++ /dev/null @@ -1,91 +0,0 @@ ---- -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: true -ObjCSpaceBeforeProtocolList: true -PenaltyBreakBeforeFirstCallParameter: 1 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 200 -PointerAlignment: Right -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 ---- -Language: ObjC -ColumnLimit: 120 -BreakBeforeBraces: WebKit -... diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/.clang-format b/packages/react-native/ReactCommon/hermes/inspector-modern/.clang-format deleted file mode 100644 index 550292f9506..00000000000 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/.clang-format +++ /dev/null @@ -1,87 +0,0 @@ ---- -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: Right -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/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp index 5ab0955ecd9..0b9796aee0e 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp @@ -61,7 +61,7 @@ void LocalConnection::disconnect() { } // namespace ConnectionDemux::ConnectionDemux( - facebook::react::jsinspector_modern::IInspector &inspector) + facebook::react::jsinspector_modern::IInspector& inspector) : globalInspector_(inspector), inspectedContexts_(std::make_shared>()) {} @@ -69,7 +69,7 @@ ConnectionDemux::~ConnectionDemux() = default; DebugSessionToken ConnectionDemux::enableDebugging( std::unique_ptr adapter, - const std::string &title) { + const std::string& title) { std::scoped_lock lock(mutex_); // TODO(#22976087): workaround for ComponentScript contexts never being @@ -112,7 +112,7 @@ int ConnectionDemux::addPage( // require a copyable callback? std::shared_ptr sharedConn = std::move(remoteConn); if (!conn->registerCallbacks( - [sharedConn](const std::string &message) { + [sharedConn](const std::string& message) { sharedConn->onMessage(message); }, [sharedConn]() { sharedConn->onDisconnect(); })) { diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h index 9ed90410d20..ba1325ef33f 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h @@ -34,15 +34,15 @@ namespace chrome { class ConnectionDemux { public: explicit ConnectionDemux( - facebook::react::jsinspector_modern::IInspector &inspector); + facebook::react::jsinspector_modern::IInspector& inspector); ~ConnectionDemux(); - ConnectionDemux(const ConnectionDemux &) = delete; - ConnectionDemux &operator=(const ConnectionDemux &) = delete; + ConnectionDemux(const ConnectionDemux&) = delete; + ConnectionDemux& operator=(const ConnectionDemux&) = delete; DebugSessionToken enableDebugging( std::unique_ptr adapter, - const std::string &title); + const std::string& title); void disableDebugging(DebugSessionToken session); private: @@ -50,7 +50,7 @@ class ConnectionDemux { std::shared_ptr conn); void removePage(int pageId); - facebook::react::jsinspector_modern::IInspector &globalInspector_; + facebook::react::jsinspector_modern::IInspector& globalInspector_; std::mutex mutex_; std::unordered_map< diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp index 3b73b49e7fb..312330c2736 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp @@ -17,7 +17,7 @@ namespace chrome { namespace { -ConnectionDemux &demux() { +ConnectionDemux& demux() { static ConnectionDemux instance{ facebook::react::jsinspector_modern::getInspectorInstance()}; return instance; @@ -27,7 +27,7 @@ ConnectionDemux &demux() { DebugSessionToken enableDebugging( std::unique_ptr adapter, - const std::string &title) { + const std::string& title) { return demux().enableDebugging(std::move(adapter), title); } diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.h b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.h index bda9300e837..3395a9e0985 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.h +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/Registration.h @@ -30,7 +30,7 @@ using DebugSessionToken = int; */ extern DebugSessionToken enableDebugging( std::unique_ptr adapter, - const std::string &title); + const std::string& title); /* * disableDebugging removes this runtime from the list of debuggable JS targets diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/tests/ConnectionDemuxTests.cpp b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/tests/ConnectionDemuxTests.cpp index f60e9bd5fb0..7bf943fcd38 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/tests/ConnectionDemuxTests.cpp +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/tests/ConnectionDemuxTests.cpp @@ -29,10 +29,10 @@ using ::facebook::react::jsinspector_modern::IRemoteConnection; namespace { std::unordered_map makePageMap( - const std::vector &pages) { + const std::vector& pages) { std::unordered_map pageMap; - for (auto &page : pages) { + for (auto& page : pages) { pageMap[page.id] = page.title; } @@ -40,8 +40,8 @@ std::unordered_map makePageMap( } void expectPages( - IInspector &inspector, - const std::unordered_map &expected) { + IInspector& inspector, + const std::unordered_map& expected) { auto pages = makePageMap(inspector.getPages()); EXPECT_EQ(pages, expected); }