Skip to content

Commit 73173ad

Browse files
committed
clang format to represent the east const
1 parent 56d41d8 commit 73173ad

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

.clang-format

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ BasedOnStyle: LLVM
44
---
55
Language: Cpp
66
ColumnLimit: 120
7+
QualifierAlignment: Right
78
...

.pre-commit-config.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ repos:
2727
rev: v19.1.7
2828
hooks:
2929
- id: clang-format
30+
files: $(git diff --name-only main HEAD)
3031
exclude: Testing/Tools/cxxtest|tools|qt/icons/resources/
3132

3233
- repo: https://github.com/mantidproject/pre-commit-hooks.git
@@ -65,4 +66,5 @@ repos:
6566
- id: ruff
6667
args: [--fix, --exit-non-zero-on-fix]
6768
- id: ruff-format
69+
files: $(git diff --name-only main HEAD)
6870
exclude: scripts/templates/reference/|Testing/Tools/cxxtest

Framework/DataHandling/src/LoadDiffCal.cpp

+21-21
Original file line numberDiff line numberDiff line change
@@ -48,38 +48,38 @@ using namespace NeXus;
4848

4949
namespace {
5050
enum class CalibFilenameExtensionEnum { H5, HD5, HDF, CAL, enum_count };
51-
const std::vector<std::string> calibFilenameExtensions{".h5", ".hd5", ".hdf", ".cal"};
51+
std::vector<std::string> const calibFilenameExtensions{".h5", ".hd5", ".hdf", ".cal"};
5252
typedef EnumeratedString<CalibFilenameExtensionEnum, &calibFilenameExtensions, &compareStringsCaseInsensitive>
5353
CalibFilenameExtension;
5454

5555
enum class GroupingFilenameExtensionEnum { XML, H5, HD5, HDF, CAL, enum_count };
56-
const std::vector<std::string> groupingFilenameExtensions{".xml", ".h5", ".hd5", ".hdf", ".cal"};
56+
std::vector<std::string> const groupingFilenameExtensions{".xml", ".h5", ".hd5", ".hdf", ".cal"};
5757
typedef EnumeratedString<GroupingFilenameExtensionEnum, &groupingFilenameExtensions, &compareStringsCaseInsensitive>
5858
GroupingFilenameExtension;
5959

6060
namespace PropertyNames {
61-
const std::string CAL_FILE("Filename");
62-
const std::string GROUP_FILE("GroupFilename");
63-
const std::string MAKE_CAL("MakeCalWorkspace");
64-
const std::string MAKE_GRP("MakeGroupingWorkspace");
65-
const std::string MAKE_MSK("MakeMaskWorkspace");
61+
std::string const CAL_FILE("Filename");
62+
std::string const GROUP_FILE("GroupFilename");
63+
std::string const MAKE_CAL("MakeCalWorkspace");
64+
std::string const MAKE_GRP("MakeGroupingWorkspace");
65+
std::string const MAKE_MSK("MakeMaskWorkspace");
6666
} // namespace PropertyNames
6767
} // namespace
6868

6969
// Register the algorithm into the AlgorithmFactory
7070
DECLARE_ALGORITHM(LoadDiffCal)
7171

7272
/// Algorithms name for identification. @see Algorithm::name
73-
const std::string LoadDiffCal::name() const { return "LoadDiffCal"; }
73+
std::string const LoadDiffCal::name() const { return "LoadDiffCal"; }
7474

7575
/// Algorithm's version for identification. @see Algorithm::version
7676
int LoadDiffCal::version() const { return 1; }
7777

7878
/// Algorithm's category for identification. @see Algorithm::category
79-
const std::string LoadDiffCal::category() const { return "DataHandling\\Instrument;Diffraction\\DataHandling"; }
79+
std::string const LoadDiffCal::category() const { return "DataHandling\\Instrument;Diffraction\\DataHandling"; }
8080

8181
/// Algorithm's summary for use in the GUI and help. @see Algorithm::summary
82-
const std::string LoadDiffCal::summary() const { return "Loads a calibration file for powder diffraction"; }
82+
std::string const LoadDiffCal::summary() const { return "Loads a calibration file for powder diffraction"; }
8383

8484
/** Initialize the algorithm's properties.
8585
*/
@@ -123,21 +123,21 @@ void LoadDiffCal::init() {
123123

124124
namespace { // anonymous
125125

126-
void setGroupWSProperty(API::Algorithm *alg, const std::string &prefix, const GroupingWorkspace_sptr &wksp) {
126+
void setGroupWSProperty(API::Algorithm *alg, std::string const &prefix, GroupingWorkspace_sptr const &wksp) {
127127
alg->declareProperty(std::make_unique<WorkspaceProperty<DataObjects::GroupingWorkspace>>(
128128
"OutputGroupingWorkspace", prefix + "_group", Direction::Output),
129129
"Set the output GroupingWorkspace, if any.");
130130
alg->setProperty("OutputGroupingWorkspace", wksp);
131131
}
132132

133-
void setMaskWSProperty(API::Algorithm *alg, const std::string &prefix, const MaskWorkspace_sptr &wksp) {
133+
void setMaskWSProperty(API::Algorithm *alg, std::string const &prefix, MaskWorkspace_sptr const &wksp) {
134134
alg->declareProperty(std::make_unique<WorkspaceProperty<DataObjects::MaskWorkspace>>(
135135
"OutputMaskWorkspace", prefix + "_mask", Direction::Output),
136136
"Set the output MaskWorkspace, if any.");
137137
alg->setProperty("OutputMaskWorkspace", wksp);
138138
}
139139

140-
void setCalWSProperty(API::Algorithm *alg, const std::string &prefix, const ITableWorkspace_sptr &wksp) {
140+
void setCalWSProperty(API::Algorithm *alg, std::string const &prefix, ITableWorkspace_sptr const &wksp) {
141141
alg->declareProperty(
142142
std::make_unique<WorkspaceProperty<ITableWorkspace>>("OutputCalWorkspace", prefix + "_cal", Direction::Output),
143143
"Set the output Diffraction Calibration workspace, if any.");
@@ -182,7 +182,7 @@ void LoadDiffCal::getInstrument(H5File &file) {
182182
<< m_instrument->getFilename() << "\"\n";
183183
}
184184

185-
void LoadDiffCal::makeGroupingWorkspace(const std::vector<int32_t> &detids, const std::vector<int32_t> &groups) {
185+
void LoadDiffCal::makeGroupingWorkspace(std::vector<int32_t> const &detids, std::vector<int32_t> const &groups) {
186186
bool makeWS = getProperty(PropertyNames::MAKE_GRP);
187187
if (!makeWS) {
188188
g_log.information("Not loading GroupingWorkspace from the calibration file");
@@ -211,7 +211,7 @@ void LoadDiffCal::makeGroupingWorkspace(const std::vector<int32_t> &detids, cons
211211
setGroupWSProperty(this, m_workspaceName, wksp);
212212
}
213213

214-
void LoadDiffCal::makeMaskWorkspace(const std::vector<int32_t> &detids, const std::vector<int32_t> &use) {
214+
void LoadDiffCal::makeMaskWorkspace(std::vector<int32_t> const &detids, std::vector<int32_t> const &use) {
215215
bool makeWS = getProperty(PropertyNames::MAKE_MSK);
216216
if (!makeWS) {
217217
g_log.information("Not making a MaskWorkspace");
@@ -238,10 +238,10 @@ void LoadDiffCal::makeMaskWorkspace(const std::vector<int32_t> &detids, const st
238238
setMaskWSProperty(this, m_workspaceName, wksp);
239239
}
240240

241-
void LoadDiffCal::makeCalWorkspace(const std::vector<int32_t> &detids, const std::vector<double> &difc,
242-
const std::vector<double> &difa, const std::vector<double> &tzero,
243-
const std::vector<int32_t> &dasids, const std::vector<double> &offsets,
244-
const std::vector<int32_t> &use) {
241+
void LoadDiffCal::makeCalWorkspace(std::vector<int32_t> const &detids, std::vector<double> const &difc,
242+
std::vector<double> const &difa, std::vector<double> const &tzero,
243+
std::vector<int32_t> const &dasids, std::vector<double> const &offsets,
244+
std::vector<int32_t> const &use) {
245245
bool makeWS = getProperty(PropertyNames::MAKE_CAL);
246246
if (!makeWS) {
247247
g_log.information("Not making a calibration workspace");
@@ -290,14 +290,14 @@ void LoadDiffCal::makeCalWorkspace(const std::vector<int32_t> &detids, const std
290290

291291
// calculate tof range for information
292292
Kernel::Units::dSpacing dspacingUnit;
293-
const double tofMinRow = dspacingUnit.calcTofMin(difc[i], difa[i], tzero[i], tofMin);
293+
double const tofMinRow = dspacingUnit.calcTofMin(difc[i], difa[i], tzero[i], tofMin);
294294
std::stringstream msg;
295295
if (tofMinRow != tofMin) {
296296
msg << "TofMin shifted from " << tofMin << " to " << tofMinRow << " ";
297297
}
298298
newrow << tofMinRow;
299299
if (useTofMax) {
300-
const double tofMaxRow = dspacingUnit.calcTofMax(difc[i], difa[i], tzero[i], tofMax);
300+
double const tofMaxRow = dspacingUnit.calcTofMax(difc[i], difa[i], tzero[i], tofMax);
301301
newrow << tofMaxRow;
302302

303303
if (tofMaxRow != tofMax) {

0 commit comments

Comments
 (0)