Skip to content

Commit

Permalink
Upgrade cpplint and fix new errors
Browse files Browse the repository at this point in the history
Signed-off-by: Addisu Z. Taddese <[email protected]>
  • Loading branch information
azeey committed Aug 31, 2021
1 parent e0d77cc commit f5c8bb3
Show file tree
Hide file tree
Showing 31 changed files with 4,881 additions and 1,316 deletions.
6 changes: 3 additions & 3 deletions include/sdf/Element.hh
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ namespace sdf
const std::string &_type,
const std::string &_defaultvalue,
bool _required,
const std::string &_description="");
const std::string &_description = "");

/// \brief Add a value to this Element.
/// \param[in] _type Type of data the attribute will hold.
Expand All @@ -216,7 +216,7 @@ namespace sdf
/// \throws sdf::AssertionInternalError if an invalid type is given.
public: void AddValue(const std::string &_type,
const std::string &_defaultValue, bool _required,
const std::string &_description="");
const std::string &_description = "");

/// \brief Get the param of an attribute.
/// \param[in] _key the name of the attribute.
Expand Down Expand Up @@ -499,7 +499,7 @@ namespace sdf
const std::string &_type,
const std::string &_defaultValue,
bool _required,
const std::string &_description="");
const std::string &_description = "");


/// \brief Private data pointer
Expand Down
20 changes: 13 additions & 7 deletions src/Converter_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1885,10 +1885,16 @@ TEST(Converter, MuchNewerVersion)
ASSERT_TRUE(sdf::Converter::Convert(&xmlDoc, "1.6"));
}

const std::string CONVERT_DOC_15_16 =
sdf::filesystem::append(PROJECT_SOURCE_PATH, "sdf", "1.6", "1_5.convert");
const std::string CONVERT_DOC_16_17 =
sdf::filesystem::append(PROJECT_SOURCE_PATH, "sdf", "1.7", "1_6.convert");
static std::string ConvertDoc_15_16()
{
return sdf::filesystem::append(PROJECT_SOURCE_PATH, "sdf", "1.6",
"1_5.convert");
}
static std::string ConvertDoc_16_17()
{
return sdf::filesystem::append(PROJECT_SOURCE_PATH, "sdf", "1.7",
"1_6.convert");
}

/////////////////////////////////////////////////
/// Test conversion of imu in 1.5 to 1.6
Expand Down Expand Up @@ -1930,7 +1936,7 @@ TEST(Converter, IMU_15_to_16)

// Convert
TiXmlDocument convertXmlDoc;
convertXmlDoc.LoadFile(CONVERT_DOC_15_16);
convertXmlDoc.LoadFile(ConvertDoc_15_16());
sdf::Converter::Convert(&xmlDoc, &convertXmlDoc);

// Check some basic elements
Expand Down Expand Up @@ -2024,7 +2030,7 @@ TEST(Converter, World_15_to_16)

// Convert
TiXmlDocument convertXmlDoc;
convertXmlDoc.LoadFile(CONVERT_DOC_15_16);
convertXmlDoc.LoadFile(ConvertDoc_15_16());
sdf::Converter::Convert(&xmlDoc, &convertXmlDoc);

// Check some basic elements
Expand Down Expand Up @@ -2080,7 +2086,7 @@ TEST(Converter, Pose_16_to_17)

// Convert
TiXmlDocument convertXmlDoc;
convertXmlDoc.LoadFile(CONVERT_DOC_16_17);
convertXmlDoc.LoadFile(ConvertDoc_16_17());
sdf::Converter::Convert(&xmlDoc, &convertXmlDoc);

// Check some basic elements
Expand Down
1 change: 0 additions & 1 deletion src/Error.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ std::string Error::Message() const
}

/////////////////////////////////////////////////
// cppcheck-suppress unusedFunction
Error::operator bool() const
{
return this->code != ErrorCode::NONE;
Expand Down
1 change: 1 addition & 0 deletions src/FrameSemantics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*
*/
#include <string>
#include <set>
#include <utility>
#include <vector>

Expand Down
1 change: 0 additions & 1 deletion src/Joint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class sdf::JointPrivate
public: double threadPitch = 1.0;

/// \brief Joint axis
// cppcheck-suppress
public: std::array<std::unique_ptr<JointAxis>, 2> axis;

/// \brief The SDF element pointer used during load.
Expand Down
6 changes: 3 additions & 3 deletions src/Light.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Light &Light::operator=(Light &&_light)
//////////////////////////////////////////////////
void Light::CopyFrom(const Light &_light)
{
this->dataPtr->name= _light.dataPtr->name;
this->dataPtr->name = _light.dataPtr->name;
this->dataPtr->pose = _light.dataPtr->pose;
this->dataPtr->poseRelativeTo = _light.dataPtr->poseRelativeTo;
this->dataPtr->type = _light.dataPtr->type;
Expand Down Expand Up @@ -251,7 +251,7 @@ Errors Light::Load(ElementPtr _sdf)
this->SetSpotInnerAngle(doubleValue.first);

// Check for and set outer_angle
doubleValue =spotElem->Get<double>(
doubleValue = spotElem->Get<double>(
"outer_angle", this->dataPtr->spotOuterAngle.Radian());
if (!doubleValue.second)
{
Expand All @@ -261,7 +261,7 @@ Errors Light::Load(ElementPtr _sdf)
this->SetSpotOuterAngle(doubleValue.first);

// Check for and set falloff
doubleValue =spotElem->Get<double>("falloff", this->dataPtr->spotFalloff);
doubleValue = spotElem->Get<double>("falloff", this->dataPtr->spotFalloff);
if (!doubleValue.second)
{
errors.push_back({ErrorCode::ELEMENT_MISSING,
Expand Down
2 changes: 1 addition & 1 deletion src/Link.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,5 +490,5 @@ bool Link::EnableWind() const
/////////////////////////////////////////////////
void Link::SetEnableWind(const bool _enableWind)
{
this->dataPtr->enableWind =_enableWind;
this->dataPtr->enableWind = _enableWind;
}
2 changes: 1 addition & 1 deletion src/Model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ bool Model::EnableWind() const
/////////////////////////////////////////////////
void Model::SetEnableWind(const bool _enableWind)
{
this->dataPtr->enableWind =_enableWind;
this->dataPtr->enableWind = _enableWind;
}

/////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/Noise.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Errors Noise::Load(ElementPtr _sdf)
else if (typeLower == "gaussian")
this->dataPtr->type = NoiseType::GAUSSIAN;
else if (typeLower == "gaussian_quantized")
this->dataPtr->type =NoiseType::GAUSSIAN_QUANTIZED;
this->dataPtr->type = NoiseType::GAUSSIAN_QUANTIZED;
else
{
errors.push_back({ErrorCode::ELEMENT_MISSING,
Expand Down
2 changes: 1 addition & 1 deletion src/Pbr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Errors PbrWorkflow::Load(sdf::ElementPtr _sdf)
this->dataPtr->albedoMap = _sdf->Get<std::string>("albedo_map",
this->dataPtr->albedoMap).first;

this->dataPtr->normalMap= _sdf->Get<std::string>("normal_map",
this->dataPtr->normalMap = _sdf->Get<std::string>("normal_map",
this->dataPtr->normalMap).first;

this->dataPtr->environmentMap = _sdf->Get<std::string>("environment_map",
Expand Down
8 changes: 4 additions & 4 deletions src/SDF.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ static URIPathMap g_uriPathMap;

static std::function<std::string(const std::string &)> g_findFileCB;

std::string SDF::version = SDF_VERSION;
// TODO(azeey) This violates the Google style guide. Change to a function that
// returns the version string when possible.
std::string SDF::version = SDF_VERSION; // NOLINT(runtime/string)

/////////////////////////////////////////////////
// cppcheck-suppress passedByValue
Expand Down Expand Up @@ -325,9 +327,7 @@ void SDF::PrintDoc()

std::cout << "</div>\n";

std::cout << "\
</body>\
</html>\n";
std::cout << " </body> </html>\n";
}

/////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/Scene.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Errors Scene::Load(ElementPtr _sdf)
}

// Get the ambient property
this->dataPtr->ambient= _sdf->Get<ignition::math::Color>("ambient",
this->dataPtr->ambient = _sdf->Get<ignition::math::Color>("ambient",
this->dataPtr->ambient).first;

// Get the background color property
Expand Down
1 change: 1 addition & 0 deletions src/Utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include "sdf/Error.hh"
#include "sdf/Element.hh"
Expand Down
Loading

0 comments on commit f5c8bb3

Please sign in to comment.