ci: add codespell document check (#136)

* ci: add codespell document check

Add a pre-commit based codespell workflow for documentation files and fix existing spelling issues in docs.

* Test the codespell

* Test the codespell
This commit is contained in:
Fang
2026-06-04 16:42:47 +08:00
committed by GitHub
parent 527ee2e09c
commit db0f6562e4
8 changed files with 71 additions and 14 deletions
+2
View File
@@ -0,0 +1,2 @@
[codespell]
skip = *.gif,*.jpg,*.jpeg,*.pdf,*.png,*.svg,build
+48
View File
@@ -0,0 +1,48 @@
name: Pre-Commit Checks
on:
pull_request:
push:
branches: [master, main]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install pre-commit
run: pip install pre-commit
- name: Get modified files
id: modified_files
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE_BRANCH="${{ github.base_ref }}"
git fetch origin "$BASE_BRANCH" --depth=1
MODIFIED_FILES="$(git diff --name-only "origin/$BASE_BRANCH"...HEAD || echo "")"
else
MODIFIED_FILES="$(git diff --name-only HEAD~1 HEAD || echo "")"
fi
if [ -n "$MODIFIED_FILES" ]; then
echo "Running pre-commit on changed files:"
echo "$MODIFIED_FILES"
echo "files=$(echo "$MODIFIED_FILES" | tr '\n' ' ')" >> "$GITHUB_OUTPUT"
echo "has_files=true" >> "$GITHUB_OUTPUT"
else
echo "No modified files to check."
echo "has_files=false" >> "$GITHUB_OUTPUT"
fi
- name: Run pre-commit on modified files
if: steps.modified_files.outputs.has_files == 'true'
run: pre-commit run --files ${{ steps.modified_files.outputs.files }}
+7
View File
@@ -0,0 +1,7 @@
repos:
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
args: [--config=.codespellrc]
files: ^(docs/|README(_cn)?\.md$)
+1 -1
View File
@@ -167,7 +167,7 @@ gh-linkcheck:
'https://github.com/espressif/esp-idf/tree\|https://github.com/espressif/esp-idf/blob\|https://github.com/espressif/esp-idf/raw'\
); \
then \
echo "WARNINIG: Some .rst files contain hardcoded Github links."; \
echo "WARNING: Some .rst files contain hardcoded Github links."; \
echo "Please check above output and replace links with one of the following:"; \
echo "- :idf:\`dir\` - points to directory inside ESP-IDF"; \
echo "- :idf_file:\`file\` - points to file inside ESP-IDF"; \
+1 -1
View File
@@ -71,7 +71,7 @@ For the detailed usage, please refer to the code ``\components\drivers\general\w
.. note::
Before Wi-Fi initialization, please use ``WIFI_INIT_CONFIG_DEFAULT`` to obtain the initialization configuration struct, and customize this struct first, then start the initialization. Be aware of problems caused by unitialized members of the struct, and pay special attention to this issue when new structure members are added to the ESP-IDF during update.
Before Wi-Fi initialization, please use ``WIFI_INIT_CONFIG_DEFAULT`` to obtain the initialization configuration struct, and customize this struct first, then start the initialization. Be aware of problems caused by uninitialized members of the struct, and pay special attention to this issue when new structure members are added to the ESP-IDF during update.
**AP Mode Workflow**
+9 -9
View File
@@ -2,19 +2,19 @@ Set up Development Environment
================================
:link_to_translation:`zh_CN:[中文]`
Set up ESP-IDF Environment
Set up ESP-IDF Environment
---------------------------------
Please refer to `ESP-IDF Programming Guide <https://docs.espressif.com/projects/esp-idf/en/release-v5.0/esp32s2/get-started/index.html>`__\ and set up ESP-IDF environmnet step by step.
Please refer to `ESP-IDF Programming Guide <https://docs.espressif.com/projects/esp-idf/en/release-v5.0/esp32s2/get-started/index.html>`__\ and set up ESP-IDF environment step by step.
.. note::
- ESP-IDF branch ``release/v5.0`` is suggested.
- Please follow and complete all setup steps.
- Build a example of ESP-IDF to make sure the setup is successful.
- Build an example of ESP-IDF to make sure the setup is successful.
Get Project Source Code
Get Project Source Code
---------------------------------------------------
**Beta code, currently in the GitHub repository, is available by using git:**
@@ -26,7 +26,7 @@ Get Project Source Code
**The project software mainly consists of a flight control kernel, hardware drivers, and dependency libraries:**
- The flight control kernel is from Crazyflie, mainly including hardware abstraction layer and flight control program.
- Hardware drivers are structured in files according to hardware interfaces, including I2C devcies and SPI devices.
- Hardware drivers are structured in files according to hardware interfaces, including I2C devices and SPI devices.
- Dependency libraries include the default components provided by ESP-IDF, as well as DSP from third parties.
**The code file structure is as follows:**
@@ -47,9 +47,9 @@ Get Project Source Code
│   ├── core | system kernel directory
│   │   └── crazyflie | Crazyflie kernel
│   │   ├── hal | hardware abstraction code
│   │   └── modules | flight control code
│   │   └── modules | flight control code
│   ├── drivers | hardware driver directory
│   │   ├── deck | hardware extention interface driver
│   │   ├── deck | hardware extension interface driver
│   │   ├── general | general device directory
│   │   │   ├── adc | ADC driver for voltage monitoring
│   │   │   ├── buzzer | buzzer driver for status feedback
@@ -76,7 +76,7 @@ Get Project Source Code
├── README.md | project description
└── sdkconfig.defaults | default parameter
**For more information, please refer to**: `espdrone_file_structure <./_static/espdrone_file_structure.pdf>`__.
**For more information, please refer to**: `espdrone_file_structure <./_static/espdrone_file_structure.pdf>`__.
Source Code Style
--------------------
@@ -102,7 +102,7 @@ The first member in an enumeration defaults to 0, so the member SensorImplementa
.. code:: text
typedef enum {
typedef enum {
#ifdef SENSOR_INCLUDED_BMI088_BMP388
SensorImplementation_bmi088_bmp388,
#endif
+2 -2
View File
@@ -341,10 +341,10 @@ Tune Online Parameters
.. figure:: ../../_static/cfclient_pid_tune.png
:align: center
:alt: PID parameters tunning
:alt: PID parameters tuning
:figclass: align-center
Cfclient PID Parameters Tunning
Cfclient PID Parameters Tuning
**Note**
+1 -1
View File
@@ -167,7 +167,7 @@ gh-linkcheck:
'https://github.com/espressif/esp-idf/tree\|https://github.com/espressif/esp-idf/blob\|https://github.com/espressif/esp-idf/raw'\
); \
then \
echo "WARNINIG: Some .rst files contain hardcoded Github links."; \
echo "WARNING: Some .rst files contain hardcoded Github links."; \
echo "Please check above output and replace links with one of the following:"; \
echo "- :idf:\`dir\` - points to directory inside ESP-IDF"; \
echo "- :idf_file:\`file\` - points to file inside ESP-IDF"; \