Skip to content

Commit 50cba5f

Browse files
Remove clang-format suppressions
Compiler modernization and fixes to nexus make many of these unnecessary. Refs #38332
1 parent bc7e058 commit 50cba5f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+110
-244
lines changed

Framework/API/src/FileBackedExperimentInfo.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@
66
// SPDX - License - Identifier: GPL - 3.0 +
77
#include "MantidAPI/FileBackedExperimentInfo.h"
88
#include "MantidKernel/Logger.h"
9+
#include "MantidNexusCpp/NeXusException.hpp"
10+
#include "MantidNexusCpp/NeXusFile.hpp"
911

1012
#include <sstream>
1113
#include <utility>
1214

13-
// clang-format off
14-
#include "MantidNexusCpp/NeXusFile.hpp"
15-
#include "MantidNexusCpp/NeXusException.hpp"
16-
// clang-format on
17-
1815
namespace Mantid::API {
1916

2017
namespace {

Framework/API/test/WorkspaceHistoryIOTest.h

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,11 @@ class WorkspaceHistoryIOTest : public CxxTest::TestSuite {
203203
testHistory.addHistory(std::make_shared<AlgorithmHistory>(algHist));
204204
}
205205

206-
// clang-format off
207-
auto savehandle = std::make_shared< ::NeXus::File >("WorkspaceHistoryTest_test_SaveNexus.nxs",NXACC_CREATE5);
208-
// clang-format on
206+
auto savehandle = std::make_shared<::NeXus::File>("WorkspaceHistoryTest_test_SaveNexus.nxs", NXACC_CREATE5);
209207
TS_ASSERT_THROWS_NOTHING(testHistory.saveNexus(savehandle.get()));
210208
savehandle->close();
211209

212-
// clang-format off
213-
auto loadhandle = std::make_shared< ::NeXus::File >("WorkspaceHistoryTest_test_SaveNexus.nxs");
214-
// clang-format on
210+
auto loadhandle = std::make_shared<::NeXus::File>("WorkspaceHistoryTest_test_SaveNexus.nxs");
215211
std::string rootstring = "/process/";
216212
for (int i = 1; i < 5; i++) {
217213
TS_ASSERT_THROWS_NOTHING(
@@ -237,15 +233,11 @@ class WorkspaceHistoryIOTest : public CxxTest::TestSuite {
237233
algHist.addChildHistory(std::make_shared<AlgorithmHistory>(childHist));
238234
testHistory.addHistory(std::make_shared<AlgorithmHistory>(algHist));
239235

240-
// clang-format off
241-
auto savehandle = std::make_shared< ::NeXus::File >("WorkspaceHistoryTest_test_SaveNexus.nxs",NXACC_CREATE5);
242-
// clang-format on
236+
auto savehandle = std::make_shared<::NeXus::File>("WorkspaceHistoryTest_test_SaveNexus.nxs", NXACC_CREATE5);
243237
TS_ASSERT_THROWS_NOTHING(testHistory.saveNexus(savehandle.get()));
244238
savehandle->close();
245239

246-
// clang-format off
247-
auto loadhandle = std::make_shared< ::NeXus::File >("WorkspaceHistoryTest_test_SaveNexus.nxs");
248-
// clang-format on
240+
auto loadhandle = std::make_shared<::NeXus::File>("WorkspaceHistoryTest_test_SaveNexus.nxs");
249241
std::string rootstring = "/process/";
250242
TS_ASSERT_THROWS_NOTHING(loadhandle->openPath(rootstring + "MantidAlgorithm_1/"));
251243
TS_ASSERT_THROWS_NOTHING(loadhandle->openPath(rootstring + "MantidAlgorithm_1/author"));
@@ -264,15 +256,11 @@ class WorkspaceHistoryIOTest : public CxxTest::TestSuite {
264256
void test_SaveNexus_Empty() {
265257
WorkspaceHistory testHistory;
266258

267-
// clang-format off
268-
auto savehandle = std::make_shared< ::NeXus::File >("WorkspaceHistoryTest_test_SaveNexus.nxs",NXACC_CREATE5);
269-
// clang-format on
259+
auto savehandle = std::make_shared<::NeXus::File>("WorkspaceHistoryTest_test_SaveNexus.nxs", NXACC_CREATE5);
270260
TS_ASSERT_THROWS_NOTHING(testHistory.saveNexus(savehandle.get()));
271261
savehandle->close();
272262

273-
// clang-format off
274-
auto loadhandle = std::make_shared< ::NeXus::File >("WorkspaceHistoryTest_test_SaveNexus.nxs");
275-
// clang-format on
263+
auto loadhandle = std::make_shared<::NeXus::File>("WorkspaceHistoryTest_test_SaveNexus.nxs");
276264
std::string rootstring = "/process/";
277265
TS_ASSERT_THROWS_NOTHING(loadhandle->openPath(rootstring));
278266
TS_ASSERT_THROWS_NOTHING(loadhandle->openPath(rootstring + "MantidEnvironment"));
@@ -284,9 +272,7 @@ class WorkspaceHistoryIOTest : public CxxTest::TestSuite {
284272

285273
void test_LoadNexus() {
286274
std::string filename = FileFinder::Instance().getFullPath("GEM38370_Focussed_Legacy.nxs");
287-
// clang-format off
288-
auto loadhandle = std::make_shared< ::NeXus::File >(filename);
289-
// clang-format on
275+
auto loadhandle = std::make_shared<::NeXus::File>(filename);
290276
loadhandle->openPath("/mantid_workspace_1");
291277

292278
WorkspaceHistory emptyHistory;
@@ -306,9 +292,7 @@ class WorkspaceHistoryIOTest : public CxxTest::TestSuite {
306292

307293
void test_LoadNexus_NestedHistory() {
308294
std::string filename = FileFinder::Instance().getFullPath("HistoryTest_CreateTransmissionAuto.nxs");
309-
// clang-format off
310-
auto loadhandle = std::make_shared< ::NeXus::File >(filename);
311-
// clang-format on
295+
auto loadhandle = std::make_shared<::NeXus::File>(filename);
312296
loadhandle->openPath("/mantid_workspace_1");
313297

314298
WorkspaceHistory wsHistory;

Framework/Algorithms/test/RebinByPulseTimesTest.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,8 @@ class RebinByPulseTimesTest : public CxxTest::TestSuite, public Super {
125125
//=====================================================================================
126126
// Performance Tests
127127
//=====================================================================================
128-
// clang-format off
129-
class RebinByPulseTimesTestPerformance : public CxxTest::TestSuite, public RebinByTimeBaseTestPerformance<RebinByPulseTimes>
130-
// clang-format on
131-
{
128+
class RebinByPulseTimesTestPerformance : public CxxTest::TestSuite,
129+
public RebinByTimeBaseTestPerformance<RebinByPulseTimes> {
132130

133131
public:
134132
static RebinByPulseTimesTestPerformance *createSuite() { return new RebinByPulseTimesTestPerformance(); }

Framework/Algorithms/test/RebinByTimeAtSampleTest.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,8 @@ class RebinByTimeAtSampleTest : public CxxTest::TestSuite, public Super {
245245
//=====================================================================================
246246
// Performance Tests
247247
//=====================================================================================
248-
// clang-format off
249-
class RebinByTimeAtSampleTestPerformance: public CxxTest::TestSuite,
250-
public RebinByTimeBaseTestPerformance<RebinByTimeAtSample>
251-
// clang-format on
252-
{
248+
class RebinByTimeAtSampleTestPerformance : public CxxTest::TestSuite,
249+
public RebinByTimeBaseTestPerformance<RebinByTimeAtSample> {
253250

254251
public:
255252
static RebinByTimeAtSampleTestPerformance *createSuite() { return new RebinByTimeAtSampleTestPerformance(); }

Framework/Crystal/src/AddPeakHKL.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ const std::string AddPeakHKL::summary() const { return "Add a peak in the hkl fr
4040
void AddPeakHKL::init() {
4141
declareProperty(std::make_unique<WorkspaceProperty<Mantid::API::IPeaksWorkspace>>("Workspace", "", Direction::InOut),
4242
"An input workspace.");
43-
// clang-format off
44-
declareProperty(std::make_unique<ArrayProperty<double>>("HKL", std::make_shared<ArrayLengthValidator<double> > (3)), "HKL point to add");
45-
// clang-format on
43+
declareProperty(std::make_unique<ArrayProperty<double>>("HKL", std::make_shared<ArrayLengthValidator<double>>(3)),
44+
"HKL point to add");
4645
}
4746

4847
//----------------------------------------------------------------------------------------------

Framework/Crystal/src/SetUB.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ void SetUB::init() {
3838
auto reasonableAngle = std::make_shared<BoundedValidator<double>>();
3939
reasonableAngle->setLower(5.0);
4040
reasonableAngle->setUpper(175.0);
41-
// clang-format off
42-
auto mustBe3D = std::make_shared<ArrayLengthValidator<double> >(3);
43-
auto threeVthree = std::make_shared<ArrayLengthValidator<double> >(9);
44-
// clang-format on
41+
auto mustBe3D = std::make_shared<ArrayLengthValidator<double>>(3);
42+
auto threeVthree = std::make_shared<ArrayLengthValidator<double>>(9);
4543
std::vector<double> zeroes(9, 0.), u0(3, 0), v0(3, 0);
4644
u0[0] = 1.;
4745
v0[1] = 1.;

Framework/Crystal/src/TransformHKL.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ void TransformHKL::init() {
4848
identity_matrix[0] = 1;
4949
identity_matrix[4] = 1;
5050
identity_matrix[8] = 1;
51-
// clang-format off
52-
auto threeBythree = std::make_shared<ArrayLengthValidator<double> >(9);
53-
// clang-format on
51+
auto threeBythree = std::make_shared<ArrayLengthValidator<double>>(9);
5452
this->declareProperty(
5553
std::make_unique<ArrayProperty<double>>("HKLTransform", std::move(identity_matrix), std::move(threeBythree)),
5654
"Specify 3x3 HKL transform matrix as a comma separated list of 9 "

Framework/Crystal/test/IndexPeaksTest.h

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,12 @@ PeaksWorkspace_sptr createTestPeaksWorkspaceMainReflOnly() {
7373
0.0045884, 0.0273738, -0.08973560, 0.0252595};
7474
// peaks from TOPAZ_3007.peaks: 0, 1, 2, 10, 42 with sign for Q swapped
7575
// as we don't use the crystallographic convention
76-
// clang-format off
77-
GNU_DIAG_OFF("missing-braces")
78-
// clang-format on
76+
GNU_DIAG_OFF("missing-braces");
7977
constexpr std::array<MinimalPeak, npeaks> testPeaksInfo = {
8078
MinimalPeak{3008, V3D(-3.52961, 3.13589, 1.0899)}, MinimalPeak{3007, V3D(-2.42456, 2.29581, 1.71147)},
8179
MinimalPeak{3007, V3D(-3.04393, 3.05739, 2.03727)}, MinimalPeak{3007, V3D(-4.02271, 2.4073, 1.62228)},
8280
MinimalPeak{3008, V3D(-4.04552, 1.59916, 3.71776)}};
83-
// clang-format off
84-
GNU_DIAG_ON("missing-braces")
85-
// clang-format on
81+
GNU_DIAG_ON("missing-braces");
8682
return createPeaksWorkspace<npeaks>(testPeaksInfo, ub);
8783
}
8884

@@ -91,19 +87,15 @@ PeaksWorkspace_sptr createTestPeaksWorkspaceWithSatellites(const int maxOrder =
9187
const bool crossTerms = false) {
9288
constexpr int npeaks{5};
9389
const std::vector<double> ub = {0.269, -0.01, 0.033, 0.081, -0.191, -0.039, 0.279, 0.347, -0.02};
94-
// clang-format off
95-
GNU_DIAG_OFF("missing-braces")
96-
// clang-format on
90+
GNU_DIAG_OFF("missing-braces");
9791
constexpr std::array<MinimalPeak, npeaks> testPeaksInfo = {
9892
MinimalPeak{1, V3D(-3.691, -0.694, 3.762)}, // main
9993
MinimalPeak{2, V3D(-1.234, -0.225, 1.25212)}, // satellite
10094
MinimalPeak{1, V3D(-3.824, 0.728, 1.711)}, // main
10195
MinimalPeak{1, V3D(0.872, -0.1998, 2.7476)}, // satellite
10296
MinimalPeak{2, V3D(-1.54093, 0.129343, 1.445)}, // satellite
10397
};
104-
// clang-format off
105-
GNU_DIAG_ON("missing-braces")
106-
// clang-format on
98+
GNU_DIAG_ON("missing-braces");
10799
return createPeaksWorkspace<npeaks>(testPeaksInfo, ub, maxOrder, modVectors, crossTerms);
108100
}
109101

Framework/Crystal/test/IntegratePeaksUsingClustersTest.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,7 @@ class IntegratePeaksUsingClustersTest : public CxxTest::TestSuite, public Cluste
248248
//=====================================================================================
249249
// Performance Tests
250250
//=====================================================================================
251-
// clang-format off
252-
class IntegratePeaksUsingClustersTestPerformance : public CxxTest::TestSuite, public ClusterIntegrationBaseTest
253-
// clang-format on
254-
{
251+
class IntegratePeaksUsingClustersTestPerformance : public CxxTest::TestSuite, public ClusterIntegrationBaseTest {
255252

256253
private:
257254
// Input data

Framework/DataHandling/inc/MantidDataHandling/LoadEventNexus.h

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,16 @@
2323
#include "MantidKernel/Exception.h"
2424
#include "MantidKernel/NexusHDF5Descriptor.h"
2525
#include "MantidKernel/OptionalBool.h"
26-
#include "MantidKernel/TimeSeriesProperty.h"
2726

28-
#include <Poco/Path.h>
29-
#include <boost/lexical_cast.hpp>
30-
#include <boost/scoped_array.hpp>
27+
#include "MantidKernel/TimeSeriesProperty.h"
3128

32-
// clang-format off
33-
#include "MantidNexusCpp/NeXusFile.hpp"
3429
#include "MantidNexusCpp/NeXusException.hpp"
35-
// clang-format on
30+
#include "MantidNexusCpp/NeXusFile.hpp"
3631

32+
#include <Poco/Path.h>
3733
#include <algorithm>
34+
#include <boost/lexical_cast.hpp>
35+
#include <boost/scoped_array.hpp>
3836
#include <cstdint>
3937
#include <functional>
4038
#include <memory>
@@ -703,17 +701,14 @@ void LoadEventNexus::loadEntryMetadata(const std::string &nexusfilename, T WS, c
703701
file.getDataCoerce(duration);
704702
if (duration.size() == 1) {
705703
// get the units
706-
// clang-format off
707-
std::vector< ::NeXus::AttrInfo> infos = file.getAttrInfos();
708-
std::string units;
709-
for (std::vector< ::NeXus::AttrInfo>::const_iterator it = infos.begin();
710-
it != infos.end(); ++it) {
711-
if (it->name == "units") {
712-
units = file.getStrAttr(*it);
713-
break;
704+
std::vector<::NeXus::AttrInfo> infos = file.getAttrInfos();
705+
std::string units;
706+
for (std::vector<::NeXus::AttrInfo>::const_iterator it = infos.begin(); it != infos.end(); ++it) {
707+
if (it->name == "units") {
708+
units = file.getStrAttr(*it);
709+
break;
710+
}
714711
}
715-
}
716-
// clang-format on
717712

718713
// set the property
719714
WS->mutableRun().addProperty("duration", duration[0], units, true);

0 commit comments

Comments
 (0)