Commit 6031b22f authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Run clang-tidy readability-redundant-* checks.

parent c6bb2fe1
......@@ -253,7 +253,7 @@ public:
*/
std::string isValid() const override {
// start with the no error condition
std::string error = "";
std::string error;
// If an output workspace it must have a name, although it might not exist
// in the ADS yet
......@@ -447,7 +447,7 @@ private:
* @returns A user level description of the problem or "" if it is valid.
*/
std::string isValidOutputWs() const {
std::string error("");
std::string error;
const std::string value = this->value();
if (!value.empty()) {
// Will the ADS accept it
......
......@@ -1243,7 +1243,7 @@ bool Algorithm::processGroups() {
// Set all non-workspace properties
this->copyNonWorkspaceProperties(alg, int(entry) + 1);
std::string outputBaseName = "";
std::string outputBaseName;
// ---------- Set all the input workspaces ----------------------------
for (size_t iwp = 0; iwp < m_groups.size(); iwp++) {
......
......@@ -361,7 +361,7 @@ AlgorithmFactoryImpl::getDescriptors(bool includeHidden) const {
boost::split(categoryLayers, desc.category, boost::is_any_of("\\"));
// Traverse each parent category, working our way from the top down.
std::string currentLayer = "";
std::string currentLayer;
for (auto &categoryLayer : categoryLayers) {
currentLayer.append(categoryLayer);
......
......@@ -11,7 +11,7 @@ AlgorithmHasProperty::AlgorithmHasProperty(const std::string &propName)
std::string AlgorithmHasProperty::checkValidity(
const boost::shared_ptr<IAlgorithm> &value) const {
std::string message("");
std::string message;
if (value->existsProperty(m_propName)) {
Kernel::Property *p = value->getProperty(m_propName);
if (!p->isValid().empty()) {
......
......@@ -121,7 +121,6 @@ IAlgorithm_sptr AlgorithmManagerImpl::create(const std::string &algName,
void AlgorithmManagerImpl::clear() {
std::lock_guard<std::mutex> _lock(this->m_managedMutex);
m_managed_algs.clear();
return;
}
std::size_t AlgorithmManagerImpl::size() const { return m_managed_algs.size(); }
......
......@@ -61,7 +61,7 @@ std::string AlgorithmProperty::getDefault() const { return ""; }
* contain the error
*/
std::string AlgorithmProperty::setValue(const std::string &value) {
std::string message("");
std::string message;
try {
Kernel::PropertyWithValue<IAlgorithm_sptr>::m_value =
Algorithm::fromString(value);
......
......@@ -42,7 +42,7 @@ AlgorithmProxy::~AlgorithmProxy() { delete m_executeAsync; }
/** Initialization method invoked by the framework.
* Does nothing for AlgorithmProxy as initialization is done in the constructor.
*/
void AlgorithmProxy::initialize() { return; }
void AlgorithmProxy::initialize() {}
AlgorithmID AlgorithmProxy::getAlgorithmID() const {
return AlgorithmID(const_cast<AlgorithmProxy *>(this));
......
......@@ -35,7 +35,7 @@ AnalysisDataServiceImpl::GroupUpdatedNotification::getWorkspaceGroup() const {
*/
const std::string
AnalysisDataServiceImpl::isValid(const std::string &name) const {
std::string error("");
std::string error;
const std::string &illegal = illegalCharacters();
if (illegal.empty())
return error; // Quick route out.
......
......@@ -197,7 +197,7 @@ std::string BoxController::toXMLString() const {
DOMWriter writer;
writer.writeNode(xmlstream, pDoc);
return xmlstream.str().c_str();
return xmlstream.str();
}
/** the function left for compartibility with the previous bc python interface.
@return -- the file name of the file used for backup if file backup mode is
......
......@@ -364,7 +364,7 @@ void Expression::logPrint(const std::string &pads) const {
void Expression::setFunct(const std::string &name) {
if (!op_prec(name)) {
std::string op = "";
std::string op;
if (name.size() > 1 && is_op_symbol(name[0])) {
op = name.substr(0, 1);
if (name.size() > 2 && is_op_symbol(name[1])) {
......
......@@ -680,7 +680,7 @@ std::string
FileFinderImpl::getArchivePath(const std::vector<IArchiveSearch_sptr> &archs,
const std::set<std::string> &filenames,
const std::vector<std::string> &exts) const {
std::string path = "";
std::string path;
for (const auto &arch : archs) {
try {
path = arch->getArchivePath(filenames, exts);
......
......@@ -167,7 +167,7 @@ std::string FileProperty::setValue(const std::string &propValue) {
// sure the
// directory exists for a Save property
if (Poco::Path(strippedValue).isAbsolute()) {
std::string error("");
std::string error;
if (isSaveProperty()) {
error = createDirectory(strippedValue);
if (!error.empty())
......@@ -177,7 +177,7 @@ std::string FileProperty::setValue(const std::string &propValue) {
return PropertyWithValue<std::string>::setValue(strippedValue);
}
std::string errorMsg("");
std::string errorMsg;
// For relative paths, differentiate between load and save types
if (isLoadProperty()) {
errorMsg = setLoadProperty(strippedValue);
......@@ -252,7 +252,7 @@ bool FileProperty::extsMatchRunFiles() {
*/
std::string FileProperty::setLoadProperty(const std::string &propValue) {
// determine the initial version of foundFile
std::string foundFile("");
std::string foundFile;
if ((propValue == m_oldLoadPropValue) && (!m_oldLoadFoundFile.empty())) {
foundFile = m_oldLoadFoundFile;
}
......@@ -317,7 +317,7 @@ std::string FileProperty::setSaveProperty(const std::string &propValue) {
} else
return "Empty filename not allowed.";
}
std::string errorMsg("");
std::string errorMsg;
// We have a relative save path so just prepend the path that is in the
// 'defaultsave.directory'
// Note that this catches the Poco::NotFoundException and returns an empty
......
......@@ -66,7 +66,7 @@ std::string FunctionProperty::getDefault() const { return ""; }
* @return Error message from FunctionFactory or "" on success.
*/
std::string FunctionProperty::setValue(const std::string &value) {
std::string error = "";
std::string error;
try {
m_value = boost::shared_ptr<IFunction>(
FunctionFactory::Instance().createInitialized(value));
......
......@@ -48,8 +48,6 @@ void IPowderDiffPeakFunction::setParameter(size_t i, const double &value,
m_hasNewParameterValue = true;
}
ParamFunction::setParameter(i, value, explicitlySet);
return;
}
//----------------------------------------------------------------------------------------------
......@@ -66,8 +64,6 @@ void IPowderDiffPeakFunction::setParameter(const std::string &name,
m_hasNewParameterValue = true;
}
ParamFunction::setParameter(name, value, explicitlySet);
return;
}
//----------------------------------------------------------------------------------------------
......@@ -105,8 +101,6 @@ void IPowderDiffPeakFunction::setHeight(const double h)
*/
void IPowderDiffPeakFunction::setHeight(const double h) {
setParameter(HEIGHTINDEX, h);
return;
}
//----------------------------------------------------------------------------------------------
......@@ -176,8 +170,6 @@ void IPowderDiffPeakFunction::setMillerIndex(int h, int k, int l) {
errmsg << "H = K = L = 0 is not allowed";
throw std::invalid_argument(errmsg.str());
}
return;
}
//----------------------------------------------------------------------------------------------
......@@ -187,8 +179,6 @@ void IPowderDiffPeakFunction::getMillerIndex(int &h, int &k, int &l) {
h = static_cast<int>(mH);
k = static_cast<int>(mK);
l = static_cast<int>(mL);
return;
}
//----------------------------------------------------------------------------------------------
......
......@@ -191,7 +191,6 @@ const std::set<detid_t> &ISpectrum::getDetectorIDs() const {
*/
void ISpectrum::clearDetectorIDs() {
this->detectorIDs.clear();
return;
}
// --------------------------------------------------------------------------
......
......@@ -117,8 +117,8 @@ bool MultiPeriodGroupWorker::useCustomWorkspaceProperty() const {
*/
std::string MultiPeriodGroupWorker::createFormattedInputWorkspaceNames(
const size_t &periodIndex, const VecWSGroupType &vecWorkspaceGroups) const {
std::string prefix = "";
std::string inputWorkspaces = "";
std::string prefix;
std::string inputWorkspaces;
for (const auto &vecWorkspaceGroup : vecWorkspaceGroups) {
inputWorkspaces += prefix + vecWorkspaceGroup->getItem(periodIndex)->name();
prefix = ",";
......
......@@ -297,7 +297,7 @@ MultipleFileProperty::setValueAsMultipleFiles(const std::string &propValue) {
// first, to make this easier.
std::vector<std::string> flattenedAllUnresolvedFileNames =
flattenFileNames(allUnresolvedFileNames);
std::string defaultExt = "";
std::string defaultExt;
auto unresolvedFileName = flattenedAllUnresolvedFileNames.begin();
for (; unresolvedFileName != flattenedAllUnresolvedFileNames.end();
++unresolvedFileName) {
......@@ -345,7 +345,7 @@ MultipleFileProperty::setValueAsMultipleFiles(const std::string &propValue) {
useDefaultExt = false;
}
std::string fullyResolvedFile = "";
std::string fullyResolvedFile;
if (!useDefaultExt) {
FileProperty slaveFileProp("Slave", "", FileProperty::Load, m_exts,
......
......@@ -107,7 +107,7 @@ const std::string
NotebookBuilder::buildAlgorithmString(AlgorithmHistory_const_sptr algHistory) {
std::ostringstream properties;
const std::string name = algHistory->name();
std::string prop = "";
std::string prop;
auto props = algHistory->getProperties();
for (auto &propIter : props) {
......@@ -165,7 +165,7 @@ NotebookBuilder::buildPropertyString(PropertyHistory_const_sptr propHistory) {
// Create a vector of all non workspace property type names
std::vector<std::string> nonWorkspaceTypes{"number", "boolean", "string"};
std::string prop = "";
std::string prop;
// No need to specify value for default properties
if (!propHistory->isDefault()) {
// Do not give values to output properties other than workspace properties
......
......@@ -136,7 +136,7 @@ const std::string
ScriptBuilder::buildAlgorithmString(AlgorithmHistory_const_sptr algHistory) {
std::ostringstream properties;
const std::string name = algHistory->name();
std::string prop = "";
std::string prop;
if (name == COMMENT_ALG)
return buildCommentString(algHistory);
......@@ -227,7 +227,7 @@ ScriptBuilder::buildPropertyString(PropertyHistory_const_sptr propHistory) {
// Create a vector of all non workspace property type names
std::vector<std::string> nonWorkspaceTypes{"number", "boolean", "string"};
std::string prop = "";
std::string prop;
// No need to specify value for default properties
if (!propHistory->isDefault()) {
// Do not give values to output properties other than workspace properties
......
......@@ -137,8 +137,6 @@ void WorkspaceFactoryImpl::initializeFromParent(
}
}
}
return;
}
/** Creates a new instance of the class with the given name, and allocates
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment