Skip to content

Commit e23e02a

Browse files
committed
cc taxi: enable enum readability-identifier-naming
commit_hash:230a80db3fab34ebbed9cea9c561ab1aa204128a
1 parent 6855482 commit e23e02a

File tree

33 files changed

+290
-289
lines changed

33 files changed

+290
-289
lines changed

.clang-tidy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ CheckOptions:
172172
value: CamelCase
173173
- key: readability-identifier-naming.StaticConstantPrefix
174174
value: k
175+
- key: readability-identifier-naming.EnumConstantCase
176+
value: CamelCase
177+
- key: readability-identifier-naming.EnumConstantPrefix
178+
value: k
175179
- key: readability-identifier-naming.MacroDefinitionCase
176180
value: UPPER_CASE
177181
- key: readability-identifier-naming.NamespaceCase

chaotic/integration_tests/tests/lib/array.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ TEST(Array, FromObjectShouldThrow) {
7979
UEXPECT_THROW_MSG(
8080
json.As<Arr>(),
8181
formats::json::TypeMismatchException,
82-
"Error at path '/': Wrong type. Expected: arrayValue, actual: objectValue"
82+
"Error at path '/': Wrong type. Expected: kArrayValue, actual: kObjectValue"
8383
);
8484
}
8585

chaotic/integration_tests/tests/lib/primitive.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ TEST(Primitive, WrongType) {
5454
try {
5555
const std::string x = kJson["foo"].As<String>();
5656
} catch (const std::exception& e) {
57-
EXPECT_EQ(
58-
std::string(e.what()),
59-
"Error at path 'foo': Wrong type. Expected: stringValue, actual: "
60-
"intValue"
61-
);
57+
EXPECT_EQ(std::string(e.what()), "Error at path 'foo': Wrong type. Expected: kStringValue, actual: kIntValue");
6258
}
6359
}
6460

core/include/userver/clients/http/response.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Response final {
4747
/// status_code
4848
Status status_code() const;
4949
/// check status code
50-
bool IsOk() const { return status_code() == Status::OK; }
50+
bool IsOk() const { return status_code() == Status::kOk; }
5151
bool IsError() const { return static_cast<uint16_t>(status_code()) >= 400; }
5252

5353
static void RaiseForStatus(int code, const LocalStats& stats);
@@ -65,7 +65,7 @@ class Response final {
6565
Headers headers_;
6666
CookiesMap cookies_;
6767
std::string response_;
68-
Status status_code_{Status::Invalid};
68+
Status status_code_{Status::kInvalid};
6969
LocalStats stats_;
7070
};
7171

core/include/userver/error_injection/hook.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,27 @@ class Hook final {
2323
/// @throws ErrorException in case of artificial error
2424
template <typename TimeoutException, typename ErrorException>
2525
void PreHook() {
26-
if (verdict_ == Verdict::Skip) {
26+
if (verdict_ == Verdict::kSkip) {
2727
// fast path
2828
return;
2929
}
3030

3131
switch (verdict_) {
32-
case Verdict::Error:
32+
case Verdict::kError:
3333
LOG_ERROR() << "Error injection hook triggered verdict: error";
3434
throw ErrorException{"error injection"};
3535

36-
case Verdict::Timeout:
36+
case Verdict::kTimeout:
3737
LOG_ERROR() << "Error injection hook triggered verdict: timeout";
3838
{
3939
auto scope_time = tracing::Span::CurrentSpan().CreateScopeTime("error_injection_timeout");
4040
engine::InterruptibleSleepUntil(deadline_);
4141
}
4242
throw TimeoutException{"error injection"};
4343

44-
case Verdict::MaxDelay:
45-
case Verdict::RandomDelay:
46-
case Verdict::Skip:
44+
case Verdict::kMaxDelay:
45+
case Verdict::kRandomDelay:
46+
case Verdict::kSkip:
4747
// pass
4848
;
4949
}
@@ -52,7 +52,7 @@ class Hook final {
5252
/// Must be called just after operation. May sleep for some time,
5353
/// or do nothing.
5454
void PostHook() {
55-
if (verdict_ == Verdict::Skip) {
55+
if (verdict_ == Verdict::kSkip) {
5656
// fast path
5757
return;
5858
}

core/include/userver/error_injection/settings.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ namespace error_injection {
1212

1313
/// What error injection hook may decide to do
1414
enum class Verdict {
15-
Error, ///< return error
16-
Timeout, ///< wait for deadline and return error
17-
MaxDelay, ///< wait for deadline w/o returning an error
18-
RandomDelay, ///< wait for [0; deadline] w/o returning an error
15+
kError, ///< return error
16+
kTimeout, ///< wait for deadline and return error
17+
kMaxDelay, ///< wait for deadline w/o returning an error
18+
kRandomDelay, ///< wait for [0; deadline] w/o returning an error
1919

2020
// Skip must be the last
2121

22-
Skip, ///< no error
22+
kSkip, ///< no error
2323
};
2424

2525
/// Artificial error injection settings

core/include/userver/utils/hedged_request.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace impl {
8989
using Clock = utils::datetime::SteadyClock;
9090
using TimePoint = Clock::time_point;
9191

92-
enum class Action { StartTry, Stop };
92+
enum class Action { kStartTry, kStop };
9393

9494
struct PlanEntry {
9595
public:
@@ -163,9 +163,9 @@ struct Context {
163163
void Prepare(TimePoint start_time) {
164164
const auto request_count = GetRequestsCount();
165165
for (std::size_t request_id = 0; request_id < request_count; ++request_id) {
166-
plan_.emplace(start_time, request_id, 0, Action::StartTry);
166+
plan_.emplace(start_time, request_id, 0, Action::kStartTry);
167167
}
168-
plan_.emplace(start_time + settings_.timeout_all, 0, 0, Action::Stop);
168+
plan_.emplace(start_time + settings_.timeout_all, 0, 0, Action::kStop);
169169
subrequests_.reserve(settings_.max_attempts * request_count);
170170
}
171171

@@ -264,7 +264,7 @@ struct Context {
264264
request_state.subrequest_indices.push_back(idx);
265265
input_by_subrequests_[idx] = request_index;
266266
attempts_made++;
267-
plan_.emplace(now + settings_.hedging_delay, request_index, attempts_made, Action::StartTry);
267+
plan_.emplace(now + settings_.hedging_delay, request_index, attempts_made, Action::kStartTry);
268268
}
269269

270270
/// Called on getting error in request with @param request_idx
@@ -277,7 +277,7 @@ struct Context {
277277
return;
278278
}
279279

280-
plan_.emplace(now + retry_delay, request_idx, request_state.attempts_made, Action::StartTry);
280+
plan_.emplace(now + retry_delay, request_idx, request_state.attempts_made, Action::kStartTry);
281281
}
282282

283283
void OnNonRetriableReply(std::size_t request_idx) { FinishAllSubrequests(request_idx); }
@@ -389,10 +389,10 @@ auto HedgeRequestsBulk(std::vector<RequestStrategy> inputs, HedgingSettings hedg
389389
}
390390
const auto [timestamp, request_index, attempt_id, action] = *plan_entry;
391391
switch (action) {
392-
case Action::StartTry:
392+
case Action::kStartTry:
393393
context.OnActionStartTry(request_index, attempt_id, timestamp);
394394
break;
395-
case Action::Stop:
395+
case Action::kStop:
396396
context.OnActionStop();
397397
break;
398398
}

core/src/clients/http/form_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ UTEST(CurlFormTest, MultipartFileWithContentType) {
120120
.timeout(std::chrono::milliseconds(100))
121121
.perform();
122122

123-
EXPECT_EQ(resp->status_code(), clients::http::Status::OK);
123+
EXPECT_EQ(resp->status_code(), clients::http::Status::kOk);
124124
}
125125

126126
UTEST(CurlFormTest, FilesWithContentType) {
@@ -141,7 +141,7 @@ UTEST(CurlFormTest, FilesWithContentType) {
141141
.timeout(std::chrono::milliseconds(100))
142142
.perform();
143143

144-
EXPECT_EQ(resp->status_code(), clients::http::Status::OK);
144+
EXPECT_EQ(resp->status_code(), clients::http::Status::kOk);
145145
}
146146

147147
UTEST(CurlFormTest, FormMovable) {
@@ -170,7 +170,7 @@ UTEST(CurlFormTest, FormMovable) {
170170
.timeout(std::chrono::milliseconds(100))
171171
.perform();
172172

173-
EXPECT_EQ(resp->status_code(), clients::http::Status::OK);
173+
EXPECT_EQ(resp->status_code(), clients::http::Status::kOk);
174174
}
175175

176176
USERVER_NAMESPACE_END

core/src/clients/http/request_state.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ void RequestState::ResetDataForNewRequest() {
974974
SetBaggageHeader(easy());
975975

976976
response_ = std::make_shared<Response>();
977-
response_->SetStatusCode(Status::InternalServerError);
977+
response_->SetStatusCode(Status::kInternalServerError);
978978

979979
is_cancelled_ = false;
980980
retry_.current = 1;

core/src/components/minimal_server_component_list_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ TEST_F(ServerMinimalComponentList, InvalidDynamicConfigParam) {
198198
const auto expected_exception_message = fmt::format(
199199
"Cannot start component dynamic-config: {} while parsing dynamic config "
200200
"USERVER_LOG_DYNAMIC_DEBUG. Error at path "
201-
"'USERVER_LOG_DYNAMIC_DEBUG.force-enabled': Wrong type. Expected: arrayValue, actual: intValue",
201+
"'USERVER_LOG_DYNAMIC_DEBUG.force-enabled': Wrong type. Expected: kArrayValue, actual: kIntValue",
202202
// NOTE: GetTypeName(typeid(T)) for old compilers.
203203
compiler::GetTypeName(typeid(formats::json::TypeMismatchException))
204204
);

0 commit comments

Comments
 (0)