Skip to content

Commit 323d362

Browse files
committed
Cppcheck fixes
1 parent c373541 commit 323d362

File tree

6 files changed

+7
-10
lines changed

6 files changed

+7
-10
lines changed

Framework/API/inc/MantidAPI/MatrixWorkspace.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ class MANTID_API_DLL MatrixWorkspace : public IMDWorkspace, public ExperimentInf
393393
/// Returns true if the workspace has common, integer X bins
394394
virtual bool isIntegerBins() const;
395395

396-
std::string YUnit() const;
396+
const std::string &YUnit() const { return m_YUnit; }
397397
void setYUnit(const std::string &newUnit);
398398
std::string YUnitLabel(bool useLatex = false, bool plotAsDistribution = false) const;
399399
void setYUnitLabel(const std::string &newLabel);

Framework/API/src/MatrixWorkspace.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -1029,9 +1029,6 @@ bool MatrixWorkspace::isCommonLogBins() const {
10291029
*/
10301030
size_t MatrixWorkspace::numberOfAxis() const { return m_axes.size(); }
10311031

1032-
/// Returns the units of the data in the workspace
1033-
std::string MatrixWorkspace::YUnit() const { return m_YUnit; }
1034-
10351032
/// Sets a new unit for the data (Y axis) in the workspace
10361033
void MatrixWorkspace::setYUnit(const std::string &newUnit) { m_YUnit = newUnit; }
10371034

Framework/Geometry/src/Objects/CSGObject.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -2122,11 +2122,11 @@ std::shared_ptr<GeometryHandler> CSGObject::getGeometryHandler() const {
21222122
}
21232123

21242124
std::string CSGObject::getGeometryShape() const {
2125-
Geometry::detail::ShapeInfo::GeometryShape shape;
2125+
Geometry::detail::ShapeInfo::GeometryShape geometryShape;
21262126
std::vector<V3D> points;
21272127
double radius, innerRadius, height = 0;
2128-
m_handler->GetObjectGeom(shape, points, innerRadius, radius, height);
2129-
switch (shape) {
2128+
m_handler->GetObjectGeom(geometryShape, points, innerRadius, radius, height);
2129+
switch (geometryShape) {
21302130
case detail::ShapeInfo::GeometryShape::NOSHAPE:
21312131
return "NOSHAPE";
21322132
case detail::ShapeInfo::GeometryShape::CUBOID:

Framework/PythonInterface/mantid/api/src/Exports/MatrixWorkspace.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ void export_MatrixWorkspace() {
386386
"Returns ``True`` if this is considered to be binned data.")
387387
.def("isDistribution", (bool(MatrixWorkspace::*)() const) & MatrixWorkspace::isDistribution, arg("self"),
388388
"Returns the status of the distribution flag")
389-
.def("YUnit", &MatrixWorkspace::YUnit, arg("self"),
389+
.def("YUnit", &MatrixWorkspace::YUnit, return_value_policy<copy_const_reference>(), arg("self"),
390390
"Returns the current Y unit for the data (Y axis) in the workspace")
391391
.def("YUnitLabel", &MatrixWorkspace::YUnitLabel,
392392
MatrixWorkspace_YUnitLabelOverloads((arg("self"), arg("useLatex"), arg("plotAsDistribution")),

Framework/PythonInterface/mantid/kernel/src/Exports/V3D.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ void export_V3D() {
133133
.def("norm", &V3D::norm, arg("self"), "Calculates the length of the vector")
134134
.def("norm2", &V3D::norm2, arg("self"), "Calculates the squared length of the vector")
135135
.def("getSpherical", &getSpherical, arg("self"), "Return the vector's position in spherical coordinates")
136+
// cppcheck-suppress syntaxError
136137
.def("__add__", &V3D::operator+, (arg("left"), arg("right")))
137138
.def("__iadd__", &V3D::operator+=, return_self<>(), (arg("self"), arg("other")))
138139
.def("__sub__", static_cast<V3D (V3D::*)(const V3D &) const>(&V3D::operator-), (arg("left"), arg("right")))

buildconfig/CMake/CppCheck_Suppressions.txt.in

+1-2
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ shadowFunction:${CMAKE_SOURCE_DIR}/Framework/Geometry/src/Instrument.cpp:629
421421
shadowFunction:${CMAKE_SOURCE_DIR}/Framework/Geometry/src/Instrument.cpp:642
422422
constVariablePointer:${CMAKE_SOURCE_DIR}/Framework/Geometry/src/Instrument/CompAssembly.cpp:376
423423
constVariablePointer:${CMAKE_SOURCE_DIR}/Framework/Geometry/src/Instrument/CompAssembly.cpp:405
424-
constParameterPointer:${CMAKE_SOURCE_DIR}/Framework/Geometry/src/Instrument/ComponentInfo.cpp:129
424+
constParameterPointer:${CMAKE_SOURCE_DIR}/Framework/Geometry/src/Instrument/ComponentInfo.cpp:134
425425
constVariableReference:${CMAKE_SOURCE_DIR}/Framework/Geometry/src/Rendering/RenderingHelpersOpenGL.cpp:204
426426
constParameterPointer:${CMAKE_SOURCE_DIR}/Framework/Geometry/src/Rendering/vtkGeometryCacheReader.cpp:64
427427
constParameterPointer:${CMAKE_SOURCE_DIR}/Framework/Geometry/src/Rendering/vtkGeometryCacheWriter.cpp:83
@@ -554,7 +554,6 @@ unusedScopedObject:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/api/src/
554554
constParameterCallback:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceGroup.cpp:80
555555
unusedScopedObject:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/api/src/Exports/WorkspaceGroup.cpp:113
556556
syntaxError:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/dataobjects/src/Exports/EventList.cpp:37
557-
syntaxError:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/kernel/src/Exports/V3D.cpp:123
558557
syntaxError:${CMAKE_SOURCE_DIR}/Framework/PythonInterface/mantid/kernel/src/Exports/VMD.cpp:100
559558
constVariablePointer:${CMAKE_SOURCE_DIR}/Framework/Reflectometry/src/CreateTransmissionWorkspace2.cpp:176
560559
constVariablePointer:${CMAKE_SOURCE_DIR}/Framework/Reflectometry/src/CreateTransmissionWorkspace2.cpp:177

0 commit comments

Comments
 (0)