Merge branch 'develop' into main
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2020-01-31 03:57:55 +01:00
commit fa1cbbeb91
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
5 changed files with 55 additions and 13 deletions

43
.clang-tidy Normal file
View File

@ -0,0 +1,43 @@
# -*- mode: conf; fill-column: 100; -*-
# Written for clang-tidy 9.
---
Checks: '*,
-cppcoreguidelines-non-private-member-variables-in-classes,
-fuchsia-default-arguments-calls,
-fuchsia-default-arguments-declarations,
-fuchsia-default-arguments,
-llvm-include-order,
-llvm-header-guard,
-misc-non-private-member-variables-in-classes,
-fuchsia-overloaded-operator,
-cppcoreguidelines-avoid-magic-numbers,
-readability-magic-numbers,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-hicpp-no-array-decay,
-modernize-avoid-c-arrays,
-cppcoreguidelines-avoid-c-arrays,
-hicpp-avoid-c-arrays,
-google-build-using-namespace,
-readability-named-parameter,
-google-runtime-references,
-hicpp-avoid-goto,
-hicpp-vararg,
-fuchsia-statically-constructed-objects,
-google-readability-todo,
-modernize-use-trailing-return-type'
CheckOptions: - { key: readability-identifier-naming.ClassCase, value: CamelCase }
# Clashes with constant private member prefix. (const int _var;)
# - { key: readability-identifier-naming.ConstantCase, value: lower_case }
- { key: readability-identifier-naming.EnumCase, value: lower_case }
- { key: readability-identifier-naming.FunctionCase, value: lower_case }
- { key: readability-identifier-naming.MemberCase, value: lower_case }
- { key: readability-identifier-naming.ParameterCase, value: lower_case }
- { key: readability-identifier-naming.PrivateMemberCase, value: lower_case }
- { key: readability-identifier-naming.PrivateMemberPrefix, value: _ }
- { key: readability-identifier-naming.ProtextedMemberCase, value: lower_case }
- { key: readability-identifier-naming.ProtectedMemberPrefix, value: _ }
- { key: readability-identifier-naming.StructCase, value: lower_case }
# Clashes with static private member prefix. (static int _var;)
# - { key: readability-identifier-naming.VariableCase, value: lower_case }
...

View File

@ -33,7 +33,6 @@ include(debug_flags)
if(WITH_CLANG-TIDY)
set(CMAKE_CXX_CLANG_TIDY
"clang-tidy"
"-p=build"
"-header-filter=${PROJECT_SOURCE_DIR}"
"-quiet")
endif()

View File

@ -39,11 +39,11 @@ using std::string_view;
*/
enum class http_method
{
GET,
POST,
PATCH,
PUT,
DELETE
GET, // NOLINT(readability-identifier-naming)
POST, // NOLINT(readability-identifier-naming)
PATCH, // NOLINT(readability-identifier-naming)
PUT, // NOLINT(readability-identifier-naming)
DELETE // NOLINT(readability-identifier-naming)
};
/*!
@ -172,7 +172,7 @@ protected:
*
* @since 0.1.0
*/
mutex buffer_mutex;
mutex _buffer_mutex;
/*!
* @brief Make a HTTP request.

View File

@ -68,17 +68,17 @@ answer_type Connection::del(const endpoint_variant &endpoint,
string Connection::get_new_stream_contents()
{
buffer_mutex.lock();
_buffer_mutex.lock();
auto &buffer{get_buffer()};
const string buffer_copy{buffer};
buffer.clear();
buffer_mutex.unlock();
_buffer_mutex.unlock();
return buffer_copy;
}
vector<event_type> Connection::get_new_events()
{
buffer_mutex.lock();
_buffer_mutex.lock();
auto &buffer{get_buffer()};
vector<event_type> events;
@ -103,7 +103,7 @@ vector<event_type> Connection::get_new_events()
buffer.erase(0, endpos);
}
buffer_mutex.unlock();
_buffer_mutex.unlock();
return events;
}

View File

@ -280,9 +280,9 @@ size_t CURLWrapper::writer_body(char *data, size_t size, size_t nmemb)
return 0;
}
buffer_mutex.lock();
_buffer_mutex.lock();
_curl_buffer_body.append(data, size * nmemb);
buffer_mutex.unlock();
_buffer_mutex.unlock();
return size * nmemb;
}