From 8e58d65ddfa14a0ab13f656bef6424b1f3a4796b Mon Sep 17 00:00:00 2001 From: oprypin Date: Tue, 21 Mar 2017 07:52:41 -0700 Subject: [PATCH] Make lint errors fatal in presubmit and fix files in whitelisted paths BUG=webrtc:5149 Review-Url: https://codereview.webrtc.org/2762963002 Cr-Commit-Position: refs/heads/master@{#17323} --- PRESUBMIT.py | 4 +--- webrtc/api/rtcerror.h | 8 ++++---- .../modules/remote_bitrate_estimator/bwe_simulations.cc | 4 ++-- webrtc/modules/remote_bitrate_estimator/test/bwe.h | 2 +- webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc | 3 ++- .../codecs/test/mock/mock_packet_manipulator.h | 3 +-- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 72e4326fe4..03a77b2868 100755 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -255,9 +255,7 @@ def _CheckApprovedFilesLintClean(input_api, output_api, if cpplint._cpplint_state.error_count > 0: if input_api.is_committing: - # TODO(kjellander): Change back to PresubmitError below when we're - # confident with the lint settings. - res_type = output_api.PresubmitPromptWarning + res_type = output_api.PresubmitError else: res_type = output_api.PresubmitPromptWarning result = [res_type('Changelist failed cpplint.py check.')] diff --git a/webrtc/api/rtcerror.h b/webrtc/api/rtcerror.h index 2ba78371eb..5cb123227d 100644 --- a/webrtc/api/rtcerror.h +++ b/webrtc/api/rtcerror.h @@ -203,7 +203,7 @@ class RTCErrorOr { // is marked 'explicit' to try to catch cases like 'return {};', where people // think RTCErrorOr> will be initialized with an empty // vector, instead of a RTCErrorType::INTERNAL_ERROR error. - explicit RTCErrorOr() : error_(RTCErrorType::INTERNAL_ERROR) {} + RTCErrorOr() : error_(RTCErrorType::INTERNAL_ERROR) {} // Constructs a new RTCErrorOr with the given non-ok error. After calling // this constructor, calls to value() will DCHECK-fail. @@ -213,7 +213,7 @@ class RTCErrorOr { // RTCError(...)' when the return type is RTCErrorOr. // // REQUIRES: !error.ok(). This requirement is DCHECKed. - RTCErrorOr(RTCError&& error) : error_(std::move(error)) { + RTCErrorOr(RTCError&& error) : error_(std::move(error)) { // NOLINT RTC_DCHECK(!error.ok()); } @@ -224,7 +224,7 @@ class RTCErrorOr { // NOTE: Not explicit - we want to use RTCErrorOr as a return type // so it is convenient and sensible to be able to do 'return T()' // when the return type is RTCErrorOr. - RTCErrorOr(T&& value) : value_(std::move(value)) {} + RTCErrorOr(T&& value) : value_(std::move(value)) {} // NOLINT // Delete the copy constructor and assignment operator; there aren't any use // cases where you should need to copy an RTCErrorOr, as opposed to moving @@ -248,7 +248,7 @@ class RTCErrorOr { // Conversion constructor and assignment operator; T must be copy or move // constructible from U. template - RTCErrorOr(RTCErrorOr other) + RTCErrorOr(RTCErrorOr other) // NOLINT : error_(std::move(other.error_)), value_(std::move(other.value_)) {} template RTCErrorOr& operator=(RTCErrorOr other) { diff --git a/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc b/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc index 485f7522a0..cff7e70c5d 100644 --- a/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc +++ b/webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc @@ -66,10 +66,10 @@ TEST_P(BweSimulation, Verizon4gDownlinkTest) { AdaptiveVideoSource source(0, 30, 300, 0, 0); VideoSender sender(&downlink_, &source, GetParam()); RateCounterFilter counter1(&downlink_, 0, "sender_output", - bwe_names[GetParam()] + "_up"); + std::string() + bwe_names[GetParam()] + "_up"); TraceBasedDeliveryFilter filter(&downlink_, 0, "link_capacity"); RateCounterFilter counter2(&downlink_, 0, "Receiver", - bwe_names[GetParam()] + "_down"); + std::string() + bwe_names[GetParam()] + "_down"); PacketReceiver receiver(&downlink_, 0, GetParam(), true, true); ASSERT_TRUE(filter.Init(test::ResourcePath("verizon4g-downlink", "rx"))); RunFor(22 * 60 * 1000); diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe.h b/webrtc/modules/remote_bitrate_estimator/test/bwe.h index 4f87d391d9..89a28acb4e 100644 --- a/webrtc/modules/remote_bitrate_estimator/test/bwe.h +++ b/webrtc/modules/remote_bitrate_estimator/test/bwe.h @@ -180,7 +180,7 @@ enum BandwidthEstimatorType { kTcpEstimator }; -const std::string bwe_names[] = {"Null", "NADA", "REMB", "GCC", "TCP"}; +const char* const bwe_names[] = {"Null", "NADA", "REMB", "GCC", "TCP"}; int64_t GetAbsSendTimeInMs(uint32_t abs_send_time); diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc index 467da37f3f..6d0ed5f289 100644 --- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc +++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc @@ -769,7 +769,8 @@ void BweTest::RunLongTcpFairness(BandwidthEstimatorType bwe_type) { // max_delay_ms = 1000; std::string title("5.6_Long_TCP_Fairness"); - std::string flow_name(bwe_names[bwe_type] + 'x' + bwe_names[kTcpEstimator]); + std::string flow_name = std::string() + + bwe_names[bwe_type] + 'x' + bwe_names[kTcpEstimator]; RunFairnessTest(bwe_type, kNumRmcatFlows, kNumTcpFlows, kRunTimeS, kCapacityKbps, max_delay_ms, rtt_ms, kMaxJitterMs, kOffSetsMs, diff --git a/webrtc/modules/video_coding/codecs/test/mock/mock_packet_manipulator.h b/webrtc/modules/video_coding/codecs/test/mock/mock_packet_manipulator.h index 4096a93216..f00302ef30 100644 --- a/webrtc/modules/video_coding/codecs/test/mock/mock_packet_manipulator.h +++ b/webrtc/modules/video_coding/codecs/test/mock/mock_packet_manipulator.h @@ -11,10 +11,9 @@ #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_MOCK_MOCK_PACKET_MANIPULATOR_H_ #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_MOCK_MOCK_PACKET_MANIPULATOR_H_ -#include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h" - #include +#include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h" #include "webrtc/test/gmock.h" #include "webrtc/typedefs.h" #include "webrtc/video_frame.h"