mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
[code-quality] fix clang-tidy web_server and web_server_base (#7286)
This commit is contained in:
parent
69f98e0f87
commit
f8e8bd2c24
7 changed files with 27 additions and 16 deletions
|
@ -1,35 +1,36 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import gzip
|
||||
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
import esphome.final_validate as fv
|
||||
from esphome.components import web_server_base
|
||||
from esphome.components.web_server_base import CONF_WEB_SERVER_BASE_ID
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_AUTH,
|
||||
CONF_CSS_INCLUDE,
|
||||
CONF_CSS_URL,
|
||||
CONF_ENABLE_PRIVATE_NETWORK_ACCESS,
|
||||
CONF_ID,
|
||||
CONF_INCLUDE_INTERNAL,
|
||||
CONF_JS_INCLUDE,
|
||||
CONF_JS_URL,
|
||||
CONF_ENABLE_PRIVATE_NETWORK_ACCESS,
|
||||
CONF_PORT,
|
||||
CONF_AUTH,
|
||||
CONF_USERNAME,
|
||||
CONF_PASSWORD,
|
||||
CONF_INCLUDE_INTERNAL,
|
||||
CONF_OTA,
|
||||
CONF_LOG,
|
||||
CONF_VERSION,
|
||||
CONF_LOCAL,
|
||||
CONF_LOG,
|
||||
CONF_OTA,
|
||||
CONF_PASSWORD,
|
||||
CONF_PORT,
|
||||
CONF_USERNAME,
|
||||
CONF_VERSION,
|
||||
CONF_WEB_SERVER_ID,
|
||||
CONF_WEB_SERVER_SORTING_WEIGHT,
|
||||
PLATFORM_BK72XX,
|
||||
PLATFORM_ESP32,
|
||||
PLATFORM_ESP8266,
|
||||
PLATFORM_BK72XX,
|
||||
PLATFORM_RTL87XX,
|
||||
)
|
||||
from esphome.core import CORE, coroutine_with_priority
|
||||
import esphome.final_validate as fv
|
||||
|
||||
AUTO_LOAD = ["json", "web_server_base"]
|
||||
|
||||
|
@ -208,7 +209,6 @@ async def to_code(config):
|
|||
var = cg.new_Pvariable(config[CONF_ID], paren)
|
||||
await cg.register_component(var, config)
|
||||
|
||||
cg.add_define("USE_WEBSERVER")
|
||||
version = config[CONF_VERSION]
|
||||
|
||||
cg.add(paren.set_port(config[CONF_PORT]))
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "list_entities.h"
|
||||
#ifdef USE_WEBSERVER
|
||||
#include "esphome/core/application.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/util.h"
|
||||
|
@ -188,3 +189,4 @@ bool ListEntitiesIterator::on_update(update::UpdateEntity *update) {
|
|||
|
||||
} // namespace web_server
|
||||
} // namespace esphome
|
||||
#endif
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
#ifdef USE_WEBSERVER
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/component_iterator.h"
|
||||
#include "esphome/core/defines.h"
|
||||
namespace esphome {
|
||||
namespace web_server {
|
||||
|
||||
|
@ -78,3 +79,4 @@ class ListEntitiesIterator : public ComponentIterator {
|
|||
|
||||
} // namespace web_server
|
||||
} // namespace esphome
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "web_server.h"
|
||||
|
||||
#ifdef USE_WEBSERVER
|
||||
#include "esphome/components/json/json_util.h"
|
||||
#include "esphome/components/network/util.h"
|
||||
#include "esphome/core/application.h"
|
||||
|
@ -1659,3 +1659,4 @@ void WebServer::schedule_(std::function<void()> &&f) {
|
|||
|
||||
} // namespace web_server
|
||||
} // namespace esphome
|
||||
#endif
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "list_entities.h"
|
||||
|
||||
#include "esphome/components/web_server_base/web_server_base.h"
|
||||
#ifdef USE_WEBSERVER
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/controller.h"
|
||||
#include "esphome/core/entity_base.h"
|
||||
|
@ -366,3 +367,4 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
|
|||
|
||||
} // namespace web_server
|
||||
} // namespace esphome
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "web_server_base.h"
|
||||
#ifdef USE_NETWORK
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/application.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
|
@ -121,3 +122,4 @@ float WebServerBase::get_setup_priority() const {
|
|||
|
||||
} // namespace web_server_base
|
||||
} // namespace esphome
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
#ifdef USE_NETWORK
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -145,3 +146,4 @@ class OTARequestHandler : public AsyncWebHandler {
|
|||
|
||||
} // namespace web_server_base
|
||||
} // namespace esphome
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue