From 0a3664b777018884c62554e82493fbe9c917850a Mon Sep 17 00:00:00 2001
From: Antti Soininen <soininen@ill.fr>
Date: Wed, 30 May 2018 14:32:06 +0200
Subject: [PATCH] Code beautification. Re #22315

---
 .../MantidAlgorithms/ReflectometrySumInQ.h    |  26 +++--
 .../Algorithms/src/ReflectometrySumInQ.cpp    |  13 ++-
 .../Algorithms/test/ReflectometrySumInQTest.h | 109 ++++++++++++------
 .../DataHandling/src/GroupDetectors2.cpp      |   1 +
 Framework/Kernel/inc/MantidKernel/Strings.h   |  15 ++-
 Framework/Kernel/test/StringsTest.h           |  19 ++-
 .../WorkspaceCreationHelper.h                 |  23 ++--
 .../src/WorkspaceCreationHelper.cpp           |  19 ++-
 8 files changed, 141 insertions(+), 84 deletions(-)

diff --git a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometrySumInQ.h b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometrySumInQ.h
index f7fca1e38e5..b20c954db52 100644
--- a/Framework/Algorithms/inc/MantidAlgorithms/ReflectometrySumInQ.h
+++ b/Framework/Algorithms/inc/MantidAlgorithms/ReflectometrySumInQ.h
@@ -48,7 +48,7 @@ public:
     double max{std::numeric_limits<double>::lowest()};
     MinMax() noexcept = default;
     MinMax(const double a, const double b) noexcept;
-    void testAndSet(const double a) noexcept ;
+    void testAndSet(const double a) noexcept;
   };
 
   const std::string name() const override;
@@ -66,15 +66,25 @@ private:
   void init() override;
   void exec() override;
   std::map<std::string, std::string> validateInputs() override;
-  API::MatrixWorkspace_sptr constructIvsLamWS(const API::MatrixWorkspace &detectorWS, const Indexing::SpectrumIndexSet &indices, const Angles &refAngles);
-  MinMax findWavelengthMinMax(const API::MatrixWorkspace &detectorWS, const Indexing::SpectrumIndexSet &indices, const Angles &refAngles);
-  void processValue(const int inputIdx, const MinMax &twoThetaRange, const Angles &refAngles, const HistogramData::HistogramX &inputX, const HistogramData::HistogramY &inputY,
-      const HistogramData::HistogramE &inputE, API::MatrixWorkspace &IvsLam,
-      std::vector<double> &outputE);
+  API::MatrixWorkspace_sptr
+  constructIvsLamWS(const API::MatrixWorkspace &detectorWS,
+                    const Indexing::SpectrumIndexSet &indices,
+                    const Angles &refAngles);
+  MinMax findWavelengthMinMax(const API::MatrixWorkspace &detectorWS,
+                              const Indexing::SpectrumIndexSet &indices,
+                              const Angles &refAngles);
+  void processValue(const int inputIdx, const MinMax &twoThetaRange,
+                    const Angles &refAngles,
+                    const HistogramData::HistogramX &inputX,
+                    const HistogramData::HistogramY &inputY,
+                    const HistogramData::HistogramE &inputE,
+                    API::MatrixWorkspace &IvsLam, std::vector<double> &outputE);
   MinMax projectedLambdaRange(const MinMax &wavelengthRange,
-      const MinMax &twoThetaRange, const Angles &refAngles);
+                              const MinMax &twoThetaRange,
+                              const Angles &refAngles);
   Angles referenceAngles(const API::SpectrumInfo &spectrumInfo);
-  API::MatrixWorkspace_sptr sumInQ(const API::MatrixWorkspace &detectorWS, const Indexing::SpectrumIndexSet &indices);
+  API::MatrixWorkspace_sptr sumInQ(const API::MatrixWorkspace &detectorWS,
+                                   const Indexing::SpectrumIndexSet &indices);
 };
 
 } // namespace Algorithms
diff --git a/Framework/Algorithms/src/ReflectometrySumInQ.cpp b/Framework/Algorithms/src/ReflectometrySumInQ.cpp
index 7cb77085236..874cc998548 100644
--- a/Framework/Algorithms/src/ReflectometrySumInQ.cpp
+++ b/Framework/Algorithms/src/ReflectometrySumInQ.cpp
@@ -106,7 +106,8 @@ twoThetaWidth(const size_t wsIndex,
   Mantid::Algorithms::ReflectometrySumInQ::MinMax range;
   if (wsIndex == 0) {
     if (spectrumInfo.size() <= 1) {
-      throw std::runtime_error("Cannot calculate pixel widths from a workspace containing a single histogram.");
+      throw std::runtime_error("Cannot calculate pixel widths from a workspace "
+                               "containing a single histogram.");
     }
     const auto nextTwoTheta = spectrumInfo.twoTheta(1);
     const auto d = std::abs(nextTwoTheta - twoTheta) / 2.;
@@ -253,15 +254,17 @@ std::map<std::string, std::string> ReflectometrySumInQ::validateInputs() {
   const auto iter = std::find(indices.begin(), indices.end(),
                               static_cast<size_t>(beamCentre));
   if (iter == indices.end()) {
-    issues[Prop::BEAM_CENTRE] = "Beam centre is not included in InputWorkspaceIndexSet.";
+    issues[Prop::BEAM_CENTRE] =
+        "Beam centre is not included in InputWorkspaceIndexSet.";
   }
   for (const auto i : indices) {
     if (spectrumInfo.isMonitor(i)) {
       issues["InputWorkspaceIndexSet"] = "Index set cannot include monitors.";
       break;
-    }
-    else if ((i > 0 && spectrumInfo.isMonitor(i - 1)) || (i < spectrumInfo.size() - 1 && spectrumInfo.isMonitor(i + 1))) {
-      issues["InputWorkspaceIndexSet"] = "A neighbour to any detector in the index set cannot be a monitor";
+    } else if ((i > 0 && spectrumInfo.isMonitor(i - 1)) ||
+               (i < spectrumInfo.size() - 1 && spectrumInfo.isMonitor(i + 1))) {
+      issues["InputWorkspaceIndexSet"] =
+          "A neighbour to any detector in the index set cannot be a monitor";
       break;
     }
   }
diff --git a/Framework/Algorithms/test/ReflectometrySumInQTest.h b/Framework/Algorithms/test/ReflectometrySumInQTest.h
index 2c7c33ad9d0..62de3326f95 100644
--- a/Framework/Algorithms/test/ReflectometrySumInQTest.h
+++ b/Framework/Algorithms/test/ReflectometrySumInQTest.h
@@ -15,12 +15,16 @@ class ReflectometrySumInQTest : public CxxTest::TestSuite {
 public:
   // This pair of boilerplate methods prevent the suite being created statically
   // This means the constructor isn't called when running other tests
-  static ReflectometrySumInQTest *createSuite() { return new ReflectometrySumInQTest(); }
-  static void destroySuite( ReflectometrySumInQTest *suite ) { delete suite; }
+  static ReflectometrySumInQTest *createSuite() {
+    return new ReflectometrySumInQTest();
+  }
+  static void destroySuite(ReflectometrySumInQTest *suite) { delete suite; }
 
-  static Mantid::API::MatrixWorkspace_sptr convertToWavelength(Mantid::API::MatrixWorkspace_sptr ws) {
+  static Mantid::API::MatrixWorkspace_sptr
+  convertToWavelength(Mantid::API::MatrixWorkspace_sptr ws) {
     using namespace Mantid;
-    auto toWavelength = API::AlgorithmManager::Instance().createUnmanaged("ConvertUnits");
+    auto toWavelength =
+        API::AlgorithmManager::Instance().createUnmanaged("ConvertUnits");
     toWavelength->initialize();
     toWavelength->setChild(true);
     toWavelength->setProperty("InputWorkspace", ws);
@@ -31,7 +35,8 @@ public:
     return toWavelength->getProperty("OutputWorkspace");
   }
 
-  static Mantid::API::MatrixWorkspace_sptr detectorsOnly(Mantid::API::MatrixWorkspace_sptr ws) {
+  static Mantid::API::MatrixWorkspace_sptr
+  detectorsOnly(Mantid::API::MatrixWorkspace_sptr ws) {
     using namespace Mantid;
     auto &specturmInfo = ws->spectrumInfo();
     std::vector<size_t> detectorIndices;
@@ -41,7 +46,8 @@ public:
       }
       detectorIndices.emplace_back(i);
     }
-    auto extractDetectors = API::AlgorithmManager::Instance().createUnmanaged("ExtractSpectra");
+    auto extractDetectors =
+        API::AlgorithmManager::Instance().createUnmanaged("ExtractSpectra");
     extractDetectors->initialize();
     extractDetectors->setChild(true);
     extractDetectors->setProperty("InputWorkspace", ws);
@@ -51,11 +57,10 @@ public:
     return extractDetectors->getProperty("OutputWorkspace");
   }
 
-  void test_init()
-  {
+  void test_init() {
     ReflectometrySumInQ alg;
-    TS_ASSERT_THROWS_NOTHING( alg.initialize() )
-    TS_ASSERT( alg.isInitialized() )
+    TS_ASSERT_THROWS_NOTHING(alg.initialize())
+    TS_ASSERT(alg.isInitialized())
   }
 
   void test_sumSingleHistogram() {
@@ -73,9 +78,12 @@ public:
         alg.setRethrows(true);
         TS_ASSERT_THROWS_NOTHING(alg.initialize())
         TS_ASSERT_THROWS_NOTHING(alg.setProperty("InputWorkspace", inputWS))
-        TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("InputWorkspaceIndexSet", std::to_string(i)))
-        TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("OutputWorkspace", "_unused_for_child"))
-        TS_ASSERT_THROWS_NOTHING(alg.setProperty("BeamCentre", static_cast<int>(i)))
+        TS_ASSERT_THROWS_NOTHING(
+            alg.setPropertyValue("InputWorkspaceIndexSet", std::to_string(i)))
+        TS_ASSERT_THROWS_NOTHING(
+            alg.setPropertyValue("OutputWorkspace", "_unused_for_child"))
+        TS_ASSERT_THROWS_NOTHING(
+            alg.setProperty("BeamCentre", static_cast<int>(i)))
         TS_ASSERT_THROWS_NOTHING(alg.setProperty("WavelengthMin", 0.1))
         TS_ASSERT_THROWS_NOTHING(alg.setProperty("WavelengthMax", 20.))
         TS_ASSERT_THROWS_NOTHING(alg.setProperty("FlatSample", isFlatSample))
@@ -84,7 +92,8 @@ public:
         TS_ASSERT(outputWS);
         TS_ASSERT_EQUALS(outputWS->getNumberHistograms(), 1)
         auto &Ys = outputWS->y(0);
-        const auto totalYSummedInQ = std::accumulate(Ys.cbegin(), Ys.cend(), 0.0);
+        const auto totalYSummedInQ =
+            std::accumulate(Ys.cbegin(), Ys.cend(), 0.0);
         TS_ASSERT_DELTA(totalYSummedInQ, totalY, 1e-10)
       }
     }
@@ -103,15 +112,19 @@ public:
     const std::array<bool, 2> flatSampleOptions{{true, false}};
     for (const auto isFlatSample : flatSampleOptions) {
       // Loop over possible beam centres.
-      for (size_t beamCentre = 0; beamCentre < inputWS->getNumberHistograms(); ++beamCentre) {
+      for (size_t beamCentre = 0; beamCentre < inputWS->getNumberHistograms();
+           ++beamCentre) {
         ReflectometrySumInQ alg;
         alg.setChild(true);
         alg.setRethrows(true);
         TS_ASSERT_THROWS_NOTHING(alg.initialize())
         TS_ASSERT_THROWS_NOTHING(alg.setProperty("InputWorkspace", inputWS))
-        TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("InputWorkspaceIndexSet", "0, 1, 2"))
-        TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("OutputWorkspace", "_unused_for_child"))
-        TS_ASSERT_THROWS_NOTHING(alg.setProperty("BeamCentre", static_cast<int>(beamCentre)))
+        TS_ASSERT_THROWS_NOTHING(
+            alg.setPropertyValue("InputWorkspaceIndexSet", "0, 1, 2"))
+        TS_ASSERT_THROWS_NOTHING(
+            alg.setPropertyValue("OutputWorkspace", "_unused_for_child"))
+        TS_ASSERT_THROWS_NOTHING(
+            alg.setProperty("BeamCentre", static_cast<int>(beamCentre)))
         TS_ASSERT_THROWS_NOTHING(alg.setProperty("WavelengthMin", 0.1))
         TS_ASSERT_THROWS_NOTHING(alg.setProperty("WavelengthMax", 20.))
         TS_ASSERT_THROWS_NOTHING(alg.setProperty("FlatSample", isFlatSample))
@@ -120,7 +133,8 @@ public:
         TS_ASSERT(outputWS);
         TS_ASSERT_EQUALS(outputWS->getNumberHistograms(), 1)
         auto &Ys = outputWS->y(0);
-        const auto totalYSummedInQ = std::accumulate(Ys.cbegin(), Ys.cend(), 0.0);
+        const auto totalYSummedInQ =
+            std::accumulate(Ys.cbegin(), Ys.cend(), 0.0);
         TS_ASSERT_DELTA(totalYSummedInQ, totalY, 1e-10)
       }
     }
@@ -138,13 +152,18 @@ public:
     TS_ASSERT(!inputWS->spectrumInfo().isMonitor(detectorIdx))
     TS_ASSERT_THROWS_NOTHING(alg.initialize())
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("InputWorkspace", inputWS))
-    TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("InputWorkspaceIndexSet", std::to_string(detectorIdx)))
-    TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("OutputWorkspace", "_unused_for_child"))
-    TS_ASSERT_THROWS_NOTHING(alg.setProperty("BeamCentre", static_cast<int>(detectorIdx)))
+    TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("InputWorkspaceIndexSet",
+                                                  std::to_string(detectorIdx)))
+    TS_ASSERT_THROWS_NOTHING(
+        alg.setPropertyValue("OutputWorkspace", "_unused_for_child"))
+    TS_ASSERT_THROWS_NOTHING(
+        alg.setProperty("BeamCentre", static_cast<int>(detectorIdx)))
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("WavelengthMin", 0.1))
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("WavelengthMax", 15.))
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("FlatSample", true))
-    TS_ASSERT_THROWS_EQUALS(alg.execute(), const std::runtime_error &e, e.what(), std::string("Some invalid Properties found"))
+    TS_ASSERT_THROWS_EQUALS(alg.execute(), const std::runtime_error &e,
+                            e.what(),
+                            std::string("Some invalid Properties found"))
   }
 
   void test_monitorInIndexSetThrows() {
@@ -157,13 +176,18 @@ public:
     TS_ASSERT(inputWS->spectrumInfo().isMonitor(monitorIdx))
     TS_ASSERT_THROWS_NOTHING(alg.initialize())
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("InputWorkspace", inputWS))
-    TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("InputWorkspaceIndexSet", std::to_string(monitorIdx)))
-    TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("OutputWorkspace", "_unused_for_child"))
-    TS_ASSERT_THROWS_NOTHING(alg.setProperty("BeamCentre", static_cast<int>(monitorIdx)))
+    TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("InputWorkspaceIndexSet",
+                                                  std::to_string(monitorIdx)))
+    TS_ASSERT_THROWS_NOTHING(
+        alg.setPropertyValue("OutputWorkspace", "_unused_for_child"))
+    TS_ASSERT_THROWS_NOTHING(
+        alg.setProperty("BeamCentre", static_cast<int>(monitorIdx)))
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("WavelengthMin", 0.1))
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("WavelengthMax", 15.))
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("FlatSample", true))
-    TS_ASSERT_THROWS_EQUALS(alg.execute(), const std::runtime_error &e, e.what(), std::string("Some invalid Properties found"))
+    TS_ASSERT_THROWS_EQUALS(alg.execute(), const std::runtime_error &e,
+                            e.what(),
+                            std::string("Some invalid Properties found"))
   }
 
   void test_BeamCentreNotInIndexSetThrows() {
@@ -175,16 +199,19 @@ public:
     alg.setRethrows(true);
     TS_ASSERT_THROWS_NOTHING(alg.initialize())
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("InputWorkspace", inputWS))
-    TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("InputWorkspaceIndexSet", "0, 1"))
-    TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("OutputWorkspace", "_unused_for_child"))
+    TS_ASSERT_THROWS_NOTHING(
+        alg.setPropertyValue("InputWorkspaceIndexSet", "0, 1"))
+    TS_ASSERT_THROWS_NOTHING(
+        alg.setPropertyValue("OutputWorkspace", "_unused_for_child"))
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("BeamCentre", 2))
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("WavelengthMin", 0.1))
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("WavelengthMax", 15.))
     TS_ASSERT_THROWS_NOTHING(alg.setProperty("FlatSample", true))
-    TS_ASSERT_THROWS_EQUALS(alg.execute(), const std::runtime_error &e, e.what(), std::string("Some invalid Properties found"))
+    TS_ASSERT_THROWS_EQUALS(alg.execute(), const std::runtime_error &e,
+                            e.what(),
+                            std::string("Some invalid Properties found"))
   }
 
-
 private:
   static Mantid::API::MatrixWorkspace_sptr testWorkspace() {
     using namespace Mantid;
@@ -196,7 +223,9 @@ private:
     constexpr double vg2{1.};
     const Kernel::V3D sourcePos{0., 0., -50.};
     const Kernel::V3D monitorPos{0., 0., -0.5};
-    const Kernel::V3D samplePos{0., 0., 0.,};
+    const Kernel::V3D samplePos{
+        0., 0., 0.,
+    };
     constexpr double twoTheta{0.87 / 180. * M_PI};
     constexpr double detectorHeight{0.001};
     constexpr double l2{2.3};
@@ -205,7 +234,9 @@ private:
     const Kernel::V3D centrePos{0., y, z};
     constexpr int nSpectra{4}; // One spectrum is monitor
     constexpr int nBins{50};
-    return create2DWorkspaceWithReflectometryInstrumentMultiDetector(startX, detectorHeight, slit1Pos, slit2Pos, vg1, vg2, sourcePos, monitorPos, samplePos, centrePos, nSpectra, nBins);
+    return create2DWorkspaceWithReflectometryInstrumentMultiDetector(
+        startX, detectorHeight, slit1Pos, slit2Pos, vg1, vg2, sourcePos,
+        monitorPos, samplePos, centrePos, nSpectra, nBins);
   }
 };
 
@@ -214,7 +245,9 @@ public:
   static ReflectometrySumInQTestPerformance *createSuite() {
     return new ReflectometrySumInQTestPerformance();
   }
-  static void destroySuite(ReflectometrySumInQTestPerformance *suite) { delete suite; }
+  static void destroySuite(ReflectometrySumInQTestPerformance *suite) {
+    delete suite;
+  }
 
   ReflectometrySumInQTestPerformance() {
     using namespace Mantid;
@@ -226,7 +259,9 @@ public:
     constexpr double vg2{1.};
     const Kernel::V3D sourcePos{0., 0., -50.};
     const Kernel::V3D monitorPos{0., 0., -0.5};
-    const Kernel::V3D samplePos{0., 0., 0.,};
+    const Kernel::V3D samplePos{
+        0., 0., 0.,
+    };
     constexpr double twoTheta{5.87 / 180. * M_PI};
     constexpr double detectorHeight{0.001};
     constexpr double l2{2.3};
@@ -236,7 +271,9 @@ public:
     constexpr int nSpectra{101}; // One spectrum is monitor
     constexpr int nBins{200};
     constexpr double binWidth{1250.};
-    m_workspace = create2DWorkspaceWithReflectometryInstrumentMultiDetector(startX, detectorHeight, slit1Pos, slit2Pos, vg1, vg2, sourcePos, monitorPos, samplePos, centrePos, nSpectra, nBins, binWidth);
+    m_workspace = create2DWorkspaceWithReflectometryInstrumentMultiDetector(
+        startX, detectorHeight, slit1Pos, slit2Pos, vg1, vg2, sourcePos,
+        monitorPos, samplePos, centrePos, nSpectra, nBins, binWidth);
     m_workspace = ReflectometrySumInQTest::convertToWavelength(m_workspace);
     m_workspace = ReflectometrySumInQTest::detectorsOnly(m_workspace);
     m_fullIndexSet.assign(m_workspace->getNumberHistograms(), 0);
diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp
index 04d6a103b87..1ab0c71adb2 100644
--- a/Framework/DataHandling/src/GroupDetectors2.cpp
+++ b/Framework/DataHandling/src/GroupDetectors2.cpp
@@ -34,6 +34,7 @@ using namespace DataObjects;
 using std::size_t;
 
 namespace { // anonymous namespace
+
 /**
  * Translate the PerformIndexOperations processing instructions from a vector
  * into a format usable by GroupDetectors.
diff --git a/Framework/Kernel/inc/MantidKernel/Strings.h b/Framework/Kernel/inc/MantidKernel/Strings.h
index ce9e578c958..984e3c03fa4 100644
--- a/Framework/Kernel/inc/MantidKernel/Strings.h
+++ b/Framework/Kernel/inc/MantidKernel/Strings.h
@@ -266,7 +266,7 @@ std::vector<std::vector<Integer>> parseGroups(const std::string &str) {
   auto translateAdd = [&groups](const std::string &str) {
     const auto tokens = Kernel::StringTokenizer(
         str, "+", Kernel::StringTokenizer::TOK_TRIM |
-                               Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
+                      Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
     std::vector<Integer> group;
     group.reserve(tokens.count());
     for (const auto &t : tokens) {
@@ -280,7 +280,7 @@ std::vector<std::vector<Integer>> parseGroups(const std::string &str) {
     // add a group with the numbers in the range
     const auto tokens = Kernel::StringTokenizer(
         str, "-", Kernel::StringTokenizer::TOK_TRIM |
-                               Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
+                      Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
     if (tokens.count() != 2)
       throw std::runtime_error("Malformed range (-) operation.");
     Integer first = boost::lexical_cast<Integer>(tokens[0]);
@@ -300,7 +300,7 @@ std::vector<std::vector<Integer>> parseGroups(const std::string &str) {
     // add a group per number
     const auto tokens = Kernel::StringTokenizer(
         str, ":", Kernel::StringTokenizer::TOK_TRIM |
-                               Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
+                      Kernel::StringTokenizer::TOK_IGNORE_EMPTY);
     if (tokens.count() != 2)
       throw std::runtime_error("Malformed range (:) operation.");
     Integer first = boost::lexical_cast<Integer>(tokens[0]);
@@ -316,9 +316,9 @@ std::vector<std::vector<Integer>> parseGroups(const std::string &str) {
   try {
     // split into comma separated groups, each group potentially containing
     // an operation (+-:) that produces even more groups.
-    const auto tokens = StringTokenizer(
-        str, ",",
-        StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY);
+    const auto tokens =
+        StringTokenizer(str, ",", StringTokenizer::TOK_TRIM |
+                                      StringTokenizer::TOK_IGNORE_EMPTY);
     for (const auto &token : tokens) {
       // Look for the various operators in the string. If one is found then
       // do the necessary translation into groupings.
@@ -334,8 +334,7 @@ std::vector<std::vector<Integer>> parseGroups(const std::string &str) {
       }
     }
   } catch (boost::bad_lexical_cast &) {
-    throw std::runtime_error("Cannot parse numbers from string: '" +
-                             str + "'");
+    throw std::runtime_error("Cannot parse numbers from string: '" + str + "'");
   }
 
   return groups;
diff --git a/Framework/Kernel/test/StringsTest.h b/Framework/Kernel/test/StringsTest.h
index 71b19fe68d4..c9ed68c801c 100644
--- a/Framework/Kernel/test/StringsTest.h
+++ b/Framework/Kernel/test/StringsTest.h
@@ -496,7 +496,8 @@ public:
   void test_parseGroups_comma() {
     std::vector<std::vector<int>> result;
     TS_ASSERT_THROWS_NOTHING(result = parseGroups<int>("7,13"))
-    std::vector<std::vector<int>> expected{{std::vector<int>(1, 7), std::vector<int>(1, 13)}};
+    std::vector<std::vector<int>> expected{
+        {std::vector<int>(1, 7), std::vector<int>(1, 13)}};
     TS_ASSERT_EQUALS(result, expected)
   }
 
@@ -507,7 +508,6 @@ public:
     expected.front().emplace_back(7);
     expected.front().emplace_back(13);
     TS_ASSERT_EQUALS(result, expected)
-
   }
 
   void test_parseGroups_dash() {
@@ -539,7 +539,8 @@ public:
 
   void test_parseGroups_acceptsWhitespace() {
     std::vector<std::vector<int>> result;
-    TS_ASSERT_THROWS_NOTHING(result = parseGroups<int>(" 1\t, 4 +  5\t+ 8 , 7\t- 13 ,\t1  "))
+    TS_ASSERT_THROWS_NOTHING(
+        result = parseGroups<int>(" 1\t, 4 +  5\t+ 8 , 7\t- 13 ,\t1  "))
     std::vector<std::vector<int>> expected;
     expected.emplace_back(1, 1);
     expected.emplace_back();
@@ -555,12 +556,18 @@ public:
   }
 
   void test_parseGroups_throwsWhenInputContainsNonnumericCharacters() {
-    TS_ASSERT_THROWS_EQUALS(parseGroups<int>("a"), const std::runtime_error &e, e.what(), std::string("Cannot parse numbers from string: 'a'"))
+    TS_ASSERT_THROWS_EQUALS(
+        parseGroups<int>("a"), const std::runtime_error &e, e.what(),
+        std::string("Cannot parse numbers from string: 'a'"))
   }
 
   void test_parseGroups_throwsWhenOperationsAreInvalid() {
-    TS_ASSERT_THROWS_EQUALS(parseGroups<int>("-1"), const std::runtime_error &e, e.what(), std::string("Malformed range (-) operation."))
-    TS_ASSERT_THROWS_EQUALS(parseGroups<int>(":1"), const std::runtime_error &e, e.what(), std::string("Malformed range (:) operation."))
+    TS_ASSERT_THROWS_EQUALS(parseGroups<int>("-1"), const std::runtime_error &e,
+                            e.what(),
+                            std::string("Malformed range (-) operation."))
+    TS_ASSERT_THROWS_EQUALS(parseGroups<int>(":1"), const std::runtime_error &e,
+                            e.what(),
+                            std::string("Malformed range (:) operation."))
   }
 
   void test_toString_vector_of_ints() {
diff --git a/Framework/TestHelpers/inc/MantidTestHelpers/WorkspaceCreationHelper.h b/Framework/TestHelpers/inc/MantidTestHelpers/WorkspaceCreationHelper.h
index 305cf4f564b..f0b3464b631 100644
--- a/Framework/TestHelpers/inc/MantidTestHelpers/WorkspaceCreationHelper.h
+++ b/Framework/TestHelpers/inc/MantidTestHelpers/WorkspaceCreationHelper.h
@@ -388,14 +388,16 @@ void create2DAngles(std::vector<double> &L2, std::vector<double> &polar,
 
 /// Create a 2D workspace with one detector and one monitor based around a
 /// virtual reflectometry instrument.
-Mantid::API::MatrixWorkspace_sptr create2DWorkspaceWithReflectometryInstrument(const double startX = 0.0,
+Mantid::API::MatrixWorkspace_sptr create2DWorkspaceWithReflectometryInstrument(
+    const double startX = 0.0,
     const Mantid::Kernel::V3D &slit1Pos = Mantid::Kernel::V3D(0, 0, 0),
     const Mantid::Kernel::V3D &slit2Pos = Mantid::Kernel::V3D(0, 0, 1),
     const double vg1 = 0.5, const double vg2 = 1.0,
     const Mantid::Kernel::V3D &sourcePos = Mantid::Kernel::V3D(0, 0, 0),
     const Mantid::Kernel::V3D &monitorPos = Mantid::Kernel::V3D(14, 0, 0),
     const Mantid::Kernel::V3D &samplePos = Mantid::Kernel::V3D(15, 0, 0),
-    const Mantid::Kernel::V3D &detectorPos = Mantid::Kernel::V3D(20, (20 - 15), 0),
+    const Mantid::Kernel::V3D &detectorPos = Mantid::Kernel::V3D(20, (20 - 15),
+                                                                 0),
     const int nBins = 100, const double deltaX = 2000.0);
 
 /// Create a 2D workspace with one monitor and three detectors based around
@@ -403,14 +405,15 @@ Mantid::API::MatrixWorkspace_sptr create2DWorkspaceWithReflectometryInstrument(c
 Mantid::API::MatrixWorkspace_sptr
 create2DWorkspaceWithReflectometryInstrumentMultiDetector(
     const double startX = 0.0, const double detSize = 0.0,
-        const Mantid::Kernel::V3D &slit1Pos = Mantid::Kernel::V3D(0, 0, 0),
-        const Mantid::Kernel::V3D &slit2Pos = Mantid::Kernel::V3D(0, 0, 1),
-        const double vg1 = 0.5, const double vg2 = 1.0,
-        const Mantid::Kernel::V3D &sourcePos = Mantid::Kernel::V3D(0, 0, 0),
-        const Mantid::Kernel::V3D &monitorPos = Mantid::Kernel::V3D(14, 0, 0),
-        const Mantid::Kernel::V3D &samplePos = Mantid::Kernel::V3D(15, 0, 0),
-        const Mantid::Kernel::V3D &detectorCenterPos = Mantid::Kernel::V3D(20, (20 - 15), 0),
-        const int nSpectra = 4, const int nBins = 20, const double deltaX = 5000.0);
+    const Mantid::Kernel::V3D &slit1Pos = Mantid::Kernel::V3D(0, 0, 0),
+    const Mantid::Kernel::V3D &slit2Pos = Mantid::Kernel::V3D(0, 0, 1),
+    const double vg1 = 0.5, const double vg2 = 1.0,
+    const Mantid::Kernel::V3D &sourcePos = Mantid::Kernel::V3D(0, 0, 0),
+    const Mantid::Kernel::V3D &monitorPos = Mantid::Kernel::V3D(14, 0, 0),
+    const Mantid::Kernel::V3D &samplePos = Mantid::Kernel::V3D(15, 0, 0),
+    const Mantid::Kernel::V3D &detectorCenterPos =
+        Mantid::Kernel::V3D(20, (20 - 15), 0),
+    const int nSpectra = 4, const int nBins = 20, const double deltaX = 5000.0);
 
 void createInstrumentForWorkspaceWithDistances(
     Mantid::API::MatrixWorkspace_sptr workspace,
diff --git a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
index 307d86360b9..f34b3c51d4b 100644
--- a/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
+++ b/Framework/TestHelpers/src/WorkspaceCreationHelper.cpp
@@ -647,8 +647,9 @@ DataObjects::Workspace2D_sptr reflectometryWorkspace(const double startX,
  * @param deltaX :: TOF delta x-value
  */
 MatrixWorkspace_sptr create2DWorkspaceWithReflectometryInstrument(
-    const double startX, const V3D &slit1Pos, const V3D &slit2Pos, const double vg1, const double vg2,
-    const V3D &sourcePos, const V3D &monitorPos, const V3D &samplePos, const V3D &detectorPos,
+    const double startX, const V3D &slit1Pos, const V3D &slit2Pos,
+    const double vg1, const double vg2, const V3D &sourcePos,
+    const V3D &monitorPos, const V3D &samplePos, const V3D &detectorPos,
     const int nBins, const double deltaX) {
   Instrument_sptr instrument = boost::make_shared<Instrument>();
   instrument->setReferenceFrame(boost::make_shared<ReferenceFrame>(
@@ -686,15 +687,11 @@ MatrixWorkspace_sptr create2DWorkspaceWithReflectometryInstrument(
 * @param deltaX :: TOF delta x-value
 */
 MatrixWorkspace_sptr create2DWorkspaceWithReflectometryInstrumentMultiDetector(
-    const double startX, const double detSize,
-        const V3D &slit1Pos,
-        const V3D &slit2Pos,
-        const double vg1, const double vg2,
-        const V3D &sourcePos,
-        const V3D &monitorPos,
-        const V3D &samplePos,
-        const V3D &detectorCenterPos,
-        const int nSpectra, const int nBins, const double deltaX) {
+    const double startX, const double detSize, const V3D &slit1Pos,
+    const V3D &slit2Pos, const double vg1, const double vg2,
+    const V3D &sourcePos, const V3D &monitorPos, const V3D &samplePos,
+    const V3D &detectorCenterPos, const int nSpectra, const int nBins,
+    const double deltaX) {
   Instrument_sptr instrument = boost::make_shared<Instrument>();
   instrument->setReferenceFrame(boost::make_shared<ReferenceFrame>(
       PointingAlong::Y /*up*/, PointingAlong::X /*along*/, Handedness::Left,
-- 
GitLab