mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Fix NOLINT on inclusive-language check (#6464)
This commit is contained in:
parent
4fcb26d69d
commit
02632f0cad
2 changed files with 24 additions and 11 deletions
|
@ -1,16 +1,17 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esphome/core/component.h"
|
|
||||||
#include "esphome/components/sensor/sensor.h"
|
#include "esphome/components/sensor/sensor.h"
|
||||||
#include "esphome/components/uart/uart.h"
|
#include "esphome/components/uart/uart.h"
|
||||||
|
#include "esphome/core/component.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace pmsx003 {
|
namespace pmsx003 {
|
||||||
|
|
||||||
// known command bytes
|
// known command bytes
|
||||||
#define PMS_CMD_AUTO_MANUAL 0xE1 // data=0: perform measurement manually, data=1: perform measurement automatically
|
static const uint8_t PMS_CMD_AUTO_MANUAL =
|
||||||
#define PMS_CMD_TRIG_MANUAL 0xE2 // trigger a manual measurement
|
0xE1; // data=0: perform measurement manually, data=1: perform measurement automatically
|
||||||
#define PMS_CMD_ON_STANDBY 0xE4 // data=0: go to standby mode, data=1: go to normal mode
|
static const uint8_t PMS_CMD_TRIG_MANUAL = 0xE2; // trigger a manual measurement
|
||||||
|
static const uint8_t PMS_CMD_ON_STANDBY = 0xE4; // data=0: go to standby mode, data=1: go to normal mode
|
||||||
|
|
||||||
static const uint16_t PMS_STABILISING_MS = 30000; // time taken for the sensor to become stable after power on
|
static const uint16_t PMS_STABILISING_MS = 30000; // time taken for the sensor to become stable after power on
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ file_types = (
|
||||||
"",
|
"",
|
||||||
)
|
)
|
||||||
cpp_include = ("*.h", "*.c", "*.cpp", "*.tcc")
|
cpp_include = ("*.h", "*.c", "*.cpp", "*.tcc")
|
||||||
|
py_include = ("*.py",)
|
||||||
ignore_types = (".ico", ".png", ".woff", ".woff2", "")
|
ignore_types = (".ico", ".png", ".woff", ".woff2", "")
|
||||||
|
|
||||||
LINT_FILE_CHECKS = []
|
LINT_FILE_CHECKS = []
|
||||||
|
@ -265,7 +266,8 @@ def lint_end_newline(fname, content):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
CPP_RE_EOL = r"\s*?(?://.*?)?$"
|
CPP_RE_EOL = r".*?(?://.*?)?$"
|
||||||
|
PY_RE_EOL = r".*?(?:#.*?)?$"
|
||||||
|
|
||||||
|
|
||||||
def highlight(s):
|
def highlight(s):
|
||||||
|
@ -273,7 +275,7 @@ def highlight(s):
|
||||||
|
|
||||||
|
|
||||||
@lint_re_check(
|
@lint_re_check(
|
||||||
r"^#define\s+([a-zA-Z0-9_]+)\s+([0-9bx]+)" + CPP_RE_EOL,
|
r"^#define\s+([a-zA-Z0-9_]+)\s+(0b[10]+|0x[0-9a-fA-F]+|\d+)\s*?(?:\/\/.*?)?$",
|
||||||
include=cpp_include,
|
include=cpp_include,
|
||||||
exclude=[
|
exclude=[
|
||||||
"esphome/core/log.h",
|
"esphome/core/log.h",
|
||||||
|
@ -574,11 +576,6 @@ def lint_pragma_once(fname, content):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@lint_re_check(
|
|
||||||
r"(whitelist|blacklist|slave)",
|
|
||||||
exclude=["script/ci-custom.py"],
|
|
||||||
flags=re.IGNORECASE | re.MULTILINE,
|
|
||||||
)
|
|
||||||
def lint_inclusive_language(fname, match):
|
def lint_inclusive_language(fname, match):
|
||||||
# From https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=49decddd39e5f6132ccd7d9fdc3d7c470b0061bb
|
# From https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=49decddd39e5f6132ccd7d9fdc3d7c470b0061bb
|
||||||
return (
|
return (
|
||||||
|
@ -596,6 +593,21 @@ def lint_inclusive_language(fname, match):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
lint_re_check(
|
||||||
|
r"(whitelist|blacklist|slave)" + PY_RE_EOL,
|
||||||
|
include=py_include,
|
||||||
|
exclude=["script/ci-custom.py"],
|
||||||
|
flags=re.IGNORECASE | re.MULTILINE,
|
||||||
|
)(lint_inclusive_language)
|
||||||
|
|
||||||
|
|
||||||
|
lint_re_check(
|
||||||
|
r"(whitelist|blacklist|slave)" + CPP_RE_EOL,
|
||||||
|
include=cpp_include,
|
||||||
|
flags=re.IGNORECASE | re.MULTILINE,
|
||||||
|
)(lint_inclusive_language)
|
||||||
|
|
||||||
|
|
||||||
@lint_re_check(r"[\t\r\f\v ]+$")
|
@lint_re_check(r"[\t\r\f\v ]+$")
|
||||||
def lint_trailing_whitespace(fname, match):
|
def lint_trailing_whitespace(fname, match):
|
||||||
return "Trailing whitespace detected"
|
return "Trailing whitespace detected"
|
||||||
|
|
Loading…
Reference in a new issue