Skip to content

Commit

Permalink
Correct typos in source code
Browse files Browse the repository at this point in the history
Also, remove some commented code.
  • Loading branch information
marcosbento committed Dec 11, 2023
1 parent 7a6ac8c commit 76d0d7b
Show file tree
Hide file tree
Showing 22 changed files with 49 additions and 56 deletions.
2 changes: 1 addition & 1 deletion ACore/src/ecflow/core/Calendar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class Calendar {

private:
// Note: The *only* reason to serialise the calendar is so that we can support
// why() command on the client side. By default calendar is initialised in the *server*
// why() command on the client side. By default, calendar is initialised in the *server*
// at begin time, from the clock attribute
friend class cereal::access;
template <class Archive>
Expand Down
4 changes: 0 additions & 4 deletions ACore/src/ecflow/core/EcfPortLock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class EcfPortLock {

static void create(const std::string& the_port) {
std::string the_file = port_file(the_port);
// std::cout << "EcfPortLock::create " << the_file << "
// ---------------------------------------------------\n";
std::string errorMsg;
if (!ecf::File::create(the_file, "", errorMsg)) {
std::stringstream sb;
Expand All @@ -54,8 +52,6 @@ class EcfPortLock {

static void remove(const std::string& the_port) {
std::string the_file = port_file(the_port);
// std::cout << "EcfPortLock::remove " << the_file << "
// --------------------------------------------------\n";
fs::remove(the_file);
}

Expand Down
8 changes: 4 additions & 4 deletions ACore/src/ecflow/core/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ bool File::splitFileIntoLines(const std::string& filename, std::vector<std::stri
// tokenizer tokens(file_iter,end_of_stream, sep);
// std::copy(tokens.begin(), tokens.end(), back_inserter(lines));

// The current implementation is 2.5 times faster then method 1, and ~4 times faster than method 2
// The current implementation is 2.5 times faster than method 1, and ~4 times faster than method 2
return true;
}

Expand Down Expand Up @@ -239,7 +239,7 @@ bool File::open(const std::string& filePath, std::string& contents) {
}

bool File::create(const std::string& filename, const std::vector<std::string>& lines, std::string& errorMsg) {
// For very large file. This is about 1 second quicker. Than using streams
// For very large file. This is about 1 second quicker. Then using streams
// See Test: TestFile.cpp:test_file_create_perf
FILE* theFile = fopen(filename.c_str(), "w");
if (theFile == nullptr) {
Expand Down Expand Up @@ -504,7 +504,7 @@ bool File::createMissingDirectories(const std::string& pathToFileOrDir) {
// pathToFileOrDir is of form: /tmp/fred/sms.job
// we should only create directories for /tmp/fred
if (thePath.back().find(".") != std::string::npos) {
// assume the last token represents a file, hence dont create a directory
// assume the last token represents a file, hence don't create a directory
#ifdef INTEL_DEBUG_ME
std::cout << " last file " << thePath.back() << " has a *dot* ignoring " << std::endl;
#endif
Expand Down Expand Up @@ -650,7 +650,7 @@ std::string File::diff(const std::string& file,
std::string
File::backwardSearch(const std::string& rootPath, const std::string& nodePath, const std::string& fileExtn) {
// Do a backward search of rootPath + nodePath
// If task path if of the form /suite/family/family2/task, then we keep
// If task path is of the form /suite/family/family2/task, then we keep
// on consuming the first path token this should leave:
// <root-path>/suite/family/family2/task.ecf
// <root-path>/family/family2/task.ecf
Expand Down
2 changes: 1 addition & 1 deletion ACore/src/ecflow/core/Host.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Host {

private:
std::string host_port_prefix(const std::string& port) const;
void get_host_name(); // will cache host name, to avoid multiple sysm calls
void get_host_name(); // will cache host name, to avoid multiple system calls
std::string the_host_name_;
};

Expand Down
8 changes: 4 additions & 4 deletions ACore/src/ecflow/core/LogVerification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ bool LogVerification::compareNodeStates(const std::string& logfile,
if (i < lines.size() && i < goldenLines.size()) {

if (lines[i] != goldenLines[i]) {
// Please note that we can't do an exact compare for certain state changes
// submitted -->active
// active -->complete
// Please note that we can't do an exact comparison for certain state changes:
// - submitted --> active
// - active --> complete
// Since this can be OS/scheduler dependent and hence order dependent
// To compensate look search Golden file
// To compensate, we search for a Golden file
if (lines[i].second == "submitted" || lines[i].second == "active" ||
lines[i].second == "complete") {
// search for line in golden file
Expand Down
4 changes: 2 additions & 2 deletions ACore/src/ecflow/core/NState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class access;

// NState: stores the state of a node.
// *The class NState just used to define the enum, however we also
// needed to know when the state changed. Hence the use of state_change_no
// needed to know when the state changed. Hence, the use of state_change_no
// Uses default copy constructor and destructor, and equality
//
// The default_state() should *NEVER* change as it will affect client/server comms
// The default_state() should *NEVER* change as it will impact client/server communications
//
class NState {
public:
Expand Down
2 changes: 1 addition & 1 deletion ACore/src/ecflow/core/PasswdFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ bool PasswdFile::createWithAccess(const std::string& pathToFile,
bool PasswdFile::clear(const std::string& pathToFile, std::string& errorMsg) {
std::vector<std::string> lines;
if (File::splitFileIntoLines(pathToFile, lines, true /* ignore empty lines */)) {
// Just leave the version. i.e the first line.
// Just leave the version, i.e. the first line.
if (lines.size() > 1) {
lines.erase(lines.begin() + 1, lines.end());

Expand Down
6 changes: 3 additions & 3 deletions ACore/src/ecflow/core/PasswdFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ class Pass_wd {
std::string user_;
std::string host_;
std::string port_;
std::string passwd_; // always stored as crypted
std::string passwd_; // always stored as ciphertext
};

// This class is used to authenticate, user commands, i.e like ping,alter, etc
// This class is used to authenticate, user commands, i.e. like ping,alter, etc
class PasswdFile {
public:
PasswdFile();
Expand All @@ -59,7 +59,7 @@ class PasswdFile {
// to be called by the server, to at least one user with given host and port
bool check_at_least_one_user_with_host_and_port(const std::string& host, const std::string& port);

// get the password for the given user, host and port. Otherwise return a empty string
// get the password for the given user, host and port. Otherwise, return an empty string
std::string get_passwd(const std::string& user, const std::string& host, const std::string& port);

// authenticate the user, given the password.
Expand Down
3 changes: 1 addition & 2 deletions ACore/src/ecflow/core/Pid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

class Pid {
public:
/// Returns the current Process ID (as a string);
/// otherwise, throws exception(std::runtime_error)
/// Returns the current Process ID (as a string); otherwise, throws exception(std::runtime_error)
static std::string getpid();

/// Returns a unique name, based on Process ID, composed of prefix + '_' + getpid();
Expand Down
2 changes: 0 additions & 2 deletions ACore/src/ecflow/core/PrintStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ PrintStyle::Type_t PrintStyle::getStyle() {
}

void PrintStyle::setStyle(PrintStyle::Type_t f) {
// std::cout << "PrintStyle::setStyle() BEFORE " << PrintStyle::to_string(style_) << " AFTER " <<
// PrintStyle::to_string(f) << " *********************\n";
style_ = f;
}

Expand Down
4 changes: 2 additions & 2 deletions ACore/src/ecflow/core/PrintStyle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
class PrintStyle {
public:
// Use to control the print defs/node output to string or file
// Please note: with PrintStyle::NET is used to transfer Defs between client <->server
// Please note: with PrintStyle::NET is used to transfer Defs between client <-> server
// as such there is no need extensive checking on recreating defs.
// i.e valid name, duplicate nodes, etc
// i.e. valid name, duplicate nodes, etc
enum Type_t {
// Does nothing
NOTHING = 0,
Expand Down
1 change: 0 additions & 1 deletion ACore/src/ecflow/core/SerializationTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ void do_restore(const std::string& fileName, const T& saved) {
BOOST_CHECK_MESSAGE(false, "Restore failed because: " << e.what());
}
BOOST_CHECK_MESSAGE(saved == restored, "save and restored don't match for " << fileName << "\n");
// BOOST_CHECK_MESSAGE(saved == restored," save and restored don't match\n" << saved << "\n" << restored );
}

template <typename T>
Expand Down
4 changes: 2 additions & 2 deletions ACore/src/ecflow/core/Str.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ void Str::removeSingleQuotes(std::string& s) {
}
}

bool Str::replace(std::string& jobLine, const std::string& stringToFind, const std::string& stringToRplace) {
bool Str::replace(std::string& jobLine, const std::string& stringToFind, const std::string& stringToReplace) {
size_t pos = jobLine.find(stringToFind);
if (pos != string::npos) {
jobLine.replace(pos, stringToFind.length(), stringToRplace);
jobLine.replace(pos, stringToFind.length(), stringToReplace);
return true;
}
return false;
Expand Down
14 changes: 7 additions & 7 deletions ACore/src/ecflow/core/Str.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ class Str {
// fred -> fred
static void removeSingleQuotes(std::string&);

/// Find 'stringToFind' in 'jobLine' and replace with string 'stringToRplace'
/// Find 'stringToFind' in 'jobLine' and replace with string 'stringToReplace'
/// return true if replace ok else returns false;
static bool replace(std::string& subject, const std::string& stringToFind, const std::string& stringToRplace);
static bool replace_all(std::string& subject, const std::string& stringToFind, const std::string& stringToRplace);
static void replaceall(std::string& subject, const std::string& stringToFind, const std::string& stringToRplace);
static bool replace(std::string& subject, const std::string& stringToFind, const std::string& stringToReplace);
static bool replace_all(std::string& subject, const std::string& stringToFind, const std::string& stringToReplace);
static void replaceall(std::string& subject, const std::string& stringToFind, const std::string& stringToReplace);

// extract data member value, ie given a string of the form:
// str=cmd a b fred:value
Expand Down Expand Up @@ -130,10 +130,10 @@ class Str {
/// case in sensitive string comparison
static bool caseInsCompare(const std::string&, const std::string&);

/// case insenstive less
/// case insensitive less
static bool caseInsLess(const std::string&, const std::string&);

/// case insenstive Greater
/// case insensitive Greater
static bool caseInsGreater(const std::string&, const std::string&);

/// Used for checking node names
Expand All @@ -159,7 +159,7 @@ class Str {
/// Only use strcmp if the first characters are the same
static int local_strcmp(const char* s, const char* t) { return (*s != *t ? *s - *t : strcmp(s, t)); }

// returns a static string of alpha numerics and underscore
// returns a static string of alphanumerics and underscore
static const std::string& ALPHANUMERIC_UNDERSCORE();

// returns a static string of numerics chars
Expand Down
7 changes: 4 additions & 3 deletions ACore/src/ecflow/core/StringSplitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@ void StringSplitter::split(const std::string& str,
}
}

void StringSplitter::split2(std::string_view str, std::vector<std::string_view>& ret, const char* delims) {
void StringSplitter::split2(std::string_view str, std::vector<std::string_view>& ret, const char* delimiters) {
std::string_view::size_type start = 0;
auto pos = str.find_first_of(delims, start);

auto pos = str.find_first_of(delimiters, start);
while (pos != std::string_view::npos) {
if (pos != start) {
ret.emplace_back(str.substr(start, pos - start));
}
start = pos + 1;
pos = str.find_first_of(delims, start);
pos = str.find_first_of(delimiters, start);
}
if (start < str.length())
ret.emplace_back(str.substr(start, str.length() - start));
Expand Down
2 changes: 1 addition & 1 deletion ACore/src/ecflow/core/StringSplitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace ecf {
// IMPORTANT: std::string_view is a *READ ONLY* REFERENCE to an existing string
// HENCE: the reference string *MUST* not change, and its lifetime must EXCEED string_view
//
// Will split a string. Will return a empty std::string_view if there a separator at the end.
// Will split a string. Will return an empty std::string_view if there's a separator at the end.
// This shows the fastest split for a string. **** Based on boost 1.64 ****
// Method: time
// boost::split: 4.06
Expand Down
8 changes: 4 additions & 4 deletions ACore/src/ecflow/core/TimeSeries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ bool TimeSeries::calendarChanged(const ecf::Calendar& c) {
}
else if (c.dayChanged()) {

// Clear expired flag and next slot. Needed since requue will expire flag when past time slot
// Hence we need something to reset. Otherwise for next day isFree will always return false;
// Clear expired flag and next slot. Needed since requeuing will expire flag when pastime slot
// Hence we need something to reset. Otherwise, for next day isFree will always return false;
isValid_ = true;
nextTimeSlot_ = start_;
return true;
Expand Down Expand Up @@ -419,7 +419,7 @@ bool TimeSeries::checkForRequeue(const ecf::Calendar& calendar,
const TimeSlot& the_max,
bool cmd_context) const {
// ************************************************************************
// THIS IS CALLED IN THE CONTEXT WHERE NODE HAS COMPLETED. Hence ****asyncronous****
// THIS IS CALLED IN THE CONTEXT WHERE NODE HAS COMPLETED. Hence ****asynchronous****
// RETURNING TRUE FROM HERE WILL FORCE NODE TO QUEUED STATE
// HENCE THIS FUNCTION MUST RETURN FALSE, WHEN END OF TIME SLOT HAS BEEN REACHED/expired
// The resolution is in minutes
Expand Down Expand Up @@ -465,7 +465,7 @@ bool TimeSeries::checkForRequeue(const ecf::Calendar& calendar,
// we use >= specifically for unit test, to pass.
if (suiteTimeNow >= suiteTimeAtReque_) {
// normal flow, i.e same day
suiteTimeAtReque_ = TimeSlot(); // make NULL, allow reque to reset.
suiteTimeAtReque_ = TimeSlot(); // make NULL, allow requeuing to reset.
}
else {
// The day changed between (requeue/reset):->queued->submitted->active->complete->(checkForRequeue)
Expand Down
8 changes: 4 additions & 4 deletions ACore/src/ecflow/core/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ namespace ecf {
// The version number is extracted externally.
// see ACore/doc/extracting_version_number.ddoc
//
// See ACore/src/ecflow_version.h"
// This file is generated when cmake is run, i.e
// sh -x $WK/cmake.sh debug
// See ACore/src/ecflow_version.h
// This file is generated when cmake is run, i.e.
// `sh -x $WK/cmake.sh debug`
//
// When changing the version change remember to:
// - re-login into remote system to update ECFLOW_INSTALL_DIR & ECFLOW_PYTHON_INSTALL_DIR
Expand All @@ -36,7 +36,7 @@ namespace ecf {
// To Install a new version on all the different platforms:
// . build_scripts/nightly/quick_install_.sh
// This is because the definition hold's the last version.
// Hence we must rerun to update the version.
// Hence, we must rerun to update the version.
//
// ************************************************************************************
// Use <minor_number>rc<number> for release candidates, Once release we revert back:
Expand Down
4 changes: 2 additions & 2 deletions ACore/src/ecflow/core/WhiteListFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ bool WhiteListFile::verify_write_access(const std::string& user, const std::vect

static bool path_access(const std::vector<std::string>& paths, const std::vector<std::string>& allowed_paths) {
if (allowed_paths.empty())
return true; // no paths is specified in PASSWORD file allow access
return true; // no paths are specified in PASSWORD file allow access

// Paths specified in PASSWORD file.
if (paths.empty())
return false; // INPUT user path empty deny access

// when we have a set of paths, supplied the the GUI. These can be random path selections
// when we have a set of paths, supplied by the GUI. These can be random path selections
// Hence to allow access *ALL* paths need to pass access
//
// need to correctly check for subsets
Expand Down
4 changes: 2 additions & 2 deletions ACore/src/ecflow/core/WhiteListFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ class WhiteListFile {
~WhiteListFile();

// If any user in read/write lists, then it has read access.
// However when paths are specified teh returns may not me the same. i.e
// However, when paths are specified the returns may not be the same. i.e,
// verify_read_access("userX") != verify_read_access("userX","/f")
// This is is because different commands, call different functions:
// Hence if we have:
// verify_read_access(userX) verify_read_access(userX,'/f') verify_read_access(userX,'/s1')
// userX /s1 TRUE FALSE TRUE
// -userX /s2 TRUE FALSE FALSE
//
// If we also add * in the mix: All users have read/write acess to suite /a, and read access to /b
// If we also add * in the mix: All users have read/write access to suite `/a`, and read access to `/b`
// * /a
// -* /b
// userX /s1
Expand Down
2 changes: 1 addition & 1 deletion ACore/src/ecflow/core/perf_timer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <string>
#include <vector>

// remove when we use c++17
// TODO: remove when we use c++17
template <typename F, typename... Args>
auto invoke(F f, Args&&... args) -> decltype(std::ref(f)(std::forward<Args>(args)...)) {
return std::ref(f)(std::forward<Args>(args)...);
Expand Down
6 changes: 3 additions & 3 deletions Base/src/ecflow/base/cts/user/AlterCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ void AlterCmd::extract_name_and_value_for_delete(AlterCmd::Delete_attr_type theA

std::vector<std::string> altered_path = paths;
if (options.size() == 4) {
// User has provide a limit path which does not start with '/'. Go with flow
// User has provided a limit path which does not start with '/'. Go with flow
path_value = options[3];
}
else {
Expand Down Expand Up @@ -1260,7 +1260,7 @@ void AlterCmd::extract_name_and_value_for_change(AlterCmd::Change_attr_type theA
else {
// ECFLOW-480 take into account label values that is a path, adding quotes around the value does not
// help: Note boost program options will remove the quotes around the value
// hence its difficult to say what is an option and what is a path.
// hence it's difficult to say what is an option and what is a path.
// However since we expect 4(change,label,<label_name>,<label_value>) options, work around the
// problem
if (options.size() == 3 && paths.size() > 1) {
Expand Down Expand Up @@ -1422,7 +1422,7 @@ void AlterCmd::check_for_change(AlterCmd::Change_attr_type theAttrType,
try {
int day, month, year;
DateAttr::getDate(name, day, month, year);
DateAttr::checkDate(day, month, year, false /* for clocks we don't allow wild carding */);
DateAttr::checkDate(day, month, year, false /* for clocks, we don't allow wild carding */);
}
catch (std::exception& e) {
ss << "AlterCmd:change clock_date " << name << " is not valid. " << e.what();
Expand Down

0 comments on commit 76d0d7b

Please sign in to comment.