Skip to content

Commit 25a1a75

Browse files
committed
Added a bunch of style rules
1 parent 4fdc736 commit 25a1a75

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

.clang-tidy

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,29 @@ CheckOptions:
1313
value: '1'
1414
- key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
1515
value: '1'
16+
- key: readability-identifier-naming.ClassCase
17+
value: 'lower_case'
18+
- key: readability-identifier-naming.StructCase
19+
value: 'lower_case'
20+
- key: readability-identifier-naming.StructCase
21+
value: 'lower_case'
22+
- key: readability-identifier-naming.ParameterCase
23+
value: 'lower_case'
24+
- key: readability-identifier-naming.PrivateMemberCase
25+
value: 'lower_case'
26+
- key: readability-identifier-naming.LocalVariableCase
27+
value: 'lower_case'
28+
- key: readability-identifier-naming.TypeAliasCase
29+
value: 'lower_case'
30+
- key: readability-identifier-naming.UnionCase
31+
value: 'lower_case'
32+
- key: readability-identifier-naming.FunctionCase
33+
value: 'lower_case'
34+
- key: readability-identifier-naming.NamespaceCase
35+
value: 'lower_case'
36+
- key: readability-identifier-naming.GlobalConstantCase
37+
value: 'UPPER_CASE'
38+
- key: readability-identifier-naming.PrivateMemberPrefix
39+
value: 'm_'
1640

1741
...

include/aws/lambda-runtime/outcome.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ namespace lambda_runtime {
2323
template <typename TResult, typename TFailure>
2424
class outcome {
2525
public:
26-
outcome(TResult const& s) : s(s), success(true) {}
26+
outcome(TResult const& s) : s(s), m_success(true) {}
2727

28-
outcome(TFailure const& f) : f(f), success(false) {}
28+
outcome(TFailure const& f) : f(f), m_success(false) {}
2929

30-
outcome(outcome&& other) noexcept : success(other.success)
30+
outcome(outcome&& other) noexcept : m_success(other.m_success)
3131
{
32-
if (success) {
32+
if (m_success) {
3333
s = std::move(other.s);
3434
}
3535
else {
@@ -39,7 +39,7 @@ class outcome {
3939

4040
~outcome()
4141
{
42-
if (success) {
42+
if (m_success) {
4343
s.~TResult();
4444
}
4545
else {
@@ -49,24 +49,24 @@ class outcome {
4949

5050
TResult const& get_result() const
5151
{
52-
assert(success);
52+
assert(m_success);
5353
return s;
5454
}
5555

5656
TFailure const& get_failure() const
5757
{
58-
assert(!success);
58+
assert(!m_success);
5959
return f;
6060
}
6161

62-
bool is_success() const { return success; }
62+
bool is_success() const { return m_success; }
6363

6464
private:
6565
union {
6666
TResult s;
6767
TFailure f;
6868
};
69-
bool success;
69+
bool m_success;
7070
};
7171
} // namespace lambda_runtime
7272
} // namespace aws

src/runtime.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static size_t write_data(char* ptr, size_t size, size_t nmemb, void* userdata)
7272
// std::isspace has a few edge cases that would trigger UB. In particular, the documentation says:
7373
// "The behavior is undefined if the value of the input is not representable as unsigned char and is not equal to EOF."
7474
// So, this function does the simple obvious thing instead.
75-
static inline bool IsSpace(int ch)
75+
static inline bool is_whiltespace(int ch)
7676
{
7777
constexpr int space = 0x20; // space (0x20, ' ')
7878
constexpr int form_feed = 0x0c; // form feed (0x0c, '\f')
@@ -96,9 +96,9 @@ static inline bool IsSpace(int ch)
9696
static inline std::string trim(std::string s)
9797
{
9898
// trim right
99-
s.erase(std::find_if(s.rbegin(), s.rend(), [](int ch) { return !IsSpace(ch); }).base(), s.end());
99+
s.erase(std::find_if(s.rbegin(), s.rend(), [](int ch) { return !is_whiltespace(ch); }).base(), s.end());
100100
// trim left
101-
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int ch) { return !IsSpace(ch); }));
101+
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int ch) { return !is_whiltespace(ch); }));
102102
return s;
103103
}
104104

0 commit comments

Comments
 (0)