From 3041f332c2f1f23ba5c0705d7fafa110f344da1b Mon Sep 17 00:00:00 2001 From: morris Date: Tue, 17 Jun 2025 17:42:39 +0800 Subject: [PATCH] feat(ci): ast-grep rules to forbid use freertos specific critical section APIs --- ..._correct_critical_section_api_in_components.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tools/ci/sg_rules/use_correct_critical_section_api_in_components.yml diff --git a/tools/ci/sg_rules/use_correct_critical_section_api_in_components.yml b/tools/ci/sg_rules/use_correct_critical_section_api_in_components.yml new file mode 100644 index 0000000000..2e8b686fce --- /dev/null +++ b/tools/ci/sg_rules/use_correct_critical_section_api_in_components.yml @@ -0,0 +1,14 @@ +# Refer to https://ast-grep.github.io/guide/rule-config.html for Rule Essentials +id: use-correct-critical-section-api-in-components +message: Don't use FreeRTOS specific critical section APIs in this component +severity: error # error, warning, info, hint +note: Please use the APIs provided by 'esp_private/critical_section.h' instead. +language: C +files: + - "components/esp_hw_support/**/*" +ignores: + - "components/esp_hw_support/test_apps/**/*" +rule: + kind: expression_statement + pattern: $FUNC($$$ARGS); + regex: port.*CRITICAL.*(.*)