Skip to content

refactor: Replace Arduino HTTP Client with esp native#391

Draft
hhvrc wants to merge 39 commits into
developfrom
feature/ditch-arduino-httpclient
Draft

refactor: Replace Arduino HTTP Client with esp native#391
hhvrc wants to merge 39 commits into
developfrom
feature/ditch-arduino-httpclient

Conversation

@hhvrc

@hhvrc hhvrc commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@hhvrc hhvrc added this to the ESP-IDF milestone Dec 4, 2025
@hhvrc hhvrc self-assigned this Dec 4, 2025
@github-project-automation github-project-automation Bot moved this to Todo in Roadmap Dec 4, 2025
@changeset-bot

changeset-bot Bot commented Dec 4, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 03ad6f8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request replaces the Arduino HTTP Client library with the ESP-IDF native HTTP client implementation. The change represents a significant architectural shift towards using ESP32's built-in networking capabilities, improving platform integration and potentially reducing dependency on third-party libraries.

Key Changes:

  • Introduced new HTTP client architecture with HTTPClient, HTTPClientState, HTTPResponse, and JsonResponse classes
  • Replaced string_view URL parameters with const char* for HTTP client APIs
  • Refactored rate limiting into a separate RateLimiters module
  • Removed the old HTTPRequestManager implementation and replaced all usages throughout the codebase

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/util/DomainUtils.cpp New utility to extract domain from URL (critical bug: missing assignment on line 11)
src/util/ParitionUtils.cpp Updated to use new HTTP client; logic error in status code check (line 63)
src/serialization/JsonAPI.cpp Removed unused code parameter from JSON parsing functions
src/serial/command_handlers/domain.cpp Updated to use new HTTP client with error handling
src/serial/command_handlers/authtoken.cpp Updated to use new HTTP client in scoped block
src/serial/SerialInputHandler.cpp Removed unused import
src/http/RateLimiters.cpp New rate limiter management module extracted from old implementation
src/http/JsonAPI.cpp Refactored to use new HTTP client, simplified header setting
src/http/HTTPRequestManager.cpp Deleted - replaced by new implementation
src/http/HTTPClientState.cpp New ESP-IDF HTTP client state management (bug in constructor initialization line 21, log message bug line 181)
src/http/HTTPClient.cpp New HTTP client facade providing Get and GetJson methods
src/OtaUpdateManager.cpp Updated all HTTP requests to use new client
src/GatewayConnectionManager.cpp Updated API calls to use new HTTP client with improved error handling
include/util/PartitionUtils.h Changed parameter type from string_view to const char*
include/util/DomainUtils.h New header for domain extraction utility
include/serialization/JsonAPI.h Updated parsing function signatures to remove code parameter, forward declared cJSON
include/http/*.h New HTTP client interface headers (HTTPError.h has critical bug: empty error strings)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/util/DomainUtils.cpp Outdated
Comment thread src/util/DomainUtils.cpp Outdated
Comment thread src/util/DomainUtils.cpp Outdated
Comment thread src/util/ParitionUtils.cpp Outdated
Comment thread include/http/HTTPError.h Outdated
Comment thread src/util/DomainUtils.cpp Outdated
Comment thread src/util/DomainUtils.cpp Outdated
Comment thread src/util/DomainUtils.cpp Outdated
Comment thread include/http/HTTPClient.h Outdated
Comment thread src/http/HTTPClientState.cpp Outdated
hhvrc and others added 4 commits December 5, 2025 14:07
@hhvrc hhvrc requested review from LucHeart and nullstalgia December 5, 2025 13:46
hhvrc and others added 5 commits December 5, 2025 14:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@hhvrc hhvrc added the status: blocked An issue that is blocked by another issue or dependency label Dec 9, 2025
@hhvrc

hhvrc commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author

Cannot merge until we switch over to ESP-IDF due to inability configure global certs when arduino es-idf framework has precompiled binaries

@hhvrc hhvrc changed the title feat: Replace Arduino HTTP Client with esp native refactor: Replace Arduino HTTP Client with esp native Dec 9, 2025
@LucHeart LucHeart requested a review from Copilot December 15, 2025 14:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 11 comments.

Comments suppressed due to low confidence (1)

platformio.ini:48

  • These configuration flags completely disable SSL/TLS certificate verification, making all HTTPS connections vulnerable to man-in-the-middle attacks. This is a serious security vulnerability that should not be enabled in production code.

Consider using proper certificate validation with either a CA bundle or certificate pinning instead of disabling verification entirely.

  -DCONFIG_ESP_TLS_INSECURE=y
  -DCONFIG_ESP_TLS_SKIP_SERVER_CERT_VERIFY=y

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread include/http/HTTPClient.h
Comment on lines +20 to +23
HTTPClient(const char* url, uint32_t timeoutMs = 10'000)
: m_state(std::make_shared<HTTPClientState>(url, timeoutMs))
{
}

Copilot AI Dec 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new HTTPClient implementation does not integrate with the rate limiting system. The old implementation called _getRateLimiter() and checked rateLimiter->tryRequest() before making requests. Without this integration, the application may exceed API rate limits and get blocked by the server. Consider integrating the RateLimiters::GetRateLimiter functionality into the HTTPClient.

Copilot uses AI. Check for mistakes.
Comment thread src/OtaUpdateManager.cpp Outdated
Comment thread src/GatewayConnectionManager.cpp Outdated
OS_LOGE(TAG, "Unexpected response code: %d", response.code);
auto content = response.ReadJson();
if (content.error != HTTP::HTTPError::None) {
OS_LOGE(TAG, "Error while reading response: %s %d", HTTP::HTTPErrorToString(response.Error()), response.StatusCode());

Copilot AI Dec 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue - using response.Error() when the error occurred during content reading. Should use content.error instead.

Suggested change
OS_LOGE(TAG, "Error while reading response: %s %d", HTTP::HTTPErrorToString(response.Error()), response.StatusCode());
OS_LOGE(TAG, "Error while reading response: %s %d", HTTP::HTTPErrorToString(content.error), response.StatusCode());

Copilot uses AI. Check for mistakes.
Comment thread src/GatewayConnectionManager.cpp Outdated
OS_LOGE(TAG, "Unexpected response code: %d", response.code);
auto content = response.ReadJson();
if (content.error != HTTP::HTTPError::None) {
OS_LOGE(TAG, "Error while reading response: %s %d", HTTP::HTTPErrorToString(response.Error()), response.StatusCode());

Copilot AI Dec 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue - using response.Error() when the error occurred during content reading. Should use content.error instead.

Suggested change
OS_LOGE(TAG, "Error while reading response: %s %d", HTTP::HTTPErrorToString(response.Error()), response.StatusCode());
OS_LOGE(TAG, "Error while reading response: %s %d", HTTP::HTTPErrorToString(content.error), response.StatusCode());

Copilot uses AI. Check for mistakes.
Comment thread src/http/HTTPClientState.cpp Outdated
OS_LOGI(TAG, "Successfully connected to \"%.*s\", version: %s, commit: %s, current time: %s", arg.length(), arg.data(), resp.data.version.c_str(), resp.data.commit.c_str(), resp.data.currentTime.c_str());
auto content = response.ReadJson();
if (content.error != OpenShock::HTTP::HTTPError::None) {
SERPR_ERROR("Tried to read response from backend, but failed (%s), refusing to save domain to config", OpenShock::HTTP::HTTPErrorToString(response.Error()));

Copilot AI Dec 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message calls response.Error() but should call content.error since the error occurred during the ReadJson operation, not during the initial request. The response's Error() method may not reflect the actual error that occurred during content reading.

Suggested change
SERPR_ERROR("Tried to read response from backend, but failed (%s), refusing to save domain to config", OpenShock::HTTP::HTTPErrorToString(response.Error()));
SERPR_ERROR("Tried to read response from backend, but failed (%s), refusing to save domain to config", OpenShock::HTTP::HTTPErrorToString(content.error));

Copilot uses AI. Check for mistakes.
Comment thread src/OtaUpdateManager.cpp Outdated
Comment thread src/OtaUpdateManager.cpp Outdated

auto content = response.ReadString();
if (content.error != HTTP::HTTPError::None) {
OS_LOGE(TAG, "Failed to fetch firmware version: %s [%u] %s", HTTP::HTTPErrorToString(response.Error()), response.StatusCode(), content.data.c_str());

Copilot AI Dec 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as line 444 - attempting to log content.data.c_str() when content.error indicates an error occurred. The content data may be empty or invalid in this case.

Suggested change
OS_LOGE(TAG, "Failed to fetch firmware version: %s [%u] %s", HTTP::HTTPErrorToString(response.Error()), response.StatusCode(), content.data.c_str());
OS_LOGE(TAG, "Failed to fetch firmware version: %s [%u]", HTTP::HTTPErrorToString(response.Error()), response.StatusCode());

Copilot uses AI. Check for mistakes.
Comment thread src/GatewayConnectionManager.cpp Outdated
OS_LOGE(TAG, "Unexpected response code: %d", response.code);
auto content = response.ReadJson();
if (content.error != HTTP::HTTPError::None) {
OS_LOGE(TAG, "Error while reading response: %s %d", HTTP::HTTPErrorToString(response.Error()), response.StatusCode());

Copilot AI Dec 15, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message calls response.Error() when the error actually occurred during ReadJson(), so it should reference content.error instead. The response's Error() method will likely return HTTPError::None since the initial request succeeded.

Suggested change
OS_LOGE(TAG, "Error while reading response: %s %d", HTTP::HTTPErrorToString(response.Error()), response.StatusCode());
OS_LOGE(TAG, "Error while reading response: %s %d", HTTP::HTTPErrorToString(content.error), response.StatusCode());

Copilot uses AI. Check for mistakes.
Comment thread platformio.ini Outdated
@github-actions

github-actions Bot commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format (v21.1.8) reports: 12 file(s) not formatted
  • include/http/HTTPClient.h
  • include/http/HTTPClientState.h
  • include/http/HTTPError.h
  • include/http/HTTPResponse.h
  • include/http/JsonResponse.h
  • include/http/RateLimiters.h
  • include/http/ReadResult.h
  • src/http/HTTPClientState.cpp
  • src/http/JsonAPI.cpp
  • src/main.cpp
  • src/util/DomainUtils.cpp
  • src/util/ParitionUtils.cpp
clang-tidy (v21.1.8) reports: 397 concern(s)
  • include/http/DownloadCallback.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/http/DownloadCallback.h:3:10: error: [clang-diagnostic-error]

    'cstdint' file not found

        3 | #include <cstdint>
          |          ^~~~~~~~~
  • include/http/HTTPClient.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/http/HTTPClient.h:15:9: warning: [cppcoreguidelines-special-member-functions]

    class 'HTTPClient' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor

       15 |   class HTTPClient {
          |         ^
  • include/http/HTTPClient.h:16:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       16 |     DISABLE_COPY(HTTPClient);
          |     ^
    include/Common.h:9:13: note: expanded from macro 'DISABLE_COPY'
        9 |   TypeName& operator=(const TypeName&) = delete
          |             ^
  • include/http/HTTPClient.h:17:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       17 |     DISABLE_MOVE(HTTPClient);
          |     ^
    include/Common.h:12:13: note: expanded from macro 'DISABLE_MOVE'
       12 |   TypeName& operator=(TypeName&&) = delete
          |             ^
  • include/http/HTTPClient.h:20:5: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: m_state

       20 |     HTTPClient(const char* url, uint32_t timeoutMs = 10'000)
          |     ^
  • include/http/HTTPClient.h:20:54: warning: [cppcoreguidelines-avoid-magic-numbers]

    10'000 is a magic number; consider replacing it with a named constant

       20 |     HTTPClient(const char* url, uint32_t timeoutMs = 10'000)
          |                                                      ^
  • include/http/HTTPClient.h:25:5: warning: [readability-redundant-inline-specifier]

    function 'SetUrl' has inline specifier but is implicitly inlined

       25 |     inline esp_err_t SetUrl(const char* url) {
          |     ^~~~~~
  • include/http/HTTPClient.h:25:22: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       25 |     inline esp_err_t SetUrl(const char* url) {
          |                      ^
  • include/http/HTTPClient.h:29:5: warning: [readability-redundant-inline-specifier]

    function 'SetHeader' has inline specifier but is implicitly inlined

       29 |     inline esp_err_t SetHeader(const char* key, const char* value) {
          |     ^~~~~~
  • include/http/HTTPClient.h:29:22: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       29 |     inline esp_err_t SetHeader(const char* key, const char* value) {
          |                      ^
  • include/http/HTTPClient.h:29:32: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'SetHeader' of similar type ('const char *') are easily swapped by mistake

       29 |     inline esp_err_t SetHeader(const char* key, const char* value) {
          |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/Firmware/Firmware/include/http/HTTPClient.h:29:44: note: the first parameter in the range is 'key'
       29 |     inline esp_err_t SetHeader(const char* key, const char* value) {
          |                                            ^~~
    /home/runner/work/Firmware/Firmware/include/http/HTTPClient.h:29:61: note: the last parameter in the range is 'value'
       29 |     inline esp_err_t SetHeader(const char* key, const char* value) {
          |                                                             ^~~~~
  • include/http/HTTPClient.h:33:5: warning: [readability-redundant-inline-specifier]

    function 'Get' has inline specifier but is implicitly inlined

       33 |     inline HTTPResponse Get() {
          |     ^~~~~~
  • include/http/HTTPClient.h:33:25: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       33 |     inline HTTPResponse Get() {
          |            ~~~~~~~~~~~~ ^
          |            auto               -> HTTPResponse
  • include/http/HTTPClient.h:33:25: warning: [readability-convert-member-functions-to-static]

    method 'Get' can be made static

       33 |     inline HTTPResponse Get() {
          |                         ^
          |     static 
  • include/http/HTTPClient.h:35:45: warning: [readability-braces-around-statements]

    statement should be inside braces

       35 |       if (response.error != HTTPError::None) return HTTP::HTTPResponse(response.error, response.retryAfterSeconds);
          |                                             ^                                                                      
          |                                              {
  • include/http/HTTPClient.h:40:5: warning: [readability-redundant-inline-specifier]

    function 'GetJson' has inline specifier but is implicitly inlined

       40 |     inline JsonResponse<T> GetJson(JsonParserFn<T> jsonParser) {
          |     ^~~~~~
  • include/http/HTTPClient.h:40:28: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       40 |     inline JsonResponse<T> GetJson(JsonParserFn<T> jsonParser) {
          |            ~~~~~~~~~~~~~~~ ^
          |            auto                                                -> JsonResponse<T>
  • include/http/HTTPClient.h:42:45: warning: [readability-braces-around-statements]

    statement should be inside braces

       42 |       if (response.error != HTTPError::None) return HTTP::JsonResponse<T>(response.error, response.retryAfterSeconds);
          |                                             ^                                                                         
          |                                              {
  • include/http/HTTPClient.h:47:5: warning: [readability-redundant-inline-specifier]

    function 'Close' has inline specifier but is implicitly inlined

       47 |     inline esp_err_t Close() {
          |     ^~~~~~
  • include/http/HTTPClient.h:47:22: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       47 |     inline esp_err_t Close() {
          |                      ^
  • include/http/HTTPClientState.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/http/HTTPClientState.h:19:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       19 |     DISABLE_COPY(HTTPClientState);
          |     ^
    include/Common.h:9:13: note: expanded from macro 'DISABLE_COPY'
        9 |   TypeName& operator=(const TypeName&) = delete
          |             ^
  • include/http/HTTPClientState.h:20:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       20 |     DISABLE_MOVE(HTTPClientState);
          |     ^
    include/Common.h:12:13: note: expanded from macro 'DISABLE_MOVE'
       12 |   TypeName& operator=(TypeName&&) = delete
          |             ^
  • include/http/HTTPClientState.h:25:15: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       25 |     esp_err_t SetUrl(const char* url);
          |               ^
  • include/http/HTTPClientState.h:27:15: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       27 |     esp_err_t SetHeader(const char* key, const char* value);
          |               ^
  • include/http/HTTPClientState.h:29:12: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: key, value

       29 |     struct HeaderEntry {
          |            ^
       30 |       std::string key;
          |                      
          |                      {}
       31 |       std::string value;
          |                        
          |                        {}
  • include/http/HTTPClientState.h:43:24: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       43 |     StartRequestResult StartRequest(esp_http_client_method_t method, int writeLen);
          |     ~~~~~~~~~~~~~~~~~~ ^                                                          
          |     auto                                                                           -> StartRequestResult
  • include/http/HTTPClientState.h:46:26: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       46 |     ReadResult<uint32_t> ReadStreamImpl(DownloadCallback cb);
          |                          ^
  • include/http/HTTPClientState.h:46:58: warning: [readability-identifier-length]

    parameter name 'cb' is too short, expected at least 3 characters

       46 |     ReadResult<uint32_t> ReadStreamImpl(DownloadCallback cb);
          |                                                          ^
  • include/http/HTTPClientState.h:48:29: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       48 |     ReadResult<std::string> ReadStringImpl(uint32_t reserve);
          |                             ^
  • include/http/HTTPClientState.h:51:5: warning: [readability-redundant-inline-specifier]

    function 'ReadJsonImpl' has inline specifier but is implicitly inlined

       51 |     inline ReadResult<T> ReadJsonImpl(uint32_t reserve, JsonParserFn<T> jsonParser)
          |     ^~~~~~
  • include/http/HTTPClientState.h:51:26: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       51 |     inline ReadResult<T> ReadJsonImpl(uint32_t reserve, JsonParserFn<T> jsonParser)
          |            ~~~~~~~~~~~~~ ^                                                         
          |            auto                                                                     -> ReadResult<T>
  • include/http/HTTPClientState.h:51:39: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'ReadJsonImpl' of similar type ('int') are easily swapped by mistake

       51 |     inline ReadResult<T> ReadJsonImpl(uint32_t reserve, JsonParserFn<T> jsonParser)
          |                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/Firmware/Firmware/include/http/HTTPClientState.h:51:48: note: the first parameter in the range is 'reserve'
       51 |     inline ReadResult<T> ReadJsonImpl(uint32_t reserve, JsonParserFn<T> jsonParser)
          |                                                ^~~~~~~
    /home/runner/work/Firmware/Firmware/include/http/HTTPClientState.h:51:73: note: the last parameter in the range is 'jsonParser'
       51 |     inline ReadResult<T> ReadJsonImpl(uint32_t reserve, JsonParserFn<T> jsonParser)
          |                                                                         ^~~~~~~~~~
  • include/http/HTTPClientState.h:73:5: warning: [readability-redundant-inline-specifier]

    function 'Close' has inline specifier but is implicitly inlined

       73 |     inline esp_err_t Close() {
          |     ^~~~~~
  • include/http/HTTPClientState.h:73:22: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       73 |     inline esp_err_t Close() {
          |                      ^
  • include/http/HTTPClientState.h:74:31: warning: [readability-braces-around-statements]

    statement should be inside braces

       74 |       if (m_handle == nullptr) return ESP_FAIL;
          |                               ^                
          |                                {
  • include/http/HTTPClientState.h:78:22: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       78 |     static esp_err_t EventHandler(esp_http_client_event_t* evt);
          |                      ^
  • include/http/HTTPClientState.h:79:15: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       79 |     esp_err_t EventHeaderHandler(std::string key, std::string value);
          |               ^
  • include/http/HTTPError.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/http/HTTPError.h:4:14: warning: [performance-enum-size]

    enum 'HTTPError' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size

        4 |   enum class HTTPError {
          |              ^
  • include/http/HTTPError.h:18:22: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       18 |   inline const char* HTTPErrorToString(HTTPError error) {
          |          ~~~~~~~~~~~ ^
          |          auto                                           -> const char*
  • include/http/HTTPResponse.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/http/HTTPResponse.h:16:23: warning: [cppcoreguidelines-special-member-functions]

    class 'HTTPResponse' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor

       16 |   class [[nodiscard]] HTTPResponse {
          |                       ^
  • include/http/HTTPResponse.h:18:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       18 |     DISABLE_COPY(HTTPResponse);
          |     ^
    include/Common.h:9:13: note: expanded from macro 'DISABLE_COPY'
        9 |   TypeName& operator=(const TypeName&) = delete
          |             ^
  • include/http/HTTPResponse.h:19:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       19 |     DISABLE_MOVE(HTTPResponse);
          |     ^
    include/Common.h:12:13: note: expanded from macro 'DISABLE_MOVE'
       12 |   TypeName& operator=(TypeName&&) = delete
          |             ^
  • include/http/HTTPResponse.h:23:5: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: m_state, m_retryAfterSeconds, m_statusCode, m_contentLength, m_headers

       23 |     HTTPResponse(std::shared_ptr<HTTPClientState> state, uint16_t statusCode, uint32_t contentLength, std::map<std::string, std::string> headers)
          |     ^
  • include/http/HTTPResponse.h:23:18: warning: [bugprone-easily-swappable-parameters]

    4 adjacent parameters of 'HTTPResponse' of similar type ('int') are easily swapped by mistake

       23 |     HTTPResponse(std::shared_ptr<HTTPClientState> state, uint16_t statusCode, uint32_t contentLength, std::map<std::string, std::string> headers)
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/Firmware/Firmware/include/http/HTTPResponse.h:23:51: note: the first parameter in the range is 'state'
       23 |     HTTPResponse(std::shared_ptr<HTTPClientState> state, uint16_t statusCode, uint32_t contentLength, std::map<std::string, std::string> headers)
          |                                                   ^~~~~
    /home/runner/work/Firmware/Firmware/include/http/HTTPResponse.h:23:138: note: the last parameter in the range is 'headers'
       23 |     HTTPResponse(std::shared_ptr<HTTPClientState> state, uint16_t statusCode, uint32_t contentLength, std::map<std::string, std::string> headers)
          |                                                                                                                                          ^~~~~~~
  • include/http/HTTPResponse.h:33:5: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: m_state, m_retryAfterSeconds, m_statusCode, m_contentLength, m_headers

       33 |     HTTPResponse(HTTPError error)
          |     ^
  • include/http/HTTPResponse.h:42:5: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: m_state, m_retryAfterSeconds, m_statusCode, m_contentLength, m_headers

       42 |     HTTPResponse(HTTPError error, uint32_t retryAfterSeconds)
          |     ^
  • include/http/HTTPResponse.h:52:5: warning: [modernize-use-nodiscard]

    function 'Ok' should be marked [[nodiscard]]

       52 |     inline bool Ok() const { return m_error == HTTPError::None && !m_state.expired(); }
          |     ^
          |     [[nodiscard]] 
  • include/http/HTTPResponse.h:52:5: warning: [readability-redundant-inline-specifier]

    function 'Ok' has inline specifier but is implicitly inlined

       52 |     inline bool Ok() const { return m_error == HTTPError::None && !m_state.expired(); }
          |     ^~~~~~
  • include/http/HTTPResponse.h:52:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       52 |     inline bool Ok() const { return m_error == HTTPError::None && !m_state.expired(); }
          |            ~~~~ ^
          |            auto            -> bool
  • include/http/HTTPResponse.h:53:5: warning: [modernize-use-nodiscard]

    function 'Error' should be marked [[nodiscard]]

       53 |     inline HTTPError Error() const { return m_error; }
          |     ^
          |     [[nodiscard]] 
  • include/http/HTTPResponse.h:53:5: warning: [readability-redundant-inline-specifier]

    function 'Error' has inline specifier but is implicitly inlined

       53 |     inline HTTPError Error() const { return m_error; }
          |     ^~~~~~
  • include/http/HTTPResponse.h:53:22: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       53 |     inline HTTPError Error() const { return m_error; }
          |            ~~~~~~~~~ ^
          |            auto                    -> HTTPError
  • include/http/HTTPResponse.h:54:5: warning: [modernize-use-nodiscard]

    function 'RetryAfterSeconds' should be marked [[nodiscard]]

       54 |     inline uint32_t RetryAfterSeconds() const { return m_retryAfterSeconds; }
          |     ^
          |     [[nodiscard]] 
  • include/http/HTTPResponse.h:54:5: warning: [readability-redundant-inline-specifier]

    function 'RetryAfterSeconds' has inline specifier but is implicitly inlined

       54 |     inline uint32_t RetryAfterSeconds() const { return m_retryAfterSeconds; }
          |     ^~~~~~
  • include/http/HTTPResponse.h:54:21: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       54 |     inline uint32_t RetryAfterSeconds() const { return m_retryAfterSeconds; }
          |                     ^
  • include/http/HTTPResponse.h:55:5: warning: [modernize-use-nodiscard]

    function 'StatusCode' should be marked [[nodiscard]]

       55 |     inline uint16_t StatusCode() const { return m_statusCode; }
          |     ^
          |     [[nodiscard]] 
  • include/http/HTTPResponse.h:55:5: warning: [readability-redundant-inline-specifier]

    function 'StatusCode' has inline specifier but is implicitly inlined

       55 |     inline uint16_t StatusCode() const { return m_statusCode; }
          |     ^~~~~~
  • include/http/HTTPResponse.h:55:21: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       55 |     inline uint16_t StatusCode() const { return m_statusCode; }
          |                     ^
  • include/http/HTTPResponse.h:56:5: warning: [modernize-use-nodiscard]

    function 'ContentLength' should be marked [[nodiscard]]

       56 |     inline uint32_t ContentLength() const { return m_contentLength; }
          |     ^
          |     [[nodiscard]] 
  • include/http/HTTPResponse.h:56:5: warning: [readability-redundant-inline-specifier]

    function 'ContentLength' has inline specifier but is implicitly inlined

       56 |     inline uint32_t ContentLength() const { return m_contentLength; }
          |     ^~~~~~
  • include/http/HTTPResponse.h:56:21: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       56 |     inline uint32_t ContentLength() const { return m_contentLength; }
          |                     ^
  • include/http/HTTPResponse.h:58:5: warning: [readability-redundant-inline-specifier]

    function 'ReadStream' has inline specifier but is implicitly inlined

       58 |     inline ReadResult<uint32_t> ReadStream(DownloadCallback downloadCallback) {
          |     ^~~~~~
  • include/http/HTTPResponse.h:58:33: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       58 |     inline ReadResult<uint32_t> ReadStream(DownloadCallback downloadCallback) {
          |                                 ^
  • include/http/HTTPResponse.h:58:33: warning: [readability-convert-member-functions-to-static]

    method 'ReadStream' can be made static

       58 |     inline ReadResult<uint32_t> ReadStream(DownloadCallback downloadCallback) {
          |                                 ^
          |     static 
  • include/http/HTTPResponse.h:60:29: warning: [readability-braces-around-statements]

    statement should be inside braces

       60 |       if (locked == nullptr) return HTTPError::ConnectionClosed;
          |                             ^                                   
          |                              {
  • include/http/HTTPResponse.h:65:5: warning: [readability-redundant-inline-specifier]

    function 'ReadString' has inline specifier but is implicitly inlined

       65 |     inline ReadResult<std::string> ReadString() {
          |     ^~~~~~
  • include/http/HTTPResponse.h:65:36: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       65 |     inline ReadResult<std::string> ReadString() {
          |                                    ^
  • include/http/HTTPResponse.h:65:36: warning: [readability-convert-member-functions-to-static]

    method 'ReadString' can be made static

       65 |     inline ReadResult<std::string> ReadString() {
          |                                    ^
          |     static 
  • include/http/HTTPResponse.h:67:29: warning: [readability-braces-around-statements]

    statement should be inside braces

       67 |       if (locked == nullptr) return HTTPError::ConnectionClosed;
          |                             ^                                   
          |                              {
  • include/http/HTTPResponse.h:73:5: warning: [readability-redundant-inline-specifier]

    function 'ReadJson' has inline specifier but is implicitly inlined

       73 |     inline ReadResult<T> ReadJson(JsonParserFn<T> jsonParser)
          |     ^~~~~~
  • include/http/HTTPResponse.h:73:26: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       73 |     inline ReadResult<T> ReadJson(JsonParserFn<T> jsonParser)
          |            ~~~~~~~~~~~~~ ^                                   
          |            auto                                               -> ReadResult<T>
  • include/http/HTTPResponse.h:76:29: warning: [readability-braces-around-statements]

    statement should be inside braces

       76 |       if (locked == nullptr) return HTTPError::ConnectionClosed;
          |                             ^                                   
          |                              {
  • include/http/JsonAPI.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/http/JsonAPI.h:13:61: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       13 |   JsonResponse<Serialization::JsonAPI::AccountLinkResponse> LinkAccount(std::string_view accountLinkCode);
          |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^                                            
          |   auto                                                                                                    -> JsonResponse<Serialization::JsonAPI::AccountLinkResponse>
  • include/http/JsonAPI.h:18:57: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       18 |   JsonResponse<Serialization::JsonAPI::HubInfoResponse> GetHubInfo(const char* hubToken);
          |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^                               
          |   auto                                                                                   -> JsonResponse<Serialization::JsonAPI::HubInfoResponse>
  • include/http/JsonAPI.h:23:59: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       23 |   JsonResponse<Serialization::JsonAPI::AssignLcgResponse> AssignLcg(const char* hubToken);
          |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^                              
          |   auto                                                                                    -> JsonResponse<Serialization::JsonAPI::AssignLcgResponse>
  • include/http/JsonParserFn.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/http/JsonParserFn.h:3:10: error: [clang-diagnostic-error]

    'cstdint' file not found

        3 | #include <cstdint>
          |          ^~~~~~~~~
  • include/http/JsonResponse.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/http/JsonResponse.h:17:23: warning: [cppcoreguidelines-special-member-functions]

    class 'JsonResponse' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor

       17 |   class [[nodiscard]] JsonResponse {
          |                       ^
  • include/http/JsonResponse.h:19:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       19 |     DISABLE_COPY(JsonResponse);
          |     ^
    include/Common.h:9:13: note: expanded from macro 'DISABLE_COPY'
        9 |   TypeName& operator=(const TypeName&) = delete
          |             ^
  • include/http/JsonResponse.h:20:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       20 |     DISABLE_MOVE(JsonResponse);
          |     ^
    include/Common.h:12:13: note: expanded from macro 'DISABLE_MOVE'
       12 |   TypeName& operator=(TypeName&&) = delete
          |             ^
  • include/http/JsonResponse.h:24:5: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: m_state, m_jsonParser, m_retryAfterSeconds, m_statusCode, m_contentLength, m_headers

       24 |     JsonResponse(std::shared_ptr<HTTPClientState> state, JsonParserFn<T> jsonParser, uint16_t statusCode, uint32_t contentLength, std::map<std::string, std::string> headers)
          |     ^
  • include/http/JsonResponse.h:24:18: warning: [bugprone-easily-swappable-parameters]

    5 adjacent parameters of 'JsonResponse' of similar type ('int') are easily swapped by mistake

       24 |     JsonResponse(std::shared_ptr<HTTPClientState> state, JsonParserFn<T> jsonParser, uint16_t statusCode, uint32_t contentLength, std::map<std::string, std::string> headers)
          |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/runner/work/Firmware/Firmware/include/http/JsonResponse.h:24:51: note: the first parameter in the range is 'state'
       24 |     JsonResponse(std::shared_ptr<HTTPClientState> state, JsonParserFn<T> jsonParser, uint16_t statusCode, uint32_t contentLength, std::map<std::string, std::string> headers)
          |                                                   ^~~~~
    /home/runner/work/Firmware/Firmware/include/http/JsonResponse.h:24:166: note: the last parameter in the range is 'headers'
       24 |     JsonResponse(std::shared_ptr<HTTPClientState> state, JsonParserFn<T> jsonParser, uint16_t statusCode, uint32_t contentLength, std::map<std::string, std::string> headers)
          |                                                                                                                                                                      ^~~~~~~
  • include/http/JsonResponse.h:35:5: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: m_state, m_jsonParser, m_retryAfterSeconds, m_statusCode, m_contentLength, m_headers

       35 |     JsonResponse(HTTPError error)
          |     ^
  • include/http/JsonResponse.h:45:5: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: m_state, m_jsonParser, m_retryAfterSeconds, m_statusCode, m_contentLength, m_headers

       45 |     JsonResponse(HTTPError error, uint32_t retryAfterSeconds)
          |     ^
  • include/http/JsonResponse.h:56:5: warning: [modernize-use-nodiscard]

    function 'Ok' should be marked [[nodiscard]]

       56 |     inline bool Ok() const { return m_error == HTTPError::None && !m_state.expired(); }
          |     ^
          |     [[nodiscard]] 
  • include/http/JsonResponse.h:56:5: warning: [readability-redundant-inline-specifier]

    function 'Ok' has inline specifier but is implicitly inlined

       56 |     inline bool Ok() const { return m_error == HTTPError::None && !m_state.expired(); }
          |     ^~~~~~
  • include/http/JsonResponse.h:56:17: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       56 |     inline bool Ok() const { return m_error == HTTPError::None && !m_state.expired(); }
          |            ~~~~ ^
          |            auto            -> bool
  • include/http/JsonResponse.h:57:5: warning: [modernize-use-nodiscard]

    function 'Error' should be marked [[nodiscard]]

       57 |     inline HTTPError Error() const { return m_error; }
          |     ^
          |     [[nodiscard]] 
  • include/http/JsonResponse.h:57:5: warning: [readability-redundant-inline-specifier]

    function 'Error' has inline specifier but is implicitly inlined

       57 |     inline HTTPError Error() const { return m_error; }
          |     ^~~~~~
  • include/http/JsonResponse.h:57:22: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       57 |     inline HTTPError Error() const { return m_error; }
          |            ~~~~~~~~~ ^
          |            auto                    -> HTTPError
  • include/http/JsonResponse.h:58:5: warning: [modernize-use-nodiscard]

    function 'RetryAfterSeconds' should be marked [[nodiscard]]

       58 |     inline uint32_t RetryAfterSeconds() const { return m_retryAfterSeconds; }
          |     ^
          |     [[nodiscard]] 
  • include/http/JsonResponse.h:58:5: warning: [readability-redundant-inline-specifier]

    function 'RetryAfterSeconds' has inline specifier but is implicitly inlined

       58 |     inline uint32_t RetryAfterSeconds() const { return m_retryAfterSeconds; }
          |     ^~~~~~
  • include/http/JsonResponse.h:58:21: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       58 |     inline uint32_t RetryAfterSeconds() const { return m_retryAfterSeconds; }
          |                     ^
  • include/http/JsonResponse.h:59:5: warning: [modernize-use-nodiscard]

    function 'StatusCode' should be marked [[nodiscard]]

       59 |     inline uint16_t StatusCode() const { return m_statusCode; }
          |     ^
          |     [[nodiscard]] 
  • include/http/JsonResponse.h:59:5: warning: [readability-redundant-inline-specifier]

    function 'StatusCode' has inline specifier but is implicitly inlined

       59 |     inline uint16_t StatusCode() const { return m_statusCode; }
          |     ^~~~~~
  • include/http/JsonResponse.h:59:21: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       59 |     inline uint16_t StatusCode() const { return m_statusCode; }
          |                     ^
  • include/http/JsonResponse.h:60:5: warning: [modernize-use-nodiscard]

    function 'ContentLength' should be marked [[nodiscard]]

       60 |     inline uint32_t ContentLength() const { return m_contentLength; }
          |     ^
          |     [[nodiscard]] 
  • include/http/JsonResponse.h:60:5: warning: [readability-redundant-inline-specifier]

    function 'ContentLength' has inline specifier but is implicitly inlined

       60 |     inline uint32_t ContentLength() const { return m_contentLength; }
          |     ^~~~~~
  • include/http/JsonResponse.h:60:21: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       60 |     inline uint32_t ContentLength() const { return m_contentLength; }
          |                     ^
  • include/http/JsonResponse.h:62:5: warning: [readability-redundant-inline-specifier]

    function 'ReadJson' has inline specifier but is implicitly inlined

       62 |     inline ReadResult<T> ReadJson()
          |     ^~~~~~
  • include/http/JsonResponse.h:62:26: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       62 |     inline ReadResult<T> ReadJson()
          |            ~~~~~~~~~~~~~ ^         
          |            auto                     -> ReadResult<T>
  • include/http/JsonResponse.h:65:29: warning: [readability-braces-around-statements]

    statement should be inside braces

       65 |       if (locked == nullptr) return HTTPError::ConnectionClosed;
          |                             ^                                   
          |                              {
  • include/http/RateLimiters.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/http/RateLimiters.h:9:43: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        9 |   std::shared_ptr<OpenShock::RateLimiter> GetRateLimiter(std::string_view url);
          |                                           ^
  • include/http/ReadResult.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/http/ReadResult.h:11:25: warning: [readability-identifier-length]

    parameter name 'd' is too short, expected at least 3 characters

       11 |     ReadResult(const T& d)
          |                         ^
  • include/http/ReadResult.h:14:33: warning: [readability-identifier-length]

    parameter name 'e' is too short, expected at least 3 characters

       14 |     ReadResult(const HTTPError& e)
          |                                 ^
  • include/http/ReadResult.h:15:19: warning: [cppcoreguidelines-use-default-member-init]

    member initializer for 'data' is redundant

       15 |       : error(e), data{} {}
          |                   ^~~~~~
  • include/serialization/JsonAPI.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/serialization/JsonAPI.h:12:10: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: name, version, currentTime, countryCode, fqdn

       12 |   struct LcgInstanceDetailsResponse {
          |          ^
       13 |     std::string name;
          |                     
          |                     {}
       14 |     std::string version;
          |                        
          |                        {}
       15 |     std::string currentTime;
          |                            
          |                            {}
       16 |     std::string countryCode;
          |                            
          |                            {}
       17 |     std::string fqdn;
          |                     
          |                     {}
  • include/serialization/JsonAPI.h:19:10: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: version, commit, currentTime

       19 |   struct BackendVersionResponse {
          |          ^
       20 |     std::string version;
          |                        
          |                        {}
       21 |     std::string commit;
          |                       
          |                       {}
       22 |     std::string currentTime;
          |                            
          |                            {}
  • include/serialization/JsonAPI.h:24:10: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: authToken

       24 |   struct AccountLinkResponse {
          |          ^
       25 |     std::string authToken;
          |                          
          |                          {}
  • include/serialization/JsonAPI.h:27:10: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: hubId, hubName, shockers

       27 |   struct HubInfoResponse {
          |          ^
       28 |     std::string hubId;
          |                      
          |                      {}
       29 |     std::string hubName;
          |                        
          |                        {}
       30 |     struct ShockerInfo {
       31 |       std::string id;
       32 |       uint16_t rfId;
       33 |       OpenShock::ShockerModelType model;
       34 |     };
       35 |     std::vector<ShockerInfo> shockers;
          |                                      
          |                                      {}
  • include/serialization/JsonAPI.h:30:12: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: id, rfId, model

       30 |     struct ShockerInfo {
          |            ^
       31 |       std::string id;
          |                     
          |                     {}
       32 |       uint16_t rfId;
          |                    
          |                    {}
  • include/serialization/JsonAPI.h:37:10: warning: [cppcoreguidelines-pro-type-member-init]

    constructor does not initialize these fields: host, port, path, country

       37 |   struct AssignLcgResponse {
          |          ^
       38 |     std::string host;
          |                     
          |                     {}
       39 |     uint16_t port;
          |                  
          |                  {}
       40 |     std::string path;
          |                     
          |                     {}
       41 |     std::string country;
          |                        
          |                        {}
  • include/serialization/JsonAPI.h:44:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       44 |   bool ParseLcgInstanceDetailsJsonResponse(const cJSON* root, LcgInstanceDetailsResponse& out);
          |   ~~~~ ^                                                                                      
          |   auto                                                                                         -> bool
  • include/serialization/JsonAPI.h:45:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       45 |   bool ParseBackendVersionJsonResponse(const cJSON* root, BackendVersionResponse& out);
          |   ~~~~ ^                                                                              
          |   auto                                                                                 -> bool
  • include/serialization/JsonAPI.h:46:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       46 |   bool ParseAccountLinkJsonResponse(const cJSON* root, AccountLinkResponse& out);
          |   ~~~~ ^                                                                        
          |   auto                                                                           -> bool
  • include/serialization/JsonAPI.h:47:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       47 |   bool ParseHubInfoJsonResponse(const cJSON* root, HubInfoResponse& out);
          |   ~~~~ ^                                                                
          |   auto                                                                   -> bool
  • include/serialization/JsonAPI.h:48:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       48 |   bool ParseAssignLcgJsonResponse(const cJSON* root, AssignLcgResponse& out);
          |   ~~~~ ^                                                                    
          |   auto                                                                       -> bool
  • include/util/DomainUtils.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/util/DomainUtils.h:3:10: error: [clang-diagnostic-error]

    'string_view' file not found

        3 | #include <string_view>
          |          ^~~~~~~~~~~~~
  • include/util/DomainUtils.h:6:20: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

        6 |   std::string_view GetDomainFromUrl(std::string_view url);
          |                    ^
  • include/util/PartitionUtils.h:1:1: warning: [portability-avoid-pragma-once]

    avoid 'pragma once' directive; use include guards instead

        1 | #pragma once
          | ^
  • include/util/PartitionUtils.h:10:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       10 |   bool TryGetPartitionHash(const esp_partition_t* partition, char (&hash)[65]);
          |   ~~~~ ^                                                                      
          |   auto                                                                         -> bool
  • include/util/PartitionUtils.h:10:62: warning: [cppcoreguidelines-avoid-c-arrays]

    do not declare C-style arrays, use 'std::array' instead

       10 |   bool TryGetPartitionHash(const esp_partition_t* partition, char (&hash)[65]);
          |                                                              ^
  • include/util/PartitionUtils.h:10:75: warning: [cppcoreguidelines-avoid-magic-numbers]

    65 is a magic number; consider replacing it with a named constant

       10 |   bool TryGetPartitionHash(const esp_partition_t* partition, char (&hash)[65]);
          |                                                                           ^
  • include/util/PartitionUtils.h:11:8: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       11 |   bool FlashPartitionFromUrl(const esp_partition_t* partition, const char* remoteUrl, const uint8_t (&remoteHash)[32], std::function<bool(std::size_t, std::size_t, float)> progressCallback = nullptr);
          |   ~~~~ ^                                                                                                                                                                                               
          |   auto                                                                                                                                                                                                  -> bool
  • include/util/PartitionUtils.h:11:114: warning: [cppcoreguidelines-avoid-c-arrays]

    do not declare C-style arrays, use 'std::array' instead

       11 |   bool FlashPartitionFromUrl(const esp_partition_t* partition, const char* remoteUrl, const uint8_t (&remoteHash)[32], std::function<bool(std::size_t, std::size_t, float)> progressCallback = nullptr);
          |                                                                                                                  ^
  • include/util/PartitionUtils.h:11:115: warning: [cppcoreguidelines-avoid-magic-numbers]

    32 is a magic number; consider replacing it with a named constant

       11 |   bool FlashPartitionFromUrl(const esp_partition_t* partition, const char* remoteUrl, const uint8_t (&remoteHash)[32], std::function<bool(std::size_t, std::size_t, float)> progressCallback = nullptr);
          |                                                                                                                   ^
  • src/GatewayConnectionManager.cpp:43:29: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 's_flags' is non-const and globally accessible, consider making it const

       43 | static std::atomic<uint8_t> s_flags                 = 0;
          |                             ^
  • src/GatewayConnectionManager.cpp:44:29: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 's_lastAuthFailure' is non-const and globally accessible, consider making it const

       44 | static std::atomic<int64_t> s_lastAuthFailure       = 0;
          |                             ^
  • src/GatewayConnectionManager.cpp:45:29: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 's_lastConnectionAttempt' is non-const and globally accessible, consider making it const

       45 | static std::atomic<int64_t> s_lastConnectionAttempt = 0;
          |                             ^
  • src/GatewayConnectionManager.cpp:46:25: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 's_isInitializing' is non-const and globally accessible, consider making it const

       46 | static std::atomic_flag s_isInitializing            = ATOMIC_FLAG_INIT;
          |                         ^
  • src/GatewayConnectionManager.cpp:47:31: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 's_clientMutex' is non-const and globally accessible, consider making it const

       47 | static OpenShock::SimpleMutex s_clientMutex;
          |                               ^
  • src/GatewayConnectionManager.cpp:48:50: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 's_wsClient' is non-const and globally accessible, consider making it const

       48 | static std::shared_ptr<OpenShock::GatewayClient> s_wsClient = nullptr;
          |                                                  ^
  • src/GatewayConnectionManager.cpp:50:50: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       50 | static std::shared_ptr<OpenShock::GatewayClient> GetClient()
          |                                                  ^
  • src/GatewayConnectionManager.cpp:52:25: warning: [bugprone-reserved-identifier]

    declaration uses identifier 'lock__', which is a reserved identifier

       52 |   OpenShock::ScopedLock lock__(&s_clientMutex);
          |                         ^~~~~~
          |                         lock_
  • src/GatewayConnectionManager.cpp:57:25: warning: [bugprone-reserved-identifier]

    declaration uses identifier 'lock__', which is a reserved identifier

       57 |   OpenShock::ScopedLock lock__(&s_clientMutex);
          |                         ^~~~~~
          |                         lock_
  • src/GatewayConnectionManager.cpp:62:25: warning: [bugprone-reserved-identifier]

    declaration uses identifier 'lock__', which is a reserved identifier

       62 |   OpenShock::ScopedLock lock__(&s_clientMutex);
          |                         ^~~~~~
          |                         lock_
  • src/GatewayConnectionManager.cpp:83:13: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

       83 | static bool checkIsDeAuthRateLimited(int64_t millis)
          |        ~~~~ ^                                       
          |        auto                                          -> bool
  • src/GatewayConnectionManager.cpp:154:32: warning: [cppcoreguidelines-avoid-magic-numbers]

    404 is a magic number; consider replacing it with a named constant

      154 |   if (response.StatusCode() == 404) {
          |                                ^

Have any feedback or feature suggestions? Share it here.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@hhvrc hhvrc marked this pull request as draft April 23, 2026 22:13
@hhvrc

hhvrc commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

This PR is blocked until we can get a global CA store imported.

…ino-httpclient

# Conflicts:
#	include/http/HTTPRequestManager.h
#	src/GatewayConnectionManager.cpp
#	src/OtaUpdateManager.cpp
#	src/http/HTTPRequestManager.cpp
#	src/util/ParitionUtils.cpp
@stage-review

stage-review Bot commented Jun 29, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: blocked An issue that is blocked by another issue or dependency type: enhancement

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants