With Trunk in CI disabled, try Alpine again.

This commit is contained in:
Kyle Isom 2023-10-22 03:24:36 -07:00
parent c5308dedba
commit 8868fe40a1
4 changed files with 19 additions and 32 deletions

View File

@ -3,7 +3,7 @@ version: 2.1
jobs:
ctest:
docker:
- image: git.wntrmute.dev/sc/dev:main
- image: git.wntrmute.dev/sc/dev:alpine
steps:
- checkout
- run:
@ -12,19 +12,8 @@ jobs:
- run:
name: Valgrind checks.
command: cmake-run-valgrind.sh
NOT_REQUIRED_static_analysis:
docker:
- image: git.wntrmute.dev/sc/dev:main
steps:
- checkout
- run:
name: Trunk check
command: ./trunk check --upstream=HEAD^
workflows:
ctest:
jobs:
- ctest
static_analysis:
jobs:
- NOT_REQUIRED_static_analysis

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.22)
project(scsl LANGUAGES CXX
VERSION 0.2.5
VERSION 1.0.0
DESCRIPTION "Shimmering Clarity Standard Library")
set(CMAKE_CXX_STANDARD 14)

View File

@ -89,7 +89,7 @@ public:
///
/// \param prefix The prefix to prepend to the key when looking
/// up values from the environment.
static void SetPrefixGlobal(const std::string prefix);
static void SetPrefixGlobal(const std::string &prefix);
/// \brief Return the keys cached in the config.
///
@ -108,7 +108,7 @@ public:
/// \param key The key to look up. See the class documentation
/// for information on how this is used.
/// \return The value stored under the key, or an empty string.
static std::string GetGlobal(std::string key);
static std::string GetGlobal(std::string &key);
/// \brief Get the value stored for the key from the config.
///
@ -120,7 +120,7 @@ public:
/// value is stored under the key.
/// \return The value stored under the key, or the default
/// value.
static std::string GetGlobal(std::string key, std::string defaultValue);
static std::string GetGlobal(std::string &key, const std::string &defaultValue);
#endif
/// \brief The constructor doesn't need any initialisation.
@ -128,7 +128,7 @@ public:
/// \brief The constructor can explicitly set the environment
/// prefix.
SimpleConfig(std::string prefix);
explicit SimpleConfig(std::string &prefix);
/// \brief Load key-value pairs from a file.
///
@ -146,7 +146,7 @@ public:
///
/// \param prefix The prefix to prepend to the key when looking
/// up values from the environment.
void SetPrefix(const std::string prefix);
void SetPrefix(const std::string &prefix);
/// \brief Return the keys cached in the config.
///
@ -161,7 +161,7 @@ public:
/// \param key The key to look up. See the class documentation
/// for information on how this is used.
/// \return The value stored under the key, or an empty string.
std::string Get(std::string key);
std::string Get(std::string &key);
/// \brief Get the value stored for the key from the config.
///
@ -171,7 +171,7 @@ public:
/// value is stored under the key.
/// \return The value stored under the key, or the default
/// value.
std::string Get(std::string key, std::string defaultValue);
std::string Get(std::string &key, std::string defaultValue);
private:
std::string envPrefix;

View File

@ -63,7 +63,7 @@ SimpleConfig::LoadGlobal(std::string &path)
void
SimpleConfig::SetPrefixGlobal(const std::string prefix)
SimpleConfig::SetPrefixGlobal(const std::string &prefix)
{
globalConfig.SetPrefix(prefix);
}
@ -77,14 +77,14 @@ SimpleConfig::KeyListGlobal()
std::string
SimpleConfig::GetGlobal(std::string key)
SimpleConfig::GetGlobal(std::string &key)
{
return globalConfig.Get(key);
}
std::string
SimpleConfig::GetGlobal(std::string key, std::string defaultValue)
SimpleConfig::GetGlobal(std::string &key, const std::string &defaultValue)
{
return globalConfig.Get(key, defaultValue);
}
@ -95,7 +95,7 @@ SimpleConfig::SimpleConfig()
}
SimpleConfig::SimpleConfig(std::string prefix)
SimpleConfig::SimpleConfig(std::string &prefix)
: envPrefix(prefix)
{
}
@ -140,21 +140,21 @@ SimpleConfig::Load(std::string &path)
void
SimpleConfig::SetPrefix(const std::string prefix)
SimpleConfig::SetPrefix(const std::string &prefix)
{
this->envPrefix = std::move(prefix);
}
std::string
SimpleConfig::Get(std::string key)
SimpleConfig::Get(std::string &key)
{
return this->Get(key, "");
}
std::string
SimpleConfig::Get(std::string key, std::string defaultValue)
SimpleConfig::Get(std::string &key, std::string defaultValue)
{
if (this->vars.count(key)) {
return this->vars[key];
@ -168,7 +168,7 @@ SimpleConfig::Get(std::string key, std::string defaultValue)
return this->Get(key);
}
this->vars[key] = defaultValue;
this->vars[key] = std::move(defaultValue);
return this->Get(key);
}
@ -178,10 +178,8 @@ SimpleConfig::KeyList()
{
std::vector<std::string> keyList;
for (auto &entry : this->vars) {
keyList.push_back(entry.first);
}
std::transform(this->vars.begin(), this->vars.end(), std::back_inserter(keyList),
[](std::pair<std::string, std::string> pair){return pair.first;});
return keyList;
}