From 14b78d77a20af96f0e35d0284a95d42ba2a120a0 Mon Sep 17 00:00:00 2001
From: Steven Hahn <hahnse@ornl.gov>
Date: Thu, 15 Dec 2016 14:15:17 -0500
Subject: [PATCH] cleanup changes from clang-tidy.

---
 .../MDEWEventNexusLoadingPresenter.h          |  2 +-
 .../inc/MantidVatesAPI/MetadataToFieldData.h  |  8 +++---
 Vates/VatesAPI/src/FieldDataToMetadata.cpp    | 14 +++++-----
 Vates/VatesAPI/src/LoadVTK.cpp                | 22 +++++++---------
 .../src/MDEWEventNexusLoadingPresenter.cpp    | 12 +++------
 .../src/MDHWInMemoryLoadingPresenter.cpp      |  4 +--
 Vates/VatesAPI/src/MetadataToFieldData.cpp    | 26 ++++++++++---------
 .../VatesAPI/src/VatesKnowledgeSerializer.cpp |  2 +-
 .../src/vtkDataSetToImplicitFunction.cpp      |  4 +--
 .../src/vtkDataSetToNonOrthogonalDataSet.cpp  |  6 ++---
 .../src/vtkDataSetToScaledDataSet.cpp         |  6 ++---
 Vates/VatesAPI/src/vtkDataSetToWsLocation.cpp |  4 +--
 Vates/VatesAPI/src/vtkDataSetToWsName.cpp     |  4 +--
 Vates/VatesAPI/src/vtkMDHexFactory.cpp        |  2 +-
 Vates/VatesAPI/src/vtkMDHistoHex4DFactory.cpp |  2 +-
 Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp   |  7 +++--
 Vates/VatesAPI/src/vtkMDHistoLineFactory.cpp  |  2 +-
 Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp  |  2 +-
 Vates/VatesAPI/src/vtkMDLineFactory.cpp       |  2 +-
 Vates/VatesAPI/src/vtkMDQuadFactory.cpp       |  2 +-
 .../ViewWidgets/src/ColorSelectionWidget.cpp  |  2 +-
 .../ViewWidgets/src/MdViewerWidget.cpp        | 12 ++++-----
 .../src/PeaksTableControllerVsi.cpp           |  2 +-
 .../src/RebinnedSourcesManager.cpp            |  5 ++--
 24 files changed, 74 insertions(+), 80 deletions(-)

diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/MDEWEventNexusLoadingPresenter.h b/Vates/VatesAPI/inc/MantidVatesAPI/MDEWEventNexusLoadingPresenter.h
index dff9d3941cf..66ea5eebd78 100644
--- a/Vates/VatesAPI/inc/MantidVatesAPI/MDEWEventNexusLoadingPresenter.h
+++ b/Vates/VatesAPI/inc/MantidVatesAPI/MDEWEventNexusLoadingPresenter.h
@@ -37,7 +37,7 @@ class MDLoadingView;
 class DLLExport MDEWEventNexusLoadingPresenter : public MDEWLoadingPresenter {
 public:
   MDEWEventNexusLoadingPresenter(std::unique_ptr<MDLoadingView> view,
-                                 const std::string fileName);
+                                 const std::string &fileName);
   vtkSmartPointer<vtkDataSet>
   execute(vtkDataSetFactory *factory, ProgressAction &rebinningProgressUpdate,
           ProgressAction &drawingProgressUpdate) override;
diff --git a/Vates/VatesAPI/inc/MantidVatesAPI/MetadataToFieldData.h b/Vates/VatesAPI/inc/MantidVatesAPI/MetadataToFieldData.h
index 000b95d025f..ee36241b6d5 100644
--- a/Vates/VatesAPI/inc/MantidVatesAPI/MetadataToFieldData.h
+++ b/Vates/VatesAPI/inc/MantidVatesAPI/MetadataToFieldData.h
@@ -39,12 +39,12 @@ namespace VATES {
 class DLLExport MetadataToFieldData {
 public:
   /// Act as Functor.
-  void operator()(vtkFieldData *fieldData, std::string metaData,
-                  std::string id) const;
+  void operator()(vtkFieldData *fieldData, const std::string &metaData,
+                  const std::string &id) const;
 
   /// Explicit call to Functor execution.
-  void execute(vtkFieldData *fieldData, std::string metaData,
-               std::string id) const;
+  void execute(vtkFieldData *fieldData, const std::string &metaData,
+               const std::string &id) const;
 };
 }
 }
diff --git a/Vates/VatesAPI/src/FieldDataToMetadata.cpp b/Vates/VatesAPI/src/FieldDataToMetadata.cpp
index 2bea12ca99f..82c4e6f34cd 100644
--- a/Vates/VatesAPI/src/FieldDataToMetadata.cpp
+++ b/Vates/VatesAPI/src/FieldDataToMetadata.cpp
@@ -14,17 +14,17 @@ std::string FieldDataToMetadata::operator()(vtkFieldData *fieldData,
 std::string FieldDataToMetadata::execute(vtkFieldData *fieldData,
                                          const std::string &id) const {
   std::string sXml;
-  if (fieldData == nullptr) {
+  if (!fieldData) {
     throw std::runtime_error("vtkFieldData argument is null");
   }
-  vtkDataArray *arry = fieldData->GetArray(id.c_str());
-  if (arry == nullptr) {
+  vtkDataArray *array = fieldData->GetArray(id.c_str());
+  if (array == nullptr) {
     throw std::runtime_error("The specified vtk array does not exist");
   }
-  if (vtkCharArray *carry = dynamic_cast<vtkCharArray *>(arry)) {
-    carry->Squeeze();
-    for (int i = 0; i < carry->GetSize(); i++) {
-      char c = carry->GetValue(i);
+  if (vtkCharArray *carray = vtkCharArray::FastDownCast(array)) {
+    carray->Squeeze();
+    for (int i = 0; i < carray->GetSize(); i++) {
+      char c = carray->GetValue(i);
       if (int(c) > 1) {
         sXml.push_back(c);
       }
diff --git a/Vates/VatesAPI/src/LoadVTK.cpp b/Vates/VatesAPI/src/LoadVTK.cpp
index 89b21e423c7..6dec824ada8 100644
--- a/Vates/VatesAPI/src/LoadVTK.cpp
+++ b/Vates/VatesAPI/src/LoadVTK.cpp
@@ -112,8 +112,7 @@ int LoadVTK::version() const { return 1; }
 const std::string LoadVTK::category() const { return "MDAlgorithms"; }
 
 void LoadVTK::init() {
-  std::vector<std::string> exts;
-  exts.push_back("vtk");
+  std::vector<std::string> exts{"vtk"};
   this->declareProperty(
       Kernel::make_unique<FileProperty>("Filename", "", FileProperty::Load,
                                         exts),
@@ -187,12 +186,13 @@ void LoadVTK::execMDHisto(vtkUnsignedShortArray *signals,
   double *destinationSignals = outputWS->getSignalArray();
   double *destinationErrorsSQ = outputWS->getErrorSquaredArray();
 
-  if (errorsSQ == nullptr) {
+  if (errorsSQ) {
     PARALLEL_FOR_NO_WSP_CHECK()
     for (int64_t i = 0; i < nPoints; ++i) {
       PARALLEL_START_INTERUPT_REGION
       // cppcheck-suppress unreadVariable
       destinationSignals[i] = signals->GetValue(i);
+      destinationErrorsSQ[i] = errorsSQ->GetValue(i);
       if (i % frequency == 0)
         prog.report();
       PARALLEL_END_INTERUPT_REGION
@@ -204,14 +204,12 @@ void LoadVTK::execMDHisto(vtkUnsignedShortArray *signals,
       PARALLEL_START_INTERUPT_REGION
       // cppcheck-suppress unreadVariable
       destinationSignals[i] = signals->GetValue(i);
-      destinationErrorsSQ[i] = errorsSQ->GetValue(i);
       if (i % frequency == 0)
         prog.report();
       PARALLEL_END_INTERUPT_REGION
     }
     PARALLEL_CHECK_INTERUPT_REGION
   }
-
   prog.report("Complete");
   this->setProperty("OutputWorkspace", outputWS);
 }
@@ -257,16 +255,16 @@ void LoadVTK::execMDEvent(vtkDataSet *readDataset,
   ws->addDimension(dimZ);
   ws->initialize();
 
-  if (errorsSQ == nullptr) {
+  if (errorsSQ) {
     PARALLEL_FOR_IF(Kernel::threadSafe(*ws))
     for (int64_t i = 0; i < nPoints; ++i) {
       PARALLEL_START_INTERUPT_REGION
       double coordinates[3];
       readDataset->GetPoint(i, coordinates);
       float signal = signals->GetValue(i);
-
+      float errorSQ = errorsSQ->GetValue(i);
       if (signal > lowerBounds) {
-        MDLeanEvent<3> event(signal, 0, coordinates);
+        MDLeanEvent<3> event(signal, errorSQ, coordinates);
         ws->addEvent(event);
       }
       if (i % frequency == 0)
@@ -281,9 +279,9 @@ void LoadVTK::execMDEvent(vtkDataSet *readDataset,
       double coordinates[3];
       readDataset->GetPoint(i, coordinates);
       float signal = signals->GetValue(i);
-      float errorSQ = errorsSQ->GetValue(i);
+
       if (signal > lowerBounds) {
-        MDLeanEvent<3> event(signal, errorSQ, coordinates);
+        MDLeanEvent<3> event(signal, 0, coordinates);
         ws->addEvent(event);
       }
       if (i % frequency == 0)
@@ -318,14 +316,14 @@ void LoadVTK::exec() {
 
   vtkUnsignedShortArray *signals = vtkUnsignedShortArray::SafeDownCast(
       readDataset->GetPointData()->GetArray(signalArrayName.c_str()));
-  if (signals == nullptr) {
+  if (!signals) {
     throw std::invalid_argument("Signal array: " + signalArrayName +
                                 " does not exist");
   }
 
   vtkUnsignedShortArray *errorsSQ = vtkUnsignedShortArray::SafeDownCast(
       readDataset->GetPointData()->GetArray(errorSQArrayName.c_str()));
-  if (!errorSQArrayName.empty() && errorsSQ == nullptr) {
+  if (!errorSQArrayName.empty() && !errorsSQ) {
     throw std::invalid_argument("Error squared array: " + errorSQArrayName +
                                 " does not exist");
   }
diff --git a/Vates/VatesAPI/src/MDEWEventNexusLoadingPresenter.cpp b/Vates/VatesAPI/src/MDEWEventNexusLoadingPresenter.cpp
index 16009429d36..81cc8b7afd0 100644
--- a/Vates/VatesAPI/src/MDEWEventNexusLoadingPresenter.cpp
+++ b/Vates/VatesAPI/src/MDEWEventNexusLoadingPresenter.cpp
@@ -24,13 +24,13 @@ Constructor
 @throw logic_error if cannot use the reader-presenter for this filetype.
 */
 MDEWEventNexusLoadingPresenter::MDEWEventNexusLoadingPresenter(
-    std::unique_ptr<MDLoadingView> view, const std::string filename)
+    std::unique_ptr<MDLoadingView> view, const std::string &filename)
     : MDEWLoadingPresenter(std::move(view)), m_filename(filename),
-      m_wsTypeName("") {
+      m_wsTypeName() {
   if (this->m_filename.empty()) {
     throw std::invalid_argument("File name is an empty string.");
   }
-  if (nullptr == this->m_view) {
+  if (!this->m_view) {
     throw std::invalid_argument("View is NULL.");
   }
 }
@@ -46,17 +46,13 @@ bool MDEWEventNexusLoadingPresenter::canReadFile() const {
     return 0;
   }
 
-  ::NeXus::File *file = nullptr;
-
-  file = new ::NeXus::File(this->m_filename);
+  auto file = Kernel::make_unique<::NeXus::File>(this->m_filename);
   // MDEventWorkspace file has a different name for the entry
   try {
     file->openGroup("MDEventWorkspace", "NXentry");
-    file->close();
     return 1;
   } catch (::NeXus::Exception &) {
     // If the entry name does not match, then it can't read the file.
-    file->close();
     return 0;
   }
   return 0;
diff --git a/Vates/VatesAPI/src/MDHWInMemoryLoadingPresenter.cpp b/Vates/VatesAPI/src/MDHWInMemoryLoadingPresenter.cpp
index 91b3af696e1..a4d9346b5f5 100644
--- a/Vates/VatesAPI/src/MDHWInMemoryLoadingPresenter.cpp
+++ b/Vates/VatesAPI/src/MDHWInMemoryLoadingPresenter.cpp
@@ -35,10 +35,10 @@ MDHWInMemoryLoadingPresenter::MDHWInMemoryLoadingPresenter(
   if (m_wsName.empty()) {
     throw std::invalid_argument("The workspace name is empty.");
   }
-  if (nullptr == repository) {
+  if (!repository) {
     throw std::invalid_argument("The repository is NULL");
   }
-  if (nullptr == m_view) {
+  if (!m_view) {
     throw std::invalid_argument("View is NULL.");
   }
 }
diff --git a/Vates/VatesAPI/src/MetadataToFieldData.cpp b/Vates/VatesAPI/src/MetadataToFieldData.cpp
index 4cfa809abcf..1198fa882e5 100644
--- a/Vates/VatesAPI/src/MetadataToFieldData.cpp
+++ b/Vates/VatesAPI/src/MetadataToFieldData.cpp
@@ -7,26 +7,28 @@ namespace Mantid {
 namespace VATES {
 
 void MetadataToFieldData::operator()(vtkFieldData *fieldData,
-                                     std::string metaData,
-                                     std::string id) const {
+                                     const std::string &metaData,
+                                     const std::string &id) const {
   execute(fieldData, metaData, id);
 }
 
-void MetadataToFieldData::execute(vtkFieldData *fieldData, std::string metaData,
-                                  std::string id) const {
+void MetadataToFieldData::execute(vtkFieldData *fieldData,
+                                  const std::string &metaData,
+                                  const std::string &id) const {
   // clean out existing.
-  vtkDataArray *arry = fieldData->GetArray(id.c_str());
-  if (nullptr != arry) {
+  vtkDataArray *array = fieldData->GetArray(id.c_str());
+  if (array) {
     fieldData->RemoveArray(id.c_str());
   }
   // create new.
-  vtkNew<vtkCharArray> newArry;
-  newArry->Allocate(metaData.size());
-  newArry->SetName(id.c_str());
-  fieldData->AddArray(newArry.GetPointer());
+  vtkNew<vtkCharArray> newArray;
+  newArray->Allocate(metaData.size());
+  newArray->SetName(id.c_str());
+  fieldData->AddArray(newArray.GetPointer());
 
-  for (unsigned int i = 0; i < metaData.size(); i++) {
-    newArry->InsertNextValue(metaData.at(i));
+  fieldData->SetNumberOfTuples(metaData.size());
+  for (size_t i = 0; i < metaData.size(); i++) {
+    newArray->SetValue(i, metaData[i]);
   }
 }
 }
diff --git a/Vates/VatesAPI/src/VatesKnowledgeSerializer.cpp b/Vates/VatesAPI/src/VatesKnowledgeSerializer.cpp
index 56d6972ee3d..8d113116ffa 100644
--- a/Vates/VatesAPI/src/VatesKnowledgeSerializer.cpp
+++ b/Vates/VatesAPI/src/VatesKnowledgeSerializer.cpp
@@ -56,7 +56,7 @@ std::string VatesKnowledgeSerializer::createXMLString() const {
     throw std::runtime_error("No workspace name provided on workspace.");
   }
   // Check to see if a function has been provided.
-  if (m_spFunction != nullptr) {
+  if (m_spFunction) {
     return std::string(
         MDGeometryXMLDefinitions::workspaceInstructionXMLTagStart() +
         m_wsNameXML + m_wsLocationXML + m_geomXML +
diff --git a/Vates/VatesAPI/src/vtkDataSetToImplicitFunction.cpp b/Vates/VatesAPI/src/vtkDataSetToImplicitFunction.cpp
index d3b3e57f778..415eda9a6e4 100644
--- a/Vates/VatesAPI/src/vtkDataSetToImplicitFunction.cpp
+++ b/Vates/VatesAPI/src/vtkDataSetToImplicitFunction.cpp
@@ -26,7 +26,7 @@ Constructor
 */
 vtkDataSetToImplicitFunction::vtkDataSetToImplicitFunction(vtkDataSet *dataSet)
     : m_dataset(dataSet) {
-  if (m_dataset == nullptr) {
+  if (!m_dataset) {
     throw std::runtime_error(
         "Tried to construct vtkDataSetToImplicitFunction with NULL vtkDataSet");
   }
@@ -51,7 +51,7 @@ Mantid::Geometry::MDImplicitFunction *vtkDataSetToImplicitFunction::execute() {
     Poco::XML::Element *pRootElem = pDoc->documentElement();
     Poco::XML::Element *functionElem = pRootElem->getChildElement(
         MDGeometryXMLDefinitions::functionElementName());
-    if (nullptr != functionElem) {
+    if (functionElem) {
       auto existingFunction =
           std::unique_ptr<Mantid::Geometry::MDImplicitFunction>(
               Mantid::API::ImplicitFunctionFactory::Instance().createUnwrapped(
diff --git a/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp b/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp
index 114d365d9e2..2fec3644413 100644
--- a/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp
+++ b/Vates/VatesAPI/src/vtkDataSetToNonOrthogonalDataSet.cpp
@@ -87,7 +87,7 @@ vtkDataSetToNonOrthogonalDataSet::vtkDataSetToNonOrthogonalDataSet(
       m_basisNorm(), m_basisX(1, 0, 0), m_basisY(0, 1, 0), m_basisZ(0, 0, 1),
       m_coordType(Kernel::HKL),
       m_workspaceProvider(std::move(workspaceProvider)) {
-  if (nullptr == m_dataSet) {
+  if (!m_dataSet) {
     throw std::runtime_error("Cannot construct "
                              "vtkDataSetToNonOrthogonalDataSet with null VTK "
                              "dataset");
@@ -107,7 +107,7 @@ vtkDataSetToNonOrthogonalDataSet::~vtkDataSetToNonOrthogonalDataSet() {}
 void vtkDataSetToNonOrthogonalDataSet::execute(ProgressAction *progress) {
   // Downcast to a vtkPointSet
   vtkPointSet *data = vtkPointSet::SafeDownCast(m_dataSet);
-  if (nullptr == data) {
+  if (!data) {
     throw std::runtime_error("VTK dataset does not inherit from vtkPointSet");
   }
 
@@ -215,7 +215,7 @@ void vtkDataSetToNonOrthogonalDataSet::execute(ProgressAction *progress) {
   // Get the original points
   vtkFloatArray *points =
       vtkFloatArray::SafeDownCast(data->GetPoints()->GetData());
-  if (points == nullptr) {
+  if (!points) {
     throw std::runtime_error("Failed to cast vtkDataArray to vtkFloatArray.");
   } else if (points->GetNumberOfComponents() != 3) {
     throw std::runtime_error("points array must have 3 components.");
diff --git a/Vates/VatesAPI/src/vtkDataSetToScaledDataSet.cpp b/Vates/VatesAPI/src/vtkDataSetToScaledDataSet.cpp
index 5a3fa17e69c..88d572eb6aa 100644
--- a/Vates/VatesAPI/src/vtkDataSetToScaledDataSet.cpp
+++ b/Vates/VatesAPI/src/vtkDataSetToScaledDataSet.cpp
@@ -71,12 +71,12 @@ vtkPointSet *vtkDataSetToScaledDataSet::execute(double xScale, double yScale,
                                                 vtkPointSet *inputData,
                                                 vtkPointSet *outputData) {
 
-  if (nullptr == inputData) {
+  if (!inputData) {
     throw std::runtime_error("Cannot construct vtkDataSetToScaledDataSet with "
                              "NULL input vtkPointSet");
   }
 
-  if (outputData == nullptr) {
+  if (!outputData) {
     outputData = inputData->NewInstance();
   }
 
@@ -89,7 +89,7 @@ vtkPointSet *vtkDataSetToScaledDataSet::execute(double xScale, double yScale,
   vtkFloatArray *newPointsArray =
       vtkFloatArray::SafeDownCast(newPoints->GetData());
 
-  if (oldPointsArray == nullptr || newPointsArray == nullptr) {
+  if (!oldPointsArray || !newPointsArray) {
     throw std::runtime_error("Failed to cast vtkDataArray to vtkFloatArray.");
   } else if (oldPointsArray->GetNumberOfComponents() != 3 ||
              newPointsArray->GetNumberOfComponents() != 3) {
diff --git a/Vates/VatesAPI/src/vtkDataSetToWsLocation.cpp b/Vates/VatesAPI/src/vtkDataSetToWsLocation.cpp
index a75696816f2..8d55fdd3157 100644
--- a/Vates/VatesAPI/src/vtkDataSetToWsLocation.cpp
+++ b/Vates/VatesAPI/src/vtkDataSetToWsLocation.cpp
@@ -26,7 +26,7 @@ Constructor
 */
 vtkDataSetToWsLocation::vtkDataSetToWsLocation(vtkDataSet *dataSet)
     : m_dataset(dataSet) {
-  if (m_dataset == nullptr) {
+  if (!m_dataset) {
     throw std::runtime_error(
         "Tried to construct vtkDataSetToWsLocation with NULL vtkDataSet");
   }
@@ -47,7 +47,7 @@ std::string vtkDataSetToWsLocation::execute() {
   Poco::XML::Element *pRootElem = pDoc->documentElement();
   Poco::XML::Element *wsLocationElem = pRootElem->getChildElement(
       MDGeometryXMLDefinitions::workspaceLocationElementName());
-  if (wsLocationElem == nullptr) {
+  if (!wsLocationElem) {
     throw std::runtime_error(
         "The element containing the workspace location must be present.");
   }
diff --git a/Vates/VatesAPI/src/vtkDataSetToWsName.cpp b/Vates/VatesAPI/src/vtkDataSetToWsName.cpp
index 6f807e07023..f4a88bc8efa 100644
--- a/Vates/VatesAPI/src/vtkDataSetToWsName.cpp
+++ b/Vates/VatesAPI/src/vtkDataSetToWsName.cpp
@@ -26,7 +26,7 @@ Constructor
 */
 vtkDataSetToWsName::vtkDataSetToWsName(vtkDataSet *dataSet)
     : m_dataset(dataSet) {
-  if (m_dataset == nullptr) {
+  if (!m_dataset) {
     throw std::runtime_error(
         "Tried to construct vtkDataSetToWsName with NULL vtkDataSet");
   }
@@ -47,7 +47,7 @@ std::string vtkDataSetToWsName::execute() {
   Poco::XML::Element *pRootElem = pDoc->documentElement();
   Poco::XML::Element *wsNameElem = pRootElem->getChildElement(
       MDGeometryXMLDefinitions::workspaceNameElementName());
-  if (wsNameElem == nullptr) {
+  if (!wsNameElem) {
     throw std::runtime_error(
         "The element containing the workspace name must be present.");
   }
diff --git a/Vates/VatesAPI/src/vtkMDHexFactory.cpp b/Vates/VatesAPI/src/vtkMDHexFactory.cpp
index 270280d6a00..d0553cb334f 100644
--- a/Vates/VatesAPI/src/vtkMDHexFactory.cpp
+++ b/Vates/VatesAPI/src/vtkMDHexFactory.cpp
@@ -205,7 +205,7 @@ vtkSmartPointer<vtkDataSet>
 vtkMDHexFactory::create(ProgressAction &progressUpdating) const {
   this->dataSet = tryDelegatingCreation<IMDEventWorkspace, 3>(
       m_workspace, progressUpdating, false);
-  if (this->dataSet != nullptr) {
+  if (this->dataSet) {
     return this->dataSet;
   } else {
     IMDEventWorkspace_sptr imdws =
diff --git a/Vates/VatesAPI/src/vtkMDHistoHex4DFactory.cpp b/Vates/VatesAPI/src/vtkMDHistoHex4DFactory.cpp
index f01ff067732..f7ace0654d0 100644
--- a/Vates/VatesAPI/src/vtkMDHistoHex4DFactory.cpp
+++ b/Vates/VatesAPI/src/vtkMDHistoHex4DFactory.cpp
@@ -52,7 +52,7 @@ template <typename TimeMapper>
 void vtkMDHistoHex4DFactory<TimeMapper>::initialize(
     Mantid::API::Workspace_sptr workspace) {
   m_workspace = doInitialize<MDHistoWorkspace, 4>(workspace);
-  if (m_workspace != nullptr) {
+  if (m_workspace) {
     double tMax = m_workspace->getTDimension()->getMaximum();
     double tMin = m_workspace->getTDimension()->getMinimum();
     size_t nbins = m_workspace->getTDimension()->getNBins();
diff --git a/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp b/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp
index 918277c7e72..d871e8322f5 100644
--- a/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp
+++ b/Vates/VatesAPI/src/vtkMDHistoHexFactory.cpp
@@ -68,8 +68,7 @@ void vtkMDHistoHexFactory::initialize(Mantid::API::Workspace_sptr workspace) {
 }
 
 void vtkMDHistoHexFactory::validateWsNotNull() const {
-
-  if (nullptr == m_workspace.get()) {
+  if (!m_workspace) {
     throw std::runtime_error("IMDWorkspace is null");
   }
 }
@@ -164,7 +163,7 @@ vtkMDHistoHexFactory::create3Dor4D(size_t timestep,
   const vtkIdType nPointsZ = nBinsZ + 1;
 
   vtkFloatArray *pointsarray = vtkFloatArray::SafeDownCast(points->GetData());
-  if (pointsarray == nullptr) {
+  if (!pointsarray) {
     throw std::runtime_error("Failed to cast vtkDataArray to vtkFloatArray.");
   } else if (pointsarray->GetNumberOfComponents() != 3) {
     throw std::runtime_error("points array must have 3 components.");
@@ -215,7 +214,7 @@ vtkSmartPointer<vtkDataSet>
 vtkMDHistoHexFactory::create(ProgressAction &progressUpdating) const {
   auto product =
       tryDelegatingCreation<MDHistoWorkspace, 3>(m_workspace, progressUpdating);
-  if (product != nullptr) {
+  if (product) {
     return product;
   } else {
     // Create in 3D mode
diff --git a/Vates/VatesAPI/src/vtkMDHistoLineFactory.cpp b/Vates/VatesAPI/src/vtkMDHistoLineFactory.cpp
index 96734e05394..44c544a656c 100644
--- a/Vates/VatesAPI/src/vtkMDHistoLineFactory.cpp
+++ b/Vates/VatesAPI/src/vtkMDHistoLineFactory.cpp
@@ -174,7 +174,7 @@ void vtkMDHistoLineFactory::initialize(
 }
 
 void vtkMDHistoLineFactory::validate() const {
-  if (nullptr == m_workspace.get()) {
+  if (!m_workspace) {
     throw std::runtime_error("IMDWorkspace is null");
   }
 }
diff --git a/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp b/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp
index d632b870f7f..ee12bb7dd3b 100644
--- a/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp
+++ b/Vates/VatesAPI/src/vtkMDHistoQuadFactory.cpp
@@ -248,7 +248,7 @@ void vtkMDHistoQuadFactory::initialize(
 }
 
 void vtkMDHistoQuadFactory::validate() const {
-  if (nullptr == m_workspace.get()) {
+  if (!m_workspace) {
     throw std::runtime_error("IMDWorkspace is null");
   }
 }
diff --git a/Vates/VatesAPI/src/vtkMDLineFactory.cpp b/Vates/VatesAPI/src/vtkMDLineFactory.cpp
index 9ee6ac03100..bc8242911b2 100644
--- a/Vates/VatesAPI/src/vtkMDLineFactory.cpp
+++ b/Vates/VatesAPI/src/vtkMDLineFactory.cpp
@@ -184,7 +184,7 @@ std::string vtkMDLineFactory::getFactoryTypeName() const {
 
 /// Template Method pattern to validate the factory before use.
 void vtkMDLineFactory::validate() const {
-  if (nullptr == m_workspace.get()) {
+  if (!m_workspace) {
     throw std::runtime_error(
         "vtkMDLineFactory has no workspace to run against");
   }
diff --git a/Vates/VatesAPI/src/vtkMDQuadFactory.cpp b/Vates/VatesAPI/src/vtkMDQuadFactory.cpp
index 9d22b97bbc9..a37715f47c3 100644
--- a/Vates/VatesAPI/src/vtkMDQuadFactory.cpp
+++ b/Vates/VatesAPI/src/vtkMDQuadFactory.cpp
@@ -180,7 +180,7 @@ std::string vtkMDQuadFactory::getFactoryTypeName() const {
 
 /// Template Method pattern to validate the factory before use.
 void vtkMDQuadFactory::validate() const {
-  if (nullptr == m_workspace.get()) {
+  if (!m_workspace) {
     throw std::runtime_error(
         "vtkMDQuadFactory has no workspace to run against");
   }
diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp
index fe6cb398a9e..639726cd1c1 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp
+++ b/Vates/VatesSimpleGui/ViewWidgets/src/ColorSelectionWidget.cpp
@@ -443,7 +443,7 @@ void ColorSelectionWidget::reset() {
  */
 void ColorSelectionWidget::setColorScaleLock(
     Mantid::VATES::ColorScaleLock *lock) {
-  if (m_colorScaleLock == nullptr) {
+  if (!m_colorScaleLock) {
     m_colorScaleLock = lock;
   }
 }
diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp
index 8c621cbfd37..6b9fa7fb35d 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp
+++ b/Vates/VatesSimpleGui/ViewWidgets/src/MdViewerWidget.cpp
@@ -1138,7 +1138,7 @@ void MdViewerWidget::setColorForBackground() {
 void MdViewerWidget::checkForUpdates() {
   Mantid::VATES::ColorScaleLockGuard colorScaleLockGuard(&m_colorScaleLock);
   pqPipelineSource *src = pqActiveObjects::instance().activeSource();
-  if (nullptr == src) {
+  if (!src) {
     return;
   }
   vtkSMProxy *proxy = src->getProxy();
@@ -1379,7 +1379,7 @@ void MdViewerWidget::onLodToggled(bool state) {
  * setting the communication between it and the current view.
  */
 void MdViewerWidget::onRotationPoint() {
-  if (nullptr == this->rotPointDialog) {
+  if (!this->rotPointDialog) {
     this->rotPointDialog = new RotationPointDialog(this);
     this->connectRotationPointDialog();
   }
@@ -1403,7 +1403,7 @@ void MdViewerWidget::onWikiHelp() {
  * switch view since the connection to the current view is destroyed.
  */
 void MdViewerWidget::disconnectDialogs() {
-  if (nullptr != this->rotPointDialog) {
+  if (this->rotPointDialog) {
     this->rotPointDialog->close();
     QObject::disconnect(this->rotPointDialog, nullptr, this->currentView,
                         nullptr);
@@ -1445,7 +1445,7 @@ void MdViewerWidget::connectColorSelectionWidget() {
  * the current view.
  */
 void MdViewerWidget::connectRotationPointDialog() {
-  if (nullptr != this->rotPointDialog) {
+  if (this->rotPointDialog) {
     QObject::connect(
         this->rotPointDialog, SIGNAL(sendCoordinates(double, double, double)),
         this->currentView, SLOT(onResetCenterToPoint(double, double, double)));
@@ -1486,7 +1486,7 @@ void MdViewerWidget::afterReplaceHandle(
     const boost::shared_ptr<Mantid::API::Workspace> ws) {
   UNUSED_ARG(ws);
   pqPipelineSource *src = this->currentView->hasWorkspace(wsName.c_str());
-  if (nullptr != src) {
+  if (src) {
     // Have to mark the filter as modified to get it to update. Do this by
     // changing the requested workspace name to a dummy name and then change
     // back. However, push the change all the way down for it to work.
@@ -1516,7 +1516,7 @@ void MdViewerWidget::preDeleteHandle(const std::string &wsName,
   UNUSED_ARG(ws);
 
   pqPipelineSource *src = this->currentView->hasWorkspace(wsName.c_str());
-  if (nullptr != src) {
+  if (src) {
     long long numSources = this->currentView->getNumSources();
     if (numSources > 1) {
       pqObjectBuilder *builder =
diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/PeaksTableControllerVsi.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/PeaksTableControllerVsi.cpp
index 32ae1b345df..054044843ad 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/src/PeaksTableControllerVsi.cpp
+++ b/Vates/VatesSimpleGui/ViewWidgets/src/PeaksTableControllerVsi.cpp
@@ -378,7 +378,7 @@ void PeaksTableControllerVsi::removeLayout(QWidget *widget) {
   QLayout *layout = widget->layout();
   if (layout != nullptr) {
     QLayoutItem *item;
-    while ((item = layout->takeAt(0)) != nullptr) {
+    while ((item = layout->takeAt(0))) {
       layout->removeItem(item);
       delete item->widget();
     }
diff --git a/Vates/VatesSimpleGui/ViewWidgets/src/RebinnedSourcesManager.cpp b/Vates/VatesSimpleGui/ViewWidgets/src/RebinnedSourcesManager.cpp
index 189c8a28e5b..083c83c20ca 100644
--- a/Vates/VatesSimpleGui/ViewWidgets/src/RebinnedSourcesManager.cpp
+++ b/Vates/VatesSimpleGui/ViewWidgets/src/RebinnedSourcesManager.cpp
@@ -445,8 +445,7 @@ void RebinnedSourcesManager::rebuildPipeline(pqPipelineSource *source1,
   pqPipelineSource *endOfSource2Pipeline = source2;
 
   while (filter1) {
-    vtkSMProxy *proxy1 = nullptr;
-    proxy1 = filter1->getProxy();
+    vtkSMProxy *proxy1 = filter1->getProxy();
     pqPipelineSource *newPipelineElement = nullptr;
     pqPipelineFilter *newFilter = nullptr;
     // Move source2 to its end.
@@ -756,7 +755,7 @@ RebinnedSourcesManager::createKeyPairForSource(pqPipelineSource *source) {
  * @param source A pointer to the source
  */
 void RebinnedSourcesManager::deleteSpecificSource(pqPipelineSource *source) {
-  if (nullptr != source) {
+  if (source) {
     // Go to the end of the source and work your way back
     pqPipelineSource *tempSource = source;
 
-- 
GitLab