From e494d26bf5bd61c6e20f5b151a4951beb0f91515 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Tue, 15 Jan 2019 13:50:38 -0800 Subject: [PATCH] Change function naming, add documentation. --- .clang-tidy | 3 +- CONTRIBUTING.md | 28 ++++++++- include/ignition/gazebo/Conversions.hh | 16 ++--- src/Conversions.cc | 8 +-- src/Conversions_TEST.cc | 4 +- src/EntityComponentManager_TEST.cc | 82 +++++++++++++------------- src/SimulationRunner.cc | 2 +- src/SystemLoader.cc | 19 +----- src/gui_main.cc | 8 +-- src/ign_TEST.cc | 8 +-- src/main.cc | 8 +-- src/server_main.cc | 8 +-- src/systems/SceneBroadcaster.cc | 6 +- test/integration/examples_build.cc | 6 +- test/integration/play_pause.cc | 46 +++++++-------- test/performance/each.cc | 4 +- 16 files changed, 135 insertions(+), 121 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index db3d04c4e1..226016ce11 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -2,7 +2,8 @@ Checks: '-*,bugprone-*,modernize-*,performance-*,-modernize-use-equals-delete,-m CheckOptions: - { key: readability-identifier-naming.NamespaceCase, value: lower_case } - { key: readability-identifier-naming.ClassCase, value: CamelCase } - - { key: readability-identifier-naming.StructCase, value: CamelCase } + - { key: readability-identifier-naming.GlobalFunctionCase, value: camelBack } + - { key: readability-identifier-naming.StructCase, value: CamelCase } - { key: readability-identifier-naming.FunctionCase, value: CamelCase } - { key: readability-identifier-naming.ParameterPrefix, value: _ } - { key: readability-identifier-naming.VariableCase, value: camelBack } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e451870dd3..ebd540e167 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -202,8 +202,34 @@ get aquainted with this development process. The tool does not catch all style errors. See the [code style](#markdown-header-style-guides) section below for more information. +1. **(optional) Use clang-tidy for additional checks.** + + clang-tidy should return no errors when run against the code base. + + Ubuntu users can install via: + + sudo apt-get install clang-tidy-6.0 # or clang-tidy-7 with LLVM PPAs + + In order to run clang-tidy, CMake must be used to generate a `compliation_commands.json`, also referred to as a compilation command database. In order to generate this file, add a flag to your `cmake` invokation (or to the `--cmake-args` flag if using `colcon`) + + # For CMake + mkdir build + cd build + cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1 + + # For colcon + colcon build --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=1 + + Once the database is generated, execute from the `ign-gazebo` source directory: + + run-clang-tidy-6.0.py -p=./build/ -header-filter=`pwd`/include/* -j6 -quiet + + Address issues that are found. + + If you are feeling adventurous, you can experiment with adding additional checks to the `.clang-tidy` file by referencing the full list of options in the [clang-tidy documentation](http://clang.llvm.org/extra/clang-tidy/checks/list.html) + 1. **Tests must pass.** You can check by running `make test` in - your build directory. Running tests may take a bit of time, be patient. + your build directory. Running tests may take a bit of time, be patient. 1. **Write documentation.** Document all your code. Every class, function, member variable must have doxygen comments. All code in source files must have documentation that describes the functionality. This will help reviewers and future developers. diff --git a/include/ignition/gazebo/Conversions.hh b/include/ignition/gazebo/Conversions.hh index a8424371d0..08b0f0e927 100644 --- a/include/ignition/gazebo/Conversions.hh +++ b/include/ignition/gazebo/Conversions.hh @@ -42,7 +42,7 @@ namespace ignition /// \return Conversion result. /// \tparam OUT Output type. template - OUT IGNITION_GAZEBO_VISIBLE Convert(const sdf::Geometry &_in) + OUT IGNITION_GAZEBO_VISIBLE convert(const sdf::Geometry &_in) { OUT::ConversionNotImplemented; } @@ -52,14 +52,14 @@ namespace ignition /// \param[in] _in SDF geometry. /// \return Geometry message. template<> - msgs::Geometry IGNITION_GAZEBO_VISIBLE Convert(const sdf::Geometry &_in); + msgs::Geometry IGNITION_GAZEBO_VISIBLE convert(const sdf::Geometry &_in); /// \brief Generic conversion from an SDF material to another type. /// \param[in] _in SDF material. /// \return Conversion result. /// \tparam OUT Output type. template - OUT IGNITION_GAZEBO_VISIBLE Convert(const sdf::Material &_in) + OUT IGNITION_GAZEBO_VISIBLE convert(const sdf::Material &_in) { OUT::ConversionNotImplemented; } @@ -69,14 +69,14 @@ namespace ignition /// \param[in] _in SDF material. /// \return Material message. template<> - msgs::Material IGNITION_GAZEBO_VISIBLE Convert(const sdf::Material &_in); + msgs::Material IGNITION_GAZEBO_VISIBLE convert(const sdf::Material &_in); /// \brief Generic conversion from an SDF light to another type. /// \param[in] _in SDF light. /// \return Conversion result. /// \tparam OUT Output type. template - OUT IGNITION_GAZEBO_VISIBLE Convert(const sdf::Light &_in) + OUT IGNITION_GAZEBO_VISIBLE convert(const sdf::Light &_in) { OUT::ConversionNotImplemented; } @@ -86,14 +86,14 @@ namespace ignition /// \param[in] _in SDF light. /// \return Light message. template<> - msgs::Light IGNITION_GAZEBO_VISIBLE Convert(const sdf::Light &_in); + msgs::Light IGNITION_GAZEBO_VISIBLE convert(const sdf::Light &_in); /// \brief Generic conversion from an SDF gui to another type. /// \param[in] _in SDF gui. /// \return Conversion result. /// \tparam OUT Output type. template - OUT IGNITION_GAZEBO_VISIBLE Convert(const sdf::Gui &_in) + OUT IGNITION_GAZEBO_VISIBLE convert(const sdf::Gui &_in) { OUT::ConversionNotImplemented; } @@ -102,7 +102,7 @@ namespace ignition /// \param[in] _in SDF gui. /// \return Gui message. template<> - msgs::GUI IGNITION_GAZEBO_VISIBLE Convert(const sdf::Gui &_in); + msgs::GUI IGNITION_GAZEBO_VISIBLE convert(const sdf::Gui &_in); } } } diff --git a/src/Conversions.cc b/src/Conversions.cc index 344ad96aeb..7c0460813a 100644 --- a/src/Conversions.cc +++ b/src/Conversions.cc @@ -47,7 +47,7 @@ using namespace gazebo; ////////////////////////////////////////////////// template<> -msgs::Geometry ignition::gazebo::Convert(const sdf::Geometry &_in) +msgs::Geometry ignition::gazebo::convert(const sdf::Geometry &_in) { msgs::Geometry out; if (_in.Type() == sdf::GeometryType::BOX && _in.BoxShape()) @@ -96,7 +96,7 @@ msgs::Geometry ignition::gazebo::Convert(const sdf::Geometry &_in) ////////////////////////////////////////////////// template<> -msgs::Material ignition::gazebo::Convert(const sdf::Material &_in) +msgs::Material ignition::gazebo::convert(const sdf::Material &_in) { msgs::Material out; msgs::Set(out.mutable_ambient(), _in.Ambient()); @@ -107,7 +107,7 @@ msgs::Material ignition::gazebo::Convert(const sdf::Material &_in) ////////////////////////////////////////////////// template<> -msgs::Light ignition::gazebo::Convert(const sdf::Light &_in) +msgs::Light ignition::gazebo::convert(const sdf::Light &_in) { msgs::Light out; out.set_name(_in.Name()); @@ -134,7 +134,7 @@ msgs::Light ignition::gazebo::Convert(const sdf::Light &_in) ////////////////////////////////////////////////// template<> -msgs::GUI ignition::gazebo::Convert(const sdf::Gui &_in) +msgs::GUI ignition::gazebo::convert(const sdf::Gui &_in) { msgs::GUI out; diff --git a/src/Conversions_TEST.cc b/src/Conversions_TEST.cc index a90cc14063..f6f8a36fe5 100644 --- a/src/Conversions_TEST.cc +++ b/src/Conversions_TEST.cc @@ -51,7 +51,7 @@ TEST(Conversions, Light) light.SetSpotFalloff(0.9); msgs::Light lightMsg; - lightMsg = Convert(light); + lightMsg = convert(light); EXPECT_EQ("test_convert_light", lightMsg.name()); EXPECT_EQ(msgs::Light_LightType_DIRECTIONAL, lightMsg.type()); EXPECT_EQ(math::Pose3d(3, 2, 1, 0, IGN_PI, 0), @@ -95,7 +95,7 @@ TEST(Conversions, Gui) auto gui = world->Gui(); ASSERT_NE(nullptr, gui); - auto guiMsg = Convert(*gui); + auto guiMsg = convert(*gui); EXPECT_TRUE(guiMsg.fullscreen()); ASSERT_EQ(2, guiMsg.plugin_size()); diff --git a/src/EntityComponentManager_TEST.cc b/src/EntityComponentManager_TEST.cc index a921263717..2d1dd4f1bc 100644 --- a/src/EntityComponentManager_TEST.cc +++ b/src/EntityComponentManager_TEST.cc @@ -831,7 +831,7 @@ TEST_P(EntityComponentManagerFixture, ViewsEraseEntity) ////////////////////////////////////////////////// /// \brief Helper function to count the number of "new" entities template -int NewCount(EntityCompMgrTest &_manager) +int newCount(EntityCompMgrTest &_manager) { int count = 0; _manager.EachNew( @@ -866,7 +866,7 @@ int NewCount(EntityCompMgrTest &_manager) ////////////////////////////////////////////////// /// \brief Helper function to count the number of "erased" entities template -int ErasedCount(EntityCompMgrTest &_manager) +int erasedCount(EntityCompMgrTest &_manager) { int count = 0; _manager.EachErased( @@ -885,7 +885,7 @@ int ErasedCount(EntityCompMgrTest &_manager) /// \brief Helper function to count the number of entities returned by an Each /// call template -int EachCount(EntityCompMgrTest &_manager) +int eachCount(EntityCompMgrTest &_manager) { int count = 0; _manager.Each( @@ -912,12 +912,12 @@ TEST_P(EntityComponentManagerFixture, EachNewBasic) manager.CreateComponent(e1, 123); manager.CreateComponent(e2, 456); - EXPECT_EQ(2, NewCount(manager)); + EXPECT_EQ(2, newCount(manager)); // This would normally be done after each simulation step after systems are // updated manager.RunClearNewlyCreatedEntities(); - EXPECT_EQ(0, NewCount(manager)); + EXPECT_EQ(0, newCount(manager)); } ////////////////////////////////////////////////// @@ -928,13 +928,13 @@ TEST_P(EntityComponentManagerFixture, EachNewAfterRemoveComponent) auto comp1 = manager.CreateComponent(e1, 123); manager.CreateComponent(e1, 0.0); - EXPECT_EQ(1, NewCount(manager)); + EXPECT_EQ(1, newCount(manager)); manager.RemoveComponent(e1, comp1); - EXPECT_EQ(1, NewCount(manager)); + EXPECT_EQ(1, newCount(manager)); manager.RunClearNewlyCreatedEntities(); - EXPECT_EQ(0, NewCount(manager)); + EXPECT_EQ(0, newCount(manager)); } ////////////////////////////////////////////////// @@ -945,14 +945,14 @@ TEST_P(EntityComponentManagerFixture, EachNewRemoveComponentFromErasedEntity) manager.CreateComponent(e1, 123); manager.RunClearNewlyCreatedEntities(); // Nothing new after cleared - EXPECT_EQ(0, NewCount(manager)); + EXPECT_EQ(0, newCount(manager)); gazebo::Entity e2 = manager.CreateEntity(); manager.CreateComponent(e2, 456); - EXPECT_EQ(1, NewCount(manager)); + EXPECT_EQ(1, newCount(manager)); // Check if this true after RebuildViews manager.RebuildViews(); - EXPECT_EQ(1, NewCount(manager)); + EXPECT_EQ(1, newCount(manager)); } ////////////////////////////////////////////////// @@ -965,7 +965,7 @@ TEST_P(EntityComponentManagerFixture, EachNewAddComponentToExistingEntity) manager.CreateComponent(e2, 456); manager.RunClearNewlyCreatedEntities(); // Nothing new after cleared - EXPECT_EQ(0, NewCount(manager)); + EXPECT_EQ(0, newCount(manager)); // Create a new entity gazebo::Entity e3 = manager.CreateEntity(); @@ -976,9 +976,9 @@ TEST_P(EntityComponentManagerFixture, EachNewAddComponentToExistingEntity) // e1 and e2 have a new double component, but they are not considered new // entities - EXPECT_EQ(0, (NewCount(manager))); + EXPECT_EQ(0, (newCount(manager))); // Only e3 is considered new - EXPECT_EQ(1, NewCount(manager)); + EXPECT_EQ(1, newCount(manager)); } //////////////////////////////////////////////// @@ -995,18 +995,18 @@ TEST_P(EntityComponentManagerFixture, EachErasedBasic) // Erase an entity. manager.RequestEraseEntity(e1); - EXPECT_EQ(1, ErasedCount(manager)); + EXPECT_EQ(1, erasedCount(manager)); manager.RequestEraseEntity(e2); - EXPECT_EQ(2, ErasedCount(manager)); + EXPECT_EQ(2, erasedCount(manager)); // This would normally be done after each simulation step after systems are // updated manager.RunClearNewlyCreatedEntities(); // But it shouldn't affect erased entities - EXPECT_EQ(2, ErasedCount(manager)); + EXPECT_EQ(2, erasedCount(manager)); manager.ProcessEntityErasures(); - EXPECT_EQ(0, ErasedCount(manager)); + EXPECT_EQ(0, erasedCount(manager)); } //////////////////////////////////////////////// @@ -1026,7 +1026,7 @@ TEST_P(EntityComponentManagerFixture, EachErasedAlreadyErased) // try erasing an already erased entity manager.RequestEraseEntity(e2); - EXPECT_EQ(0, ErasedCount(manager)); + EXPECT_EQ(0, erasedCount(manager)); } //////////////////////////////////////////////// @@ -1037,14 +1037,14 @@ TEST_P(EntityComponentManagerFixture, EachErasedAfterRebuild) EXPECT_EQ(1u, manager.EntityCount()); manager.CreateComponent(e1, 123); - EXPECT_EQ(1, NewCount(manager)); + EXPECT_EQ(1, newCount(manager)); manager.RunClearNewlyCreatedEntities(); manager.RequestEraseEntity(e1); - EXPECT_EQ(1, ErasedCount(manager)); + EXPECT_EQ(1, erasedCount(manager)); manager.RebuildViews(); - EXPECT_EQ(1, ErasedCount(manager)); + EXPECT_EQ(1, erasedCount(manager)); } //////////////////////////////////////////////// @@ -1058,8 +1058,8 @@ TEST_P(EntityComponentManagerFixture, EachErasedAddComponentToErasedEntity) // Add a new component to an erased entity. This should be possible since the // entity is only scheduled to be erased. manager.CreateComponent(e1, 0.0); - EXPECT_EQ(1, ErasedCount(manager)); - EXPECT_EQ(1, (ErasedCount(manager))); + EXPECT_EQ(1, erasedCount(manager)); + EXPECT_EQ(1, (erasedCount(manager))); } //////////////////////////////////////////////// @@ -1073,10 +1073,10 @@ TEST_P(EntityComponentManagerFixture, EachErasedAllErased) EXPECT_EQ(2u, manager.EntityCount()); manager.RequestEraseEntities(); - EXPECT_EQ(2, ErasedCount(manager)); + EXPECT_EQ(2, erasedCount(manager)); manager.ProcessEntityErasures(); - EXPECT_EQ(0, ErasedCount(manager)); + EXPECT_EQ(0, erasedCount(manager)); } //////////////////////////////////////////////// @@ -1089,22 +1089,22 @@ TEST_P(EntityComponentManagerFixture, EachNewEachErased) manager.CreateComponent(e2, 456); EXPECT_EQ(2u, manager.EntityCount()); - EXPECT_EQ(2, NewCount(manager)); - EXPECT_EQ(0, ErasedCount(manager)); + EXPECT_EQ(2, newCount(manager)); + EXPECT_EQ(0, erasedCount(manager)); // Erase an entity. manager.RequestEraseEntity(e1); // An entity can be considered new even if there is a request to erase it. - EXPECT_EQ(2, NewCount(manager)); - EXPECT_EQ(1, ErasedCount(manager)); + EXPECT_EQ(2, newCount(manager)); + EXPECT_EQ(1, erasedCount(manager)); // ProcessEntityErasures and ClearNewlyCreatedEntities would be called // together after a simulation step manager.RunClearNewlyCreatedEntities(); manager.ProcessEntityErasures(); - EXPECT_EQ(0, NewCount(manager)); - EXPECT_EQ(0, ErasedCount(manager)); + EXPECT_EQ(0, newCount(manager)); + EXPECT_EQ(0, erasedCount(manager)); } //////////////////////////////////////////////// @@ -1117,17 +1117,17 @@ TEST_P(EntityComponentManagerFixture, EachGetsNewOldErased) manager.CreateComponent(e2, 456); EXPECT_EQ(2u, manager.EntityCount()); - EXPECT_EQ(2, EachCount(manager)); - EXPECT_EQ(2, NewCount(manager)); - EXPECT_EQ(0, ErasedCount(manager)); + EXPECT_EQ(2, eachCount(manager)); + EXPECT_EQ(2, newCount(manager)); + EXPECT_EQ(0, erasedCount(manager)); // Erase an entity. manager.RequestEraseEntity(e1); // Each gets entities that erased - EXPECT_EQ(2, EachCount(manager)); + EXPECT_EQ(2, eachCount(manager)); // An entity can be considered new even if there is a request to erase it. - EXPECT_EQ(2, NewCount(manager)); - EXPECT_EQ(1, ErasedCount(manager)); + EXPECT_EQ(2, newCount(manager)); + EXPECT_EQ(1, erasedCount(manager)); // ProcessEntityErasures and ClearNewlyCreatedEntities would be called // together after a simulation step @@ -1135,9 +1135,9 @@ TEST_P(EntityComponentManagerFixture, EachGetsNewOldErased) manager.ProcessEntityErasures(); // One entity is erased, one left - EXPECT_EQ(1, EachCount(manager)); - EXPECT_EQ(0, NewCount(manager)); - EXPECT_EQ(0, ErasedCount(manager)); + EXPECT_EQ(1, eachCount(manager)); + EXPECT_EQ(0, newCount(manager)); + EXPECT_EQ(0, erasedCount(manager)); } ////////////////////////////////////////////////// diff --git a/src/SimulationRunner.cc b/src/SimulationRunner.cc index 7b1e040725..6922c8a061 100644 --- a/src/SimulationRunner.cc +++ b/src/SimulationRunner.cc @@ -118,7 +118,7 @@ SimulationRunner::SimulationRunner(const sdf::World *_world, // In the future, support modifying GUI from the server at runtime. if (_world->Gui()) { - this->guiMsg = Convert(*_world->Gui()); + this->guiMsg = convert(*_world->Gui()); } std::string infoService{"gui/info"}; diff --git a/src/SystemLoader.cc b/src/SystemLoader.cc index 87494fe653..73450a8895 100644 --- a/src/SystemLoader.cc +++ b/src/SystemLoader.cc @@ -35,20 +35,6 @@ using namespace ignition::gazebo; -////////////////////////////////////////////////// -// \todo(nkoenig) Add 'homePath' to ignition common. -std::string HomePath() -{ - std::string homePath; -#ifndef _WIN32 - ignition::common::env("HOME", homePath); -#else - ignition::common::env("HOMEPATH", homePath); -#endif - - return homePath; -} - class ignition::gazebo::SystemLoaderPrivate { ////////////////////////////////////////////////// @@ -66,8 +52,9 @@ class ignition::gazebo::SystemLoaderPrivate for (const auto &path : systemPluginPaths) systemPaths.AddPluginPaths(path); - auto home = HomePath(); - systemPaths.AddPluginPaths(home + "/.ignition/gazebo/plugins"); + std::string homePath; + ignition::common::env(IGN_HOMEDIR, homePath); + systemPaths.AddPluginPaths(homePath + "/.ignition/gazebo/plugins"); systemPaths.AddPluginPaths(IGN_GAZEBO_PLUGIN_INSTALL_DIR); auto pathToLib = systemPaths.FindSharedLibrary(_filename); diff --git a/src/gui_main.cc b/src/gui_main.cc index 594f6e6894..654b08b883 100644 --- a/src/gui_main.cc +++ b/src/gui_main.cc @@ -35,7 +35,7 @@ DEFINE_int32(verbose, 1, ""); DEFINE_int32(v, 1, ""); ////////////////////////////////////////////////// -void Help() +void help() { std::cout << "ign-gazebo-gui -- Run the Gazebo GUI." << std::endl @@ -55,7 +55,7 @@ void Help() } ////////////////////////////////////////////////// -void Version() +void version() { std::cout << IGNITION_GAZEBO_VERSION_HEADER << std::endl; } @@ -110,7 +110,7 @@ int main(int _argc, char **_argv) gflags::SetCommandLineOption("helpshort", "false"); gflags::SetCommandLineOption("helpfull", "false"); gflags::SetCommandLineOption("helpmatch", ""); - Help(); + help(); return 0; } @@ -118,7 +118,7 @@ int main(int _argc, char **_argv) if (showVersion) { gflags::SetCommandLineOption("version", "false"); - Version(); + version(); return 0; } diff --git a/src/ign_TEST.cc b/src/ign_TEST.cc index 72f11a6f5e..8dd47ac2b3 100644 --- a/src/ign_TEST.cc +++ b/src/ign_TEST.cc @@ -31,7 +31,7 @@ static const std::string kIgnCommand( kBinPath + "/bin/"); ///////////////////////////////////////////////// -std::string CustomExecStr(std::string _cmd) +std::string customExecStr(std::string _cmd) { _cmd += " 2>&1"; FILE *pipe = popen(_cmd.c_str(), "r"); @@ -61,7 +61,7 @@ TEST(CmdLine, Server) std::cout << "Running command [" << cmd << "]" << std::endl; - std::string output = CustomExecStr(cmd); + std::string output = customExecStr(cmd); for (auto i : {1, 2, 3, 4, 5}) { @@ -79,7 +79,7 @@ TEST(CmdLine, GazeboServer) std::cout << "Running command [" << cmd << "]" << std::endl; - std::string output = CustomExecStr(cmd); + std::string output = customExecStr(cmd); for (auto i : {1, 2, 3, 4, 5}) { @@ -97,7 +97,7 @@ TEST(CmdLine, Gazebo) std::cout << "Running command [" << cmd << "]" << std::endl; - std::string output = CustomExecStr(cmd); + std::string output = customExecStr(cmd); for (auto i : {1, 2, 3, 4, 5}) { diff --git a/src/main.cc b/src/main.cc index 7a6dbb73ba..a6e51f701f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -42,7 +42,7 @@ DEFINE_bool(r, false, "Run simulation on start. " "The default is false, which starts simulation paused."); ////////////////////////////////////////////////// -void Help() +void help() { std::cout << "ign-gazebo -- Run the Gazebo server and GUI." << std::endl @@ -76,7 +76,7 @@ void Help() } ////////////////////////////////////////////////// -void Version() +void version() { std::cout << IGNITION_GAZEBO_VERSION_HEADER << std::endl; } @@ -185,7 +185,7 @@ int main(int _argc, char **_argv) gflags::SetCommandLineOption("helpshort", "false"); gflags::SetCommandLineOption("helpfull", "false"); gflags::SetCommandLineOption("helpmatch", ""); - Help(); + help(); return returnValue; } @@ -193,7 +193,7 @@ int main(int _argc, char **_argv) if (showVersion) { gflags::SetCommandLineOption("version", "false"); - Version(); + version(); return returnValue; } diff --git a/src/server_main.cc b/src/server_main.cc index fd3069a061..fd9ed8bf66 100644 --- a/src/server_main.cc +++ b/src/server_main.cc @@ -36,7 +36,7 @@ DEFINE_bool(r, false, "Run simulation on start. " "The default is false, which starts simulation paused."); ////////////////////////////////////////////////// -void Help() +void help() { std::cout << "ign-gazebo-server -- Run the Gazebo server (headless mode)." << std::endl @@ -65,7 +65,7 @@ void Help() } ////////////////////////////////////////////////// -void Version() +void version() { std::cout << IGNITION_GAZEBO_VERSION_HEADER << std::endl; } @@ -120,7 +120,7 @@ int main(int _argc, char **_argv) gflags::SetCommandLineOption("helpshort", "false"); gflags::SetCommandLineOption("helpfull", "false"); gflags::SetCommandLineOption("helpmatch", ""); - Help(); + help(); return 0; } @@ -128,7 +128,7 @@ int main(int _argc, char **_argv) if (showVersion) { gflags::SetCommandLineOption("version", "false"); - Version(); + version(); return 0; } diff --git a/src/systems/SceneBroadcaster.cc b/src/systems/SceneBroadcaster.cc index 06d5183468..420db22a16 100644 --- a/src/systems/SceneBroadcaster.cc +++ b/src/systems/SceneBroadcaster.cc @@ -414,7 +414,7 @@ void SceneBroadcasterPrivate::SceneGraphAddEntities( if (geometryComp) { visualMsg->mutable_geometry()->CopyFrom( - Convert(geometryComp->Data())); + convert(geometryComp->Data())); } // Material is optional @@ -422,7 +422,7 @@ void SceneBroadcasterPrivate::SceneGraphAddEntities( if (materialComp) { visualMsg->mutable_material()->CopyFrom( - Convert(materialComp->Data())); + convert(materialComp->Data())); } // Add to graph @@ -442,7 +442,7 @@ void SceneBroadcasterPrivate::SceneGraphAddEntities( const components::Pose *_poseComp) -> bool { auto lightMsg = std::make_shared(); - lightMsg->CopyFrom(Convert(_lightComp->Data())); + lightMsg->CopyFrom(convert(_lightComp->Data())); lightMsg->set_id(_entity); lightMsg->set_parent_id(_parentComp->Data()); lightMsg->set_name(_nameComp->Data()); diff --git a/test/integration/examples_build.cc b/test/integration/examples_build.cc index 19409698ac..dcc48de727 100644 --- a/test/integration/examples_build.cc +++ b/test/integration/examples_build.cc @@ -37,7 +37,7 @@ using namespace ignition; #include // NOLINT(build/include_order) ///////////////////////////////////////////////// -bool CreateAndSwitchToTempDir(std::string &_newTempPath) +bool createAndSwitchToTempDir(std::string &_newTempPath) { std::string tmppath; const char *tmp = std::getenv("TMPDIR"); @@ -80,7 +80,7 @@ bool CreateAndSwitchToTempDir(std::string &_newTempPath) #include ///////////////////////////////////////////////// -bool CreateAndSwitchToTempDir(std::string &_newTempPath) +bool createAndSwitchToTempDir(std::string &_newTempPath) { char tempPath[MAX_PATH + 1]; DWORD pathLen = ::GetTempPathA(MAX_PATH, tempPath); @@ -151,7 +151,7 @@ void ExamplesBuild::Build(const std::string &_type) // Create a temp build directory std::string tmpBuildDir; - ASSERT_TRUE(CreateAndSwitchToTempDir(tmpBuildDir)); + ASSERT_TRUE(createAndSwitchToTempDir(tmpBuildDir)); EXPECT_TRUE(ignition::common::exists(tmpBuildDir)); igndbg << "Build directory: " << tmpBuildDir<< std::endl; diff --git a/test/integration/play_pause.cc b/test/integration/play_pause.cc index fbfba36226..945ec7692e 100644 --- a/test/integration/play_pause.cc +++ b/test/integration/play_pause.cc @@ -32,7 +32,7 @@ uint64_t kIterations; ///////////////////////////////////////////////// // Send a world control message. -void WorldControl(bool _paused, uint64_t _steps) +void worldControl(bool _paused, uint64_t _steps) { std::function cb = [&](const ignition::msgs::Boolean &/*_rep*/, const bool _result) @@ -49,7 +49,7 @@ void WorldControl(bool _paused, uint64_t _steps) ///////////////////////////////////////////////// // Get the current paused state from the world stats message -void TestPaused(bool _paused) +void testPaused(bool _paused) { std::condition_variable condition; std::mutex mutex; @@ -72,7 +72,7 @@ void TestPaused(bool _paused) ///////////////////////////////////////////////// // Get the current iteration count from the world stats message -uint64_t Iterations() +uint64_t iterations() { std::condition_variable condition; std::mutex mutex; @@ -104,38 +104,38 @@ TEST(PlayPause, PlayPause) server.Run(false); // The server should start paused. - TestPaused(true); - EXPECT_EQ(0u, Iterations()); + testPaused(true); + EXPECT_EQ(0u, iterations()); // Unpause the server, and check - WorldControl(false, 0); - TestPaused(false); - EXPECT_LT(0u, Iterations()); + worldControl(false, 0); + testPaused(false); + EXPECT_LT(0u, iterations()); // Pause the server, and check - WorldControl(true, 0); - TestPaused(true); + worldControl(true, 0); + testPaused(true); // Step forward 1 iteration - uint64_t iters = Iterations(); - WorldControl(true, 1); - EXPECT_EQ(iters + 1u, Iterations()); + uint64_t iters = iterations(); + worldControl(true, 1); + EXPECT_EQ(iters + 1u, iterations()); // The server should be paused after stepping. - TestPaused(true); + testPaused(true); // Step forward 10 iteration - iters = Iterations(); - WorldControl(true, 10); - EXPECT_EQ(iters + 10u, Iterations()); + iters = iterations(); + worldControl(true, 10); + EXPECT_EQ(iters + 10u, iterations()); // The server should be paused after stepping. - TestPaused(true); + testPaused(true); // Unpause the server, and check - WorldControl(false, 0); - TestPaused(false); - EXPECT_GT(Iterations(), iters); + worldControl(false, 0); + testPaused(false); + EXPECT_GT(iterations(), iters); // Stepping while unpaused should not change the pause state - WorldControl(false, 10); - TestPaused(false); + worldControl(false, 10); + testPaused(false); } diff --git a/test/performance/each.cc b/test/performance/each.cc index f97f9a4154..c3e9f13623 100644 --- a/test/performance/each.cc +++ b/test/performance/each.cc @@ -27,7 +27,7 @@ using namespace ignition; using namespace gazebo; -void Warmstart() +void warmstart() { // Create the entity component manager EntityComponentManager mgr; @@ -52,7 +52,7 @@ TEST(EntityComponentManagerPerfrormance, Each) int step = maxEntityCount/10; // Initial allocation of resources can throw off calculations. - Warmstart(); + warmstart(); for (int matchingEntityCount = 1; matchingEntityCount < maxEntityCount; matchingEntityCount += step)