Skip to content

[pre-commit.ci] pre-commit autoupdate #38158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ci:
repos:
# Run fast code improvement/checks before running PR specific helpers.
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
Expand All @@ -24,10 +24,10 @@ repos:
exclude: .md5$|^external/|^tools/|Testing/Tools/cxxtest

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v12.0.1 # updating to a new version should wait until maintenance
rev: v19.1.2 # updating to a new version should wait until maintenance
hooks:
- id: clang-format
exclude: Testing/Tools/cxxtest|tools
exclude: Testing/Tools/cxxtest|tools|qt/icons/resources/

- repo: https://github.com/mantidproject/pre-commit-hooks.git
rev: 17c2842277953a4afcbca26bf84e8956f729e765
Expand Down Expand Up @@ -59,7 +59,7 @@ repos:
)$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
rev: v0.7.0
# ruff must appear before black in the list of hooks
hooks:
- id: ruff
Expand Down
2 changes: 1 addition & 1 deletion Framework/API/inc/MantidAPI/Column.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace API {
*/
class MANTID_API_DLL Column {
public:
Column() : m_type("int"), m_plotType(-1000), m_isReadOnly(false){};
Column() : m_type("int"), m_plotType(-1000), m_isReadOnly(false) {};

/// Virtual destructor
virtual ~Column() = default;
Expand Down
2 changes: 1 addition & 1 deletion Framework/API/inc/MantidAPI/FunctionDomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/DllConfig.h"
//#include "MantidKernel/PropertyManager.h"

#ifndef Q_MOC_RUN
#include <memory>
#endif
Expand Down
6 changes: 4 additions & 2 deletions Framework/API/inc/MantidAPI/IFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ class FunctionHandler;
* double attribute*
* It functions by inheriting the () operator defined in each lambda
*/
template <class... Ts> struct AttributeLambdaVisitor : Ts... { using Ts::operator()...; };
template <class... Ts> struct AttributeLambdaVisitor : Ts... {
using Ts::operator()...;
};
template <class... Ts> AttributeLambdaVisitor(Ts...) -> AttributeLambdaVisitor<Ts...>;

/** This is an interface to a fitting function - a semi-abstarct class.
Expand Down Expand Up @@ -177,7 +179,7 @@ class MANTID_API_DLL IFunction {
*/
struct ValidatorEvaluator {
public:
ValidatorEvaluator(){}; // default constructor
ValidatorEvaluator() {}; // default constructor
template <typename T1> static void evaluate(T1 &inputData, Mantid::Kernel::IValidator_sptr validator) {
std::string error;

Expand Down
2 changes: 1 addition & 1 deletion Framework/API/inc/MantidAPI/ISpectrum.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class MANTID_API_DLL ISpectrum {
virtual void copyDataInto(SpectrumTester &) const;

protected:
virtual void checkAndSanitizeHistogram(HistogramData::Histogram &){};
virtual void checkAndSanitizeHistogram(HistogramData::Histogram &) {};
virtual void checkWorksWithPoints() const {}
virtual void checkIsYAndEWritable() const {}

Expand Down
7 changes: 4 additions & 3 deletions Framework/API/inc/MantidAPI/ImplicitFunctionParameterParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* is used in the call to its constructor to effect a call to the factory's
* subscribe method.
*/
//#define Parser Parser
#define DECLARE_IMPLICIT_FUNCTION_PARAMETER_PARSER(classname) \
namespace { \
Mantid::Kernel::RegistrationHelper register_alg_##classname( \
Expand Down Expand Up @@ -51,10 +50,12 @@ namespace API {
/*
* Deletion policy for unique pointers.
*/
template <typename T> class DLLExport DeleterPolicy {
// clang-format off
template <typename T> class DLLExport DeleterPolicy{
public:
void operator()(T *pParser) { delete pParser; }
void operator()(T *pParser){ delete pParser; }
};
// clang-format on

/*
* ImplicitFunctionParameterParser definition. Used to parse implicit function
Expand Down
1 change: 0 additions & 1 deletion Framework/API/inc/MantidAPI/ImplicitFunctionParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* is used in the call to its constructor to effect a call to the factory's
* subscribe method.
*/
//#define Parser Parser
#define DECLARE_IMPLICIT_FUNCTION_PARSER(classname) \
namespace { \
Mantid::Kernel::RegistrationHelper register_alg_##classname( \
Expand Down
2 changes: 1 addition & 1 deletion Framework/API/inc/MantidAPI/LogarithmScale.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace API {

class MANTID_API_DLL LogarithmScale : public ITransformScale {
public:
LogarithmScale() : m_base(M_E){};
LogarithmScale() : m_base(M_E) {};
const std::string name() const override { return "LogarithmScale"; }
void transform(std::vector<double> &gd) override;
void setBase(const double base);
Expand Down
2 changes: 1 addition & 1 deletion Framework/API/inc/MantidAPI/ScriptRepository.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class MANTID_API_DLL ScriptRepoException : public std::exception {
public:
/// default constructor
ScriptRepoException(const std::string &info = std::string("Unknown Exception"))
: m_systemError(""), m_userInfo(info), m_filepath(""){};
: m_systemError(""), m_userInfo(info), m_filepath("") {};

ScriptRepoException(const std::string &info, const std::string &system, const std::string &file = std::string(),
int line = -1);
Expand Down
4 changes: 3 additions & 1 deletion Framework/API/src/AlgoTimeRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ AlgoTimeRegisterImpl::Dump::Dump(const std::string &nm)

AlgoTimeRegisterImpl::Dump::~Dump() {
const time_point_ns regFinish = std::chrono::high_resolution_clock::now();
{ AlgoTimeRegister::Instance().addTime(m_name, std::this_thread::get_id(), m_regStart_chrono, regFinish); }
{
AlgoTimeRegister::Instance().addTime(m_name, std::this_thread::get_id(), m_regStart_chrono, regFinish);
}
}

void AlgoTimeRegisterImpl::addTime(const std::string &name, const Kernel::time_point_ns &begin,
Expand Down
2 changes: 1 addition & 1 deletion Framework/API/src/Algorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ bool Algorithm::processGroups() {
"inherit from Property.");
}
} // not an empty (i.e. optional) input
} // for each InputWorkspace property
} // for each InputWorkspace property

std::vector<std::string> outputWSNames(m_pureOutputWorkspaceProps.size());
// ---------- Set all the output workspaces ----------------------------
Expand Down
2 changes: 1 addition & 1 deletion Framework/API/src/IFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ void IFunction::setMatrixWorkspace(std::shared_ptr<const API::MatrixWorkspace> w
<< ". Muparser error message is: " << e.GetMsg() << '\n';
}
} // end if
} // end trying to convert result-unit from formula or y-unit for
} // end trying to convert result-unit from formula or y-unit for
// lookuptable

setParameter(i, paramValue);
Expand Down
6 changes: 3 additions & 3 deletions Framework/API/src/IFunctionMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ void IFunctionMD::useAllDimensions(IMDWorkspace_const_sptr workspace) {

} // namespace Mantid::API

//#include "MantidAPI/ParamFunction.h"
//#include "MantidKernel/VMD.h"
// #include "MantidAPI/ParamFunction.h"
// #include "MantidKernel/VMD.h"
//
// using Mantid::Kernel::VMD;
// using Mantid::Kernel::VMD;

// namespace Mantid
//{
Expand Down
2 changes: 1 addition & 1 deletion Framework/API/src/NumericAxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Mantid::Kernel::Logger g_log("NumericAxis");

class EqualWithinTolerance {
public:
explicit EqualWithinTolerance(double tolerance) : m_tolerance(tolerance){};
explicit EqualWithinTolerance(double tolerance) : m_tolerance(tolerance) {};
/**
* This handles NaNs and infs differently than the FloatingPointComparison operations.
* If this is not necessary, then this entire class may be replaced with
Expand Down
2 changes: 1 addition & 1 deletion Framework/API/test/CompositeFunctionTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class CompositeFunctionTest_MocMatrixWorkspace : public MatrixWorkspace {
void init(const HistogramData::Histogram &) override {}
void generateHistogram(const std::size_t, const MantidVec &, MantidVec &, MantidVec &, bool) const override {}

void clearFileBacked(bool) override{};
void clearFileBacked(bool) override {};
ITableWorkspace_sptr makeBoxTable(size_t /* start*/, size_t /*num*/) override { return ITableWorkspace_sptr(); }

private:
Expand Down
6 changes: 2 additions & 4 deletions Framework/API/test/LiveListenerFactoryTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ class MockLiveListenerInstantiator : public Mantid::Kernel::Instantiator<MockLiv
*/
class FakeAlgorithm : public Algorithm {
public:
void exec() override { /*Do nothing*/
}
void init() override { /*Do nothing*/
}
void exec() override { /*Do nothing*/ }
void init() override { /*Do nothing*/ }
const std::string name() const override { return "FakeAlgorithm"; }
int version() const override { return 1; }
const std::string summary() const override { return ""; }
Expand Down
4 changes: 2 additions & 2 deletions Framework/API/test/ProjectionTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ class UnitColumn : public ColumnTester {

class GoodTable : public TableWorkspaceTester {
public:
GoodTable(){};
~GoodTable() override{};
GoodTable() {};
~GoodTable() override {};

size_t columnCount() const override { return 4; }
size_t rowCount() const override { return 3; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ class MANTID_ALGORITHMS_DLL AbsorptionCorrection : public API::Algorithm {
* be declared.
* Called by init().
*/
virtual void defineProperties() { /*Empty in base class*/
}
virtual void defineProperties() { /*Empty in base class*/ }
/// A virtual function in which additional properties should be retrieved into
/// member variables.
virtual void retrieveProperties() { /*Empty in base class*/
}
virtual void retrieveProperties() { /*Empty in base class*/ }
/// Returns the XML string describing the sample, which can be used by the
/// ShapeFactory
virtual std::string sampleXML() = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ struct DiscusData1D {
// separate vectors of X and Y rather than vector of pairs to mirror Histogram class and support edges\points
std::vector<double> X;
std::vector<double> Y;
DiscusData1D(){};
DiscusData1D() {};
DiscusData1D(std::vector<double> X, std::vector<double> Y) : X(std::move(X)), Y(std::move(Y)) {}
};

class DiscusData2D {
public:
DiscusData2D() : m_data(std::vector<DiscusData1D>{}), m_specAxis(nullptr){};
DiscusData2D() : m_data(std::vector<DiscusData1D>{}), m_specAxis(nullptr) {};
DiscusData2D(const std::vector<DiscusData1D> &data, const std::shared_ptr<std::vector<double>> &specAxis)
: m_data(data), m_specAxis(specAxis){};
: m_data(data), m_specAxis(specAxis) {};
std::unique_ptr<DiscusData2D> createCopy(bool clearY = false);
size_t getNumberHistograms() { return m_data.size(); }
DiscusData1D &histogram(const size_t i) { return m_data[i]; }
Expand Down
6 changes: 2 additions & 4 deletions Framework/Algorithms/inc/MantidAlgorithms/UnaryOperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@ class MANTID_ALGORITHMS_DLL UnaryOperation : public API::Algorithm {

/// A virtual function in which additional properties of an algorithm should
/// be declared. Called by init().
virtual void defineProperties() { /*Empty in base class*/
}
virtual void defineProperties() { /*Empty in base class*/ }
/// A virtual function in which additional properties should be retrieved into
/// member variables. Called by exec().
virtual void retrieveProperties() { /*Empty in base class*/
}
virtual void retrieveProperties() { /*Empty in base class*/ }

/** Carries out the Unary operation on the current 'cell'
* @param XIn :: The X value. This will be the bin centre for histogram
Expand Down
2 changes: 1 addition & 1 deletion Framework/Algorithms/src/CalculateTransmission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ API::MatrixWorkspace_sptr CalculateTransmission::fit(const API::MatrixWorkspace_

// Now fit this to a straight line
output = fitData(output, grad, offset);
} // logFit true
} // logFit true
else if (fitMethod == "Linear") { // Linear fit
g_log.debug("Fitting directly to the data (i.e. linearly)");
output = fitData(output, grad, offset);
Expand Down
2 changes: 1 addition & 1 deletion Framework/Algorithms/src/EQSANSTofStructure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void EQSANSTofStructure::execEvent(const Mantid::DataObjects::EventWorkspace_spt
}

double EQSANSTofStructure::getTofOffset(const EventWorkspace_const_sptr &inputWS, bool frame_skipping) {
//# Storage for chopper information read from the logs
// # Storage for chopper information read from the logs
double chopper_set_phase[4] = {0, 0, 0, 0};
double chopper_speed[4] = {0, 0, 0, 0};
double chopper_actual_phase[4] = {0, 0, 0, 0};
Expand Down
2 changes: 1 addition & 1 deletion Framework/Algorithms/src/GenerateEventsFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ void GenerateEventsFilter::setFilterByTimeOnly() {
if (breaklater)
break;
} // END-FOR
} // END-WHILE
} // END-WHILE
}
} // namespace Algorithms

Expand Down
2 changes: 1 addition & 1 deletion Framework/Algorithms/src/GetAllEi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ bool refineEGuess(const HistogramX &eBins, const HistogramY &signal, double &eGu
struct peakKeeper2 {
double left_rng;
double right_rng;
peakKeeper2() : left_rng(.0), right_rng(.0){};
peakKeeper2() : left_rng(.0), right_rng(.0) {};
peakKeeper2(double left, double right) : left_rng(left), right_rng(right) {}
};
} // namespace
Expand Down
8 changes: 4 additions & 4 deletions Framework/Algorithms/src/ModeratorTzero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void ModeratorTzero::exec() {
else if (emode == "Direct") {
outputWS->mutableX(i) += -t0_direct;
} // end of else if(emode="Direct")
} // end of if(L2 >= 0)
} // end of if(L2 >= 0)

prog.report();
PARALLEL_END_INTERRUPT_REGION
Expand Down Expand Up @@ -308,7 +308,7 @@ void ModeratorTzero::execEvent(const std::string &emode) {
evlist.setTofs(tofs);
evlist.setSortOrder(Mantid::DataObjects::EventSortType::UNSORTED);
} // end of if( t2>= 0)
} // end of if(emode=="Indirect")
} // end of if(emode=="Indirect")
else if (emode == "Elastic") {
// Apply t0 correction to histogram bins
auto &x = evlist.mutableX();
Expand Down Expand Up @@ -341,8 +341,8 @@ void ModeratorTzero::execEvent(const std::string &emode) {
evlist.setTofs(tofs);
evlist.setSortOrder(Mantid::DataObjects::EventSortType::UNSORTED);
} // end of else if(emode=="Direct")
} // end of if(L2 >= 0)
} // end of if (evlist.getNumberEvents() > 0)
} // end of if(L2 >= 0)
} // end of if (evlist.getNumberEvents() > 0)
prog.report();
PARALLEL_END_INTERRUPT_REGION
} // end of for (int i = 0; i < static_cast<int>(numHists); ++i)
Expand Down
2 changes: 1 addition & 1 deletion Framework/Algorithms/src/NormaliseToMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ void NormaliseToMonitor::normaliseBinByBin(const MatrixWorkspace_sptr &inputWork
// Now store the result
YOut[k] = newY;
} // end Workspace2D case
} // end loop over current spectrum
} // end loop over current spectrum

PARALLEL_END_INTERRUPT_REGION
} // end loop over spectra
Expand Down
4 changes: 2 additions & 2 deletions Framework/Algorithms/src/Rebin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ std::map<std::string, std::string> Rebin::validateInputs() {
helpMessages[PropertyNames::POWER] = "This binning is expected to give more than 10000 bins.";
}
} // end else
} // end else if
} // end if property power exists
} // end else if
} // end if property power exists
return helpMessages;
}

Expand Down
2 changes: 1 addition & 1 deletion Framework/Algorithms/src/ResampleX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ void ResampleX::exec() {
}
PARALLEL_CHECK_INTERRUPT_REGION
}
} // end if (m_preserveEvents)
} // end if (m_preserveEvents)
else // event workspace -> matrix workspace
{
//--------- Different output, OR you're inplace but not preserving Events
Expand Down
4 changes: 2 additions & 2 deletions Framework/Algorithms/test/CommutativeBinaryOperationTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ using namespace Mantid::API;
class CommutativeBinaryOpHelper : public Mantid::Algorithms::CommutativeBinaryOperation {
public:
/// Default constructor
CommutativeBinaryOpHelper() : CommutativeBinaryOperation(){};
CommutativeBinaryOpHelper() : CommutativeBinaryOperation() {};
/// Destructor
~CommutativeBinaryOpHelper() override{};
~CommutativeBinaryOpHelper() override {};
/// Algorithm's name for identification overriding a virtual method
const std::string name() const override { return "CommutativeBinaryOperationHelper"; }
/// Algorithm's version for identification overriding a virtual method
Expand Down
6 changes: 3 additions & 3 deletions Framework/Algorithms/test/FilterEventsTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ class FilterEventsTest : public CxxTest::TestSuite {
TofEvent tofevent = fakeevlist.getEvent(ievent);
elist.addEventQuickly(tofevent);
} // FOR each pulse
} // For each bank
} // For each bank

eventWS->mutableRun().integrateProtonCharge();

Expand Down Expand Up @@ -1624,7 +1624,7 @@ class FilterEventsTest : public CxxTest::TestSuite {
TofEvent tofevent = fakeevlist.getEvent(ievent);
elist.addEventQuickly(tofevent);
} // FOR each pulse
} // For each bank
} // For each bank

return eventWS;
}
Expand Down Expand Up @@ -1658,7 +1658,7 @@ class FilterEventsTest : public CxxTest::TestSuite {
TofEvent tofevent = fakeevlist.getEvent(ievent);
elist.addEventQuickly(tofevent);
} // FOR each pulse
} // For each bank
} // For each bank

return eventWS;
}
Expand Down
Loading
Loading