mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-04 02:50:58 +02:00
63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
# Refer to https://ast-grep.github.io/guide/rule-config.html for Rule Essentials
|
|
id: no-kconfig-in-hal-component
|
|
message: Don't use Kconfig macros in the hal component
|
|
severity: error # error, warning, info, hint
|
|
note: hal component should be able to deliver without 3rd party config system
|
|
language: C
|
|
files:
|
|
- "components/hal/**/*"
|
|
- "components/esp_hal*/**/*"
|
|
ignores:
|
|
# porting layer and test apps are allowed to use Kconfig macros
|
|
- "components/hal/platform_port/**/*"
|
|
- "components/hal/test_apps/**/*"
|
|
- "components/esp_hal*/test_apps/**/*"
|
|
# the following files should be refactored to remove Kconfig macros
|
|
- "components/hal/twai_hal_sja1000.c"
|
|
- "components/hal/esp32/include/hal/twai_ll.h"
|
|
- "components/hal/esp32/include/hal/uart_ll.h"
|
|
- "components/hal/include/hal/twai_types_deprecated.h"
|
|
rule:
|
|
any:
|
|
- kind: argument_list
|
|
has:
|
|
kind: identifier
|
|
pattern: $N
|
|
- kind: preproc_if
|
|
has:
|
|
field: condition
|
|
pattern: $M
|
|
constraints:
|
|
N:
|
|
regex: "^CONFIG"
|
|
M:
|
|
regex: "^CONFIG"
|
|
|
|
---
|
|
|
|
id: no-sdkconfig-include-in-hal-component
|
|
message: Don't include sdkconfig.h in the hal component
|
|
severity: error # error, warning, info, hint
|
|
note: hal component should be able to deliver without 3rd party config system
|
|
language: C
|
|
files:
|
|
- "components/hal/**/*"
|
|
- "components/esp_hal*/**/*"
|
|
ignores:
|
|
# porting layer and test apps are allowed to include sdkconfig.h
|
|
- "components/hal/platform_port/**/*"
|
|
- "components/hal/test_apps/**/*"
|
|
- "components/esp_hal*/test_apps/**/*"
|
|
# the following files should be refactored to remove sdkconfig.h
|
|
- "components/hal/twai_hal_sja1000.c"
|
|
- "components/hal/include/hal/twai_types_deprecated.h"
|
|
rule:
|
|
kind: preproc_include
|
|
has:
|
|
field: path
|
|
pattern: $N
|
|
constraints:
|
|
N:
|
|
regex: '^["<]sdkconfig' # match "sdkconfig.h" or <sdkconfig.h>
|
|
fix: ''
|