Skip to content

Commit

Permalink
clang-tidy: enable most abseil checks as errors (envoyproxy#7442)
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Argueta <dereka@pinterest.com>
  • Loading branch information
derekargueta authored and mattklein123 committed Jul 2, 2019
1 parent 7d5e6b2 commit 659805c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
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

0 comments on commit 659805c

Please sign in to comment.