Skip to content

Commit

Permalink
Use nested namespace name
Browse files Browse the repository at this point in the history
Summary:
changelog: [internal]

Enable two new clang tidy checks:
- modernize-concat-nested-namespaces
- google-build-using-namespace

jest_e2e[run_all_tests]

Reviewed By: rshest

Differential Revision: D40020646

fbshipit-source-id: f3be80b5f829dd0ba376bdd70ed13332e114d48a
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Oct 13, 2022
1 parent 9715993 commit 51af7cd
Show file tree
Hide file tree
Showing 141 changed files with 301 additions and 575 deletions.
2 changes: 2 additions & 0 deletions ReactCommon/react/renderer/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Checks: '>
clang-diagnostic-*,
modernize-avoid-bind,
modernize-avoid-c-arrays,
modernize-concat-nested-namespaces,
modernize-deprecated-headers,
modernize-deprecated-ios-base-aliases,
modernize-loop-convert,
Expand Down Expand Up @@ -182,5 +183,6 @@ clang-analyzer-unix.cstring.NullArg,
clang-analyzer-valist.CopyToSelf,
clang-analyzer-valist.Uninitialized,
clang-analyzer-valist.Unterminated,
google-build-using-namespace,
'
...
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include <react/renderer/animations/utils.h>
#include <algorithm>

namespace facebook {
namespace react {
namespace facebook::react {

void LayoutAnimationDriver::animationMutationsForFrame(
SurfaceId surfaceId,
Expand Down Expand Up @@ -107,5 +106,4 @@ void LayoutAnimationDriver::animationMutationsForFrame(
&shouldFirstComeBeforeSecondMutation);
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@

#include <glog/logging.h>

namespace facebook {
namespace react {
namespace facebook::react {

#ifdef LAYOUT_ANIMATION_VERBOSE_LOGGING
static std::string GetMutationInstructionString(
Expand Down Expand Up @@ -1683,5 +1682,4 @@ void LayoutAnimationKeyFrameManager::simulateImagePropsMemoryAccess(
}
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@

MockClock::time_point MockClock::time_ = {};

namespace facebook {
namespace react {
namespace facebook::react {

static void testShadowNodeTreeLifeCycleLayoutAnimations(
uint_fast32_t seed,
Expand Down Expand Up @@ -309,8 +308,7 @@ static void testShadowNodeTreeLifeCycleLayoutAnimations(
SUCCEED();
}

} // namespace react
} // namespace facebook
} // namespace facebook::react

using namespace facebook::react;

Expand Down
6 changes: 2 additions & 4 deletions ReactCommon/react/renderer/animations/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#include "utils.h"
#include <cmath>

namespace facebook {
namespace react {
namespace facebook::react {

std::pair<Float, Float> calculateAnimationProgress(
uint64_t now,
Expand Down Expand Up @@ -67,5 +66,4 @@ std::pair<Float, Float> calculateAnimationProgress(
}
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

#include <react/renderer/debug/DebugStringConvertibleItem.h>

namespace facebook {
namespace react {
namespace facebook::react {

using Fragment = AttributedString::Fragment;
using Fragments = AttributedString::Fragments;
Expand Down Expand Up @@ -166,5 +165,4 @@ SharedDebugStringConvertibleList AttributedString::getDebugChildren() const {
}
#endif

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

#include <utility>

namespace facebook {
namespace react {
namespace facebook::react {

AttributedStringBox::AttributedStringBox()
: mode_(Mode::Value),
Expand Down Expand Up @@ -86,5 +85,4 @@ bool operator!=(
return !(lhs == rhs);
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include <react/renderer/graphics/conversions.h>
#include <react/utils/FloatComparison.h>

namespace facebook {
namespace react {
namespace facebook::react {

bool ParagraphAttributes::operator==(const ParagraphAttributes &rhs) const {
return std::tie(
Expand Down Expand Up @@ -55,5 +54,4 @@ SharedDebugStringConvertibleList ParagraphAttributes::getDebugProps() const {
}
#endif

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

#include <react/renderer/debug/debugStringConvertibleUtils.h>

namespace facebook {
namespace react {
namespace facebook::react {

void TextAttributes::apply(TextAttributes textAttributes) {
// Color
Expand Down Expand Up @@ -208,5 +207,4 @@ SharedDebugStringConvertibleList TextAttributes::getDebugProps() const {
}
#endif

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <gtest/gtest.h>
#include <react/renderer/attributedstring/AttributedStringBox.h>

namespace facebook {
namespace react {
namespace facebook::react {

TEST(AttributedStringBoxTest, testDefaultConstructor) {
auto attributedStringBox = AttributedStringBox{};
Expand Down Expand Up @@ -101,5 +100,4 @@ TEST(AttributedStringBoxTest, testMoveAssignment) {
}
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <react/renderer/attributedstring/conversions.h>
#include <react/renderer/attributedstring/primitives.h>

namespace facebook {
namespace react {
namespace facebook::react {

#ifdef ANDROID

Expand All @@ -32,5 +31,4 @@ TEST(ParagraphAttributesTest, testToDynamic) {

#endif

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

#include "ComponentDescriptorProviderRegistry.h"

namespace facebook {
namespace react {
namespace facebook::react {

void ComponentDescriptorProviderRegistry::add(
const ComponentDescriptorProvider &provider) const {
Expand Down Expand Up @@ -81,5 +80,4 @@ ComponentDescriptorProviderRegistry::createComponentDescriptorRegistry(
return registry;
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

#include <utility>

namespace facebook {
namespace react {
namespace facebook::react {

ComponentDescriptorRegistry::ComponentDescriptorRegistry(
ComponentDescriptorParameters parameters,
Expand Down Expand Up @@ -160,5 +159,4 @@ ComponentDescriptorRegistry::getFallbackComponentDescriptor() const {
return _fallbackComponentDescriptor;
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

#include "componentNameByReactViewName.h"

namespace facebook {
namespace react {
namespace facebook::react {

std::string componentNameByReactViewName(std::string viewName) {
// We need this function only for the transition period;
Expand Down Expand Up @@ -69,5 +68,4 @@ std::string componentNameByReactViewName(std::string viewName) {
return viewName;
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@

using namespace facebook;

namespace facebook {
namespace react {
namespace facebook::react {

/**
* Public API to install the NativeComponentRegistryBinding.
Expand Down Expand Up @@ -49,7 +48,7 @@ bool NativeComponentRegistryBinding::hasComponent(const std::string &name) {

jsi::Value NativeComponentRegistryBinding::jsProxy(
jsi::Runtime &runtime,
const jsi::Value &thisVal,
const jsi::Value & /*thisVal*/,
const jsi::Value *args,
size_t count) {
if (count != 1) {
Expand All @@ -64,5 +63,4 @@ jsi::Value NativeComponentRegistryBinding::jsProxy(
return {result};
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

#include "ImageEventEmitter.h"

namespace facebook {
namespace react {
namespace facebook::react {

void ImageEventEmitter::onLoadStart() const {
dispatchEvent("loadStart");
Expand Down Expand Up @@ -38,5 +37,4 @@ void ImageEventEmitter::onPartialLoad() const {
dispatchEvent("partialLoad");
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
6 changes: 2 additions & 4 deletions ReactCommon/react/renderer/components/image/ImageProps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <react/renderer/core/CoreFeatures.h>
#include <react/renderer/core/propsConversions.h>

namespace facebook {
namespace react {
namespace facebook::react {

ImageProps::ImageProps(
const PropsParserContext &context,
Expand Down Expand Up @@ -99,5 +98,4 @@ void ImageProps::setProp(
}
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include <react/renderer/core/LayoutContext.h>
#include "ImageState.h"

namespace facebook {
namespace react {
namespace facebook::react {

const char ImageComponentName[] = "Image";

Expand Down Expand Up @@ -94,5 +93,4 @@ void ImageShadowNode::layout(LayoutContext layoutContext) {
ConcreteViewShadowNode::layout(layoutContext);
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
6 changes: 2 additions & 4 deletions ReactCommon/react/renderer/components/image/ImageState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

#include "ImageState.h"

namespace facebook {
namespace react {
namespace facebook::react {

ImageSource ImageState::getImageSource() const {
return imageSource_;
Expand All @@ -22,5 +21,4 @@ Float ImageState::getBlurRadius() const {
return blurRadius_;
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
#include <react/renderer/components/modal/ModalHostViewShadowNode.h>
#include <react/renderer/core/LayoutContext.h>

namespace facebook {
namespace react {
namespace facebook::react {

extern const char ModalHostViewComponentName[] = "ModalHostView";

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

#include "ModalHostViewState.h"

namespace facebook {
namespace react {
namespace facebook::react {

#ifdef ANDROID
folly::dynamic ModalHostViewState::getDynamic() const {
Expand All @@ -17,5 +16,4 @@ folly::dynamic ModalHostViewState::getDynamic() const {
}
#endif

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

using namespace facebook::jni;

namespace facebook {
namespace react {
namespace facebook::react {

Size AndroidProgressBarMeasurementsManager::measure(
SurfaceId surfaceId,
Expand Down Expand Up @@ -71,5 +70,4 @@ Size AndroidProgressBarMeasurementsManager::measure(
return measurement;
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <react/renderer/components/progressbar/AndroidProgressBarShadowNode.h>
#include <react/renderer/core/LayoutContext.h>

namespace facebook {
namespace react {
namespace facebook::react {

extern const char AndroidProgressBarComponentName[] = "AndroidProgressBar";

Expand All @@ -31,5 +30,4 @@ Size AndroidProgressBarShadowNode::measureContent(
getSurfaceId(), getConcreteProps(), layoutConstraints);
}

} // namespace react
} // namespace facebook
} // namespace facebook::react
Loading

0 comments on commit 51af7cd

Please sign in to comment.