Skip to content

Commit

Permalink
checking naming via clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
opokatech committed Apr 4, 2024
1 parent 66f9ba0 commit 092ccdb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
15 changes: 15 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Checks: '-checks=-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,modernize-*,readability-*,
-bugprone-unchecked-optional-access,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-avoid-magic-numbers,
Expand Down Expand Up @@ -33,4 +34,18 @@ CheckOptions:
value: true
- key: modernize-use-override.IgnoreDestructors
value: 1
- key: readability-identifier-naming.ClassCase
value: Camel_Snake_Case
- key: readability-identifier-naming.ClassMemberCase
value: lower_case
- key: readability-identifier-naming.MemberPrefix
value: 'm_'
- key: readability-identifier-naming.ClassMethodCase
value: lower_case
- key: readability-identifier-naming.ConstexprVariableCase
value: UPPER_CASE
- key: readability-identifier-naming.StaticConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.LocalVariableCase
value: lower_case
...
1 change: 0 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
- make cross compilation work again
- consider removing ECB namespace
- consider using spdlog
- checking naming convention via clang-tidy
6 changes: 3 additions & 3 deletions src/Data_Loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace ECB
return {};
}

std::vector<Record> Data_Loader::load_from_url(const std::string &url, const std::string &save_to_file)
std::vector<Record> Data_Loader::load_from_url(const std::string &url, std::string_view save_to_file)
{
try
{
Expand All @@ -36,7 +36,7 @@ namespace ECB
{
if (!save_to_file.empty())
{
std::ofstream file(save_to_file);
std::ofstream file(save_to_file.data());
file << r.text;
file.close();
}
Expand Down Expand Up @@ -78,7 +78,7 @@ namespace ECB
auto root = doc.first_child(); // "gesmes:Envelope" is the name
auto cube = root.child("Cube"); // root of all currency data

const std::string BASE{"EUR"};
static const std::string BASE{"EUR"};
for (const auto &day_node: cube.children()) // each child is also "Cube"
{
std::string time = day_node.attribute("time").as_string();
Expand Down
2 changes: 1 addition & 1 deletion src/Data_Loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace ECB

// Load data from a url and return a vector of records.
// Returns an empty vector if the data could not be loaded.
static std::vector<Record> load_from_url(const std::string &url, const std::string &save_to_file = "");
static std::vector<Record> load_from_url(const std::string &url, std::string_view save_to_file = "");

private:
// Load data from a string and return a vector of records.
Expand Down
2 changes: 1 addition & 1 deletion src/Server_Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace ECB
if (uri->len != TEMPLATE.size())
return false;

// uri len is the same as the template
// uri len is the same as the TEMPLATE
for (size_t pos = 0; pos < uri->len; ++pos)
{
const char c = uri->ptr[pos];
Expand Down

0 comments on commit 092ccdb

Please sign in to comment.