Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-tidy: enable most abseil checks as errors #7442

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
Checks: 'clang-diagnostic-*,clang-analyzer-*,abseil-*,bugprone-*,modernize-*,performance-*,readability-redundant-*,readability-braces-around-statements,readability-container-size-empty'
Checks: 'abseil-*,
bugprone-*,
clang-analyzer-*,
clang-diagnostic-*,
modernize-*,
performance-*,
readability-braces-around-statements,
readability-container-size-empty'
readability-redundant-*,

#TODO(lizan): grow this list, fix possible warnings and make more checks as error
WarningsAsErrors: 'bugprone-assert-side-effect,bugprone-use-after-move,modernize-make-shared,modernize-make-unique,modernize-use-using,performance-faster-string-find,performance-for-range-copy,performance-noexcept-move-constructor,performance-unnecessary-copy-initialization,readability-braces-around-statements,readability-container-size-empty,readability-redundant-smartptr-get,readability-redundant-string-cstr'
WarningsAsErrors: 'abseil-duration-*,
abseil-faster-strsplit-delimiter,
abseil-no-namespace,
abseil-redundant-strcat-calls,
abseil-str-cat-append,
abseil-string-find-startswith,
abseil-upgrade-duration-conversions,
bugprone-assert-side-effect,
bugprone-use-after-move,
modernize-make-shared,
modernize-make-unique,
modernize-use-using,
performance-faster-string-find,
performance-for-range-copy,
performance-noexcept-move-constructor,
performance-unnecessary-copy-initialization,
readability-braces-around-statements,
readability-container-size-empty,
readability-redundant-smartptr-get,
readability-redundant-string-cstr'

CheckOptions:
- key: bugprone-assert-side-effect.AssertMacros
Expand Down
2 changes: 1 addition & 1 deletion source/common/upstream/health_checker_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ HttpHealthCheckerImpl::HttpActiveHealthCheckSession::healthCheckResult() {
response_headers_->EnvoyUpstreamHealthCheckedCluster()->value().getStringView())
: EMPTY_STRING;

if (service_cluster_healthchecked.find(parent_.service_name_.value()) == 0) {
if (absl::StartsWith(service_cluster_healthchecked, parent_.service_name_.value())) {
return degraded ? HealthCheckResult::Degraded : HealthCheckResult::Succeeded;
} else {
return HealthCheckResult::Failed;
Expand Down
4 changes: 3 additions & 1 deletion test/integration/utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "test/test_common/printers.h"
#include "test/test_common/utility.h"

#include "absl/strings/match.h"

namespace Envoy {
void BufferingStreamDecoder::decodeHeaders(Http::HeaderMapPtr&& headers, bool end_stream) {
ASSERT(!complete_);
Expand Down Expand Up @@ -140,7 +142,7 @@ Network::FilterStatus WaitForPayloadReader::onData(Buffer::Instance& data, bool
data_.append(data.toString());
data.drain(data.length());
read_end_stream_ = end_stream;
if ((!data_to_wait_for_.empty() && data_.find(data_to_wait_for_) == 0) ||
if ((!data_to_wait_for_.empty() && absl::StartsWith(data_, data_to_wait_for_)) ||
(exact_match_ == false && data_.find(data_to_wait_for_) != std::string::npos) || end_stream) {
data_to_wait_for_.clear();
dispatcher_.exit();
Expand Down