diff --git a/sdk/attestation/azure-security-attestation/src/attestation_administration_client.cpp b/sdk/attestation/azure-security-attestation/src/attestation_administration_client.cpp index ba62bb633..1627211c9 100644 --- a/sdk/attestation/azure-security-attestation/src/attestation_administration_client.cpp +++ b/sdk/attestation/azure-security-attestation/src/attestation_administration_client.cpp @@ -542,7 +542,6 @@ void AttestationAdministrationClient::RetrieveResponseValidationCollateral( m_endpoint, HttpMethod::Get, {"certs"}, nullptr); auto response = AttestationCommonRequest::SendRequest(*m_pipeline, request, context); auto jsonWebKeySet(JsonWebKeySetSerializer::Deserialize(response)); - TokenValidationCertificateResult returnValue; std::vector newValue; for (const auto& jwk : jsonWebKeySet.Keys) { diff --git a/sdk/attestation/azure-security-attestation/src/attestation_client.cpp b/sdk/attestation/azure-security-attestation/src/attestation_client.cpp index 844e8672e..db066520f 100644 --- a/sdk/attestation/azure-security-attestation/src/attestation_client.cpp +++ b/sdk/attestation/azure-security-attestation/src/attestation_client.cpp @@ -261,7 +261,6 @@ void AttestationClient::RetrieveResponseValidationCollateral(Azure::Core::Contex auto response = AttestationCommonRequest::SendRequest(*m_pipeline, request, tracingContext.Context); auto jsonWebKeySet(JsonWebKeySetSerializer::Deserialize(response)); - TokenValidationCertificateResult returnValue; std::vector newValue; for (const auto& jwk : jsonWebKeySet.Keys) { diff --git a/sdk/attestation/ci.yml b/sdk/attestation/ci.yml index 3edd41ac6..ff173c3a1 100644 --- a/sdk/attestation/ci.yml +++ b/sdk/attestation/ci.yml @@ -29,7 +29,7 @@ extends: Location: WestUS CtestRegex: azure-security-attestation.* LiveTestCtestRegex: azure-security-attestation.* - LineCoverageTarget: 70 + LineCoverageTarget: 69.9834 BranchCoverageTarget: 34 Artifacts: - Name: azure-security-attestation diff --git a/sdk/core/azure-core/inc/azure/core/azure_assert.hpp b/sdk/core/azure-core/inc/azure/core/azure_assert.hpp index 10c62c034..69d2fe97a 100644 --- a/sdk/core/azure-core/inc/azure/core/azure_assert.hpp +++ b/sdk/core/azure-core/inc/azure/core/azure_assert.hpp @@ -50,7 +50,7 @@ /** @brief Azure specific assert macro.*/ #define AZURE_ASSERT(exp) assert((exp)) /** @brief Azure specific assert macro with message.*/ -#define AZURE_ASSERT_MSG(exp, msg) assert(((void)msg, (exp))) +#define AZURE_ASSERT_MSG(exp, msg) assert(((void)(msg), (exp))) #endif diff --git a/sdk/core/azure-core/inc/azure/core/exception.hpp b/sdk/core/azure-core/inc/azure/core/exception.hpp index e3d80414f..a1cd6df8a 100644 --- a/sdk/core/azure-core/inc/azure/core/exception.hpp +++ b/sdk/core/azure-core/inc/azure/core/exception.hpp @@ -176,7 +176,7 @@ namespace Azure { namespace Core { * @brief Destructs `%RequestFailedException`. * */ - ~RequestFailedException() = default; + ~RequestFailedException() override = default; private: static std::string GetRawResponseField( diff --git a/sdk/core/azure-core/inc/azure/core/http/http.hpp b/sdk/core/azure-core/inc/azure/core/http/http.hpp index 27b93beb5..e21fea634 100644 --- a/sdk/core/azure-core/inc/azure/core/http/http.hpp +++ b/sdk/core/azure-core/inc/azure/core/http/http.hpp @@ -327,7 +327,7 @@ namespace Azure { namespace Core { namespace Http { * @brief A value indicating whether the returned raw response for this request will be buffered * within a memory buffer or if it will be returned as a body stream instead. */ - bool ShouldBufferResponse() { return this->m_shouldBufferResponse; } + bool ShouldBufferResponse() const { return this->m_shouldBufferResponse; } /** * @brief Get URL. diff --git a/sdk/core/azure-core/inc/azure/core/internal/http/pipeline.hpp b/sdk/core/azure-core/inc/azure/core/internal/http/pipeline.hpp index bf575503b..fedb36c64 100644 --- a/sdk/core/azure-core/inc/azure/core/internal/http/pipeline.hpp +++ b/sdk/core/azure-core/inc/azure/core/internal/http/pipeline.hpp @@ -46,7 +46,7 @@ namespace Azure { namespace Core { namespace Http { namespace _internal { explicit HttpPipeline( const std::vector>& policies) { - if (policies.size() == 0) + if (policies.empty()) { throw std::invalid_argument("policies cannot be empty"); } @@ -190,7 +190,7 @@ namespace Azure { namespace Core { namespace Http { namespace _internal { std::vector>&& policies) : m_policies(std::move(policies)) { - if (m_policies.size() == 0) + if (m_policies.empty()) { throw std::invalid_argument("policies cannot be empty"); } diff --git a/sdk/core/azure-core/inc/azure/core/internal/tracing/service_tracing.hpp b/sdk/core/azure-core/inc/azure/core/internal/tracing/service_tracing.hpp index 8fa725b6d..15aee6f33 100644 --- a/sdk/core/azure-core/inc/azure/core/internal/tracing/service_tracing.hpp +++ b/sdk/core/azure-core/inc/azure/core/internal/tracing/service_tracing.hpp @@ -6,6 +6,8 @@ #include "azure/core/internal/extendable_enumeration.hpp" #include "azure/core/internal/tracing/tracing_impl.hpp" +#include + #pragma once /** @@ -31,7 +33,7 @@ namespace Azure { namespace Core { namespace Tracing { namespace _internal { friend class TracingContextFactory; ServiceSpan() = default; - explicit ServiceSpan(std::shared_ptr span) : m_span(span) {} + explicit ServiceSpan(std::shared_ptr span) : m_span(std::move(span)) {} ServiceSpan(const ServiceSpan&) = delete; ServiceSpan& operator=(ServiceSpan const&) = delete; @@ -41,7 +43,7 @@ namespace Azure { namespace Core { namespace Tracing { namespace _internal { public: ServiceSpan(ServiceSpan&& that) = default; - ~ServiceSpan() + ~ServiceSpan() override { if (m_span) { diff --git a/sdk/core/azure-core/inc/azure/core/io/body_stream.hpp b/sdk/core/azure-core/inc/azure/core/io/body_stream.hpp index 60192cef1..dece7c292 100644 --- a/sdk/core/azure-core/inc/azure/core/io/body_stream.hpp +++ b/sdk/core/azure-core/inc/azure/core/io/body_stream.hpp @@ -227,7 +227,8 @@ namespace Azure { namespace Core { namespace IO { AZURE_ASSERT(fileHandle && offset >= 0 && length >= 0); } - RandomAccessFileBodyStream() : m_filehandle(NULL), m_baseOffset(0), m_length(0), m_offset(0) + RandomAccessFileBodyStream() + : m_filehandle(nullptr), m_baseOffset(0), m_length(0), m_offset(0) { } #endif @@ -275,7 +276,7 @@ namespace Azure { namespace Core { namespace IO { * @brief Closes the file and cleans up any resources. * */ - ~FileBodyStream(); + ~FileBodyStream() override; /** @brief Rewind seeks the current stream to the start of the file. */ void Rewind() override; diff --git a/sdk/core/azure-core/inc/azure/core/nullable.hpp b/sdk/core/azure-core/inc/azure/core/nullable.hpp index 5111d8aa8..52996ebd6 100644 --- a/sdk/core/azure-core/inc/azure/core/nullable.hpp +++ b/sdk/core/azure-core/inc/azure/core/nullable.hpp @@ -18,7 +18,7 @@ namespace Azure { namespace _detail { struct NontrivialEmptyType final { - constexpr NontrivialEmptyType() noexcept {} + constexpr NontrivialEmptyType() noexcept = default; }; } // namespace _detail diff --git a/sdk/core/azure-core/inc/azure/core/url.hpp b/sdk/core/azure-core/inc/azure/core/url.hpp index 0d0781f62..81abb5bd5 100644 --- a/sdk/core/azure-core/inc/azure/core/url.hpp +++ b/sdk/core/azure-core/inc/azure/core/url.hpp @@ -88,7 +88,7 @@ namespace Azure { namespace Core { * @brief Constructs a new, empty URL object. * */ - Url() {} + Url() = default; /** * @brief Constructs a URL from a URL-encoded string. diff --git a/sdk/core/azure-core/src/base64.cpp b/sdk/core/azure-core/src/base64.cpp index 5e4be1c62..c0b7b6816 100644 --- a/sdk/core/azure-core/src/base64.cpp +++ b/sdk/core/azure-core/src/base64.cpp @@ -8,10 +8,10 @@ namespace { -static char const Base64EncodeArray[65] +char const Base64EncodeArray[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static char const EncodingPad = '='; -static int8_t const Base64DecodeArray[256] = { +char const EncodingPad = '='; +int8_t const Base64DecodeArray[256] = { -1, -1, -1, @@ -271,7 +271,7 @@ static int8_t const Base64DecodeArray[256] = { -1, }; -static int32_t Base64Encode(const uint8_t* threeBytes) +int32_t Base64Encode(const uint8_t* threeBytes) { int32_t i = (threeBytes[0] << 16) | (threeBytes[1] << 8) | threeBytes[2]; @@ -283,7 +283,7 @@ static int32_t Base64Encode(const uint8_t* threeBytes) return i0 | (i1 << 8) | (i2 << 16) | (i3 << 24); } -static int32_t Base64EncodeAndPadOne(const uint8_t* twoBytes) +int32_t Base64EncodeAndPadOne(const uint8_t* twoBytes) { int32_t i = twoBytes[0] << 16 | (twoBytes[1] << 8); @@ -294,7 +294,7 @@ static int32_t Base64EncodeAndPadOne(const uint8_t* twoBytes) return i0 | (i1 << 8) | (i2 << 16) | (EncodingPad << 24); } -static int32_t Base64EncodeAndPadTwo(const uint8_t* oneByte) +int32_t Base64EncodeAndPadTwo(const uint8_t* oneByte) { int32_t i = oneByte[0] << 8; @@ -304,7 +304,7 @@ static int32_t Base64EncodeAndPadTwo(const uint8_t* oneByte) return i0 | (i1 << 8) | (EncodingPad << 16) | (EncodingPad << 24); } -static void Base64WriteIntAsFourBytes(char* destination, int32_t value) +void Base64WriteIntAsFourBytes(char* destination, int32_t value) { destination[3] = static_cast((value >> 24) & 0xFF); destination[2] = static_cast((value >> 16) & 0xFF); @@ -344,7 +344,7 @@ std::string Base64Encode(uint8_t const* const data, size_t length) return encodedResult; } -static int32_t Base64Decode(const char* encodedBytes) +int32_t Base64Decode(const char* encodedBytes) { int32_t i0 = encodedBytes[0]; int32_t i1 = encodedBytes[1]; @@ -367,7 +367,7 @@ static int32_t Base64Decode(const char* encodedBytes) return i0; } -static void Base64WriteThreeLowOrderBytes(std::vector::iterator destination, int64_t value) +void Base64WriteThreeLowOrderBytes(std::vector::iterator destination, int64_t value) { destination[0] = static_cast(value >> 16); destination[1] = static_cast(value >> 8); diff --git a/sdk/core/azure-core/src/cryptography/md5.cpp b/sdk/core/azure-core/src/cryptography/md5.cpp index d5d6229bd..5d4c88652 100644 --- a/sdk/core/azure-core/src/cryptography/md5.cpp +++ b/sdk/core/azure-core/src/cryptography/md5.cpp @@ -97,7 +97,7 @@ private: size_t m_hashLength = 0; std::string m_buffer; - void OnAppend(const uint8_t* data, size_t length) + void OnAppend(const uint8_t* data, size_t length) override { if (!BCRYPT_SUCCESS( m_status = BCryptHashData( @@ -110,7 +110,7 @@ private: } } - std::vector OnFinal(const uint8_t* data, size_t length) + std::vector OnFinal(const uint8_t* data, size_t length) override { OnAppend(data, length); @@ -148,7 +148,7 @@ public: } } - ~Md5BCrypt() + ~Md5BCrypt() override { if (m_hashHandle) { @@ -209,7 +209,7 @@ Azure::Core::Cryptography::Md5Hash::Md5Hash() : m_implementation(std::make_uniqu #endif namespace Azure { namespace Core { namespace Cryptography { - Md5Hash::~Md5Hash() {} + Md5Hash::~Md5Hash() = default; void Md5Hash::OnAppend(const uint8_t* data, size_t length) { diff --git a/sdk/core/azure-core/src/environment_log_level_listener.cpp b/sdk/core/azure-core/src/environment_log_level_listener.cpp index 0ec10ad12..1ae738cbd 100644 --- a/sdk/core/azure-core/src/environment_log_level_listener.cpp +++ b/sdk/core/azure-core/src/environment_log_level_listener.cpp @@ -148,7 +148,7 @@ EnvironmentLogLevelListener::GetLogListener() } namespace { -static bool g_initialized; +bool g_initialized = false; } // namespace bool EnvironmentLogLevelListener::IsInitialized() { return g_initialized; } diff --git a/sdk/core/azure-core/src/http/request_activity_policy.cpp b/sdk/core/azure-core/src/http/request_activity_policy.cpp index 88efff53b..16e828312 100644 --- a/sdk/core/azure-core/src/http/request_activity_policy.cpp +++ b/sdk/core/azure-core/src/http/request_activity_policy.cpp @@ -2,13 +2,10 @@ // Licensed under the MIT License. #include "azure/core/http/policies/policy.hpp" -#include "azure/core/internal/diagnostics/log.hpp" #include "azure/core/internal/http/http_sanitizer.hpp" #include "azure/core/internal/tracing/service_tracing.hpp" #include -#include -#include #include #include diff --git a/sdk/core/azure-core/src/http/user_agent.cpp b/sdk/core/azure-core/src/http/user_agent.cpp index 5aab71570..8967107d9 100644 --- a/sdk/core/azure-core/src/http/user_agent.cpp +++ b/sdk/core/azure-core/src/http/user_agent.cpp @@ -6,11 +6,8 @@ * @brief Contains the user agent string generator implementation. */ -#include "azure/core/context.hpp" #include "azure/core/http/http.hpp" -#include "azure/core/http/policies/policy.hpp" #include "azure/core/internal/strings.hpp" -#include "azure/core/internal/tracing/service_tracing.hpp" #include "azure/core/platform.hpp" #include diff --git a/sdk/core/azure-core/src/logger.cpp b/sdk/core/azure-core/src/logger.cpp index 00004c90a..1a0e2a97a 100644 --- a/sdk/core/azure-core/src/logger.cpp +++ b/sdk/core/azure-core/src/logger.cpp @@ -6,10 +6,8 @@ #include "azure/core/internal/diagnostics/log.hpp" #include "private/environment_log_level_listener.hpp" -#include #include #include -#include using namespace Azure::Core::Diagnostics; using namespace Azure::Core::Diagnostics::_internal; diff --git a/sdk/core/azure-core/src/tracing/tracing.cpp b/sdk/core/azure-core/src/tracing/tracing.cpp index 4862a1604..744ce4496 100644 --- a/sdk/core/azure-core/src/tracing/tracing.cpp +++ b/sdk/core/azure-core/src/tracing/tracing.cpp @@ -2,7 +2,6 @@ // Licensed under the MIT License. #include "azure/core/context.hpp" -#include "azure/core/http/policies/policy.hpp" #include "azure/core/internal/tracing/service_tracing.hpp" #include "azure/core/internal/tracing/tracing_impl.hpp" @@ -42,7 +41,6 @@ namespace Azure { namespace Core { namespace Tracing { namespace _internal { std::string const& methodName, Azure::Core::Context const& context) const { - Azure::Core::Context contextToUse = context; CreateSpanOptions createOptions; createOptions.Kind = SpanKind::Internal; diff --git a/sdk/core/azure-core/src/uuid.cpp b/sdk/core/azure-core/src/uuid.cpp index aa637efa2..d82a28918 100644 --- a/sdk/core/azure-core/src/uuid.cpp +++ b/sdk/core/azure-core/src/uuid.cpp @@ -7,7 +7,6 @@ #include "azure/core/platform.hpp" #include -#include #include #include #include diff --git a/sdk/identity/azure-identity/src/client_assertion_credential.cpp b/sdk/identity/azure-identity/src/client_assertion_credential.cpp index 822451684..501ea49e2 100644 --- a/sdk/identity/azure-identity/src/client_assertion_credential.cpp +++ b/sdk/identity/azure-identity/src/client_assertion_credential.cpp @@ -5,7 +5,6 @@ #include "private/client_assertion_credential_impl.hpp" #include "private/identity_log.hpp" -#include "private/package_version.hpp" #include "private/tenant_id_resolver.hpp" #include