Skip to content

Commit 370face

Browse files
authored
Merge pull request #105 from weikelu/feat/add_codespell_check
feat: add codespell check and fix typos
2 parents fddbfc3 + 52eabd8 commit 370face

File tree

5 files changed

+71
-7
lines changed

5 files changed

+71
-7
lines changed

.codespellrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[codespell]
2+
skip = build,*.drawio,*.svg,*.pdf,*.png,*.jar,gradlew.bat
3+
ignore-words-list = laf,OT
4+
write-changes = true
5+

.github/workflows/pre_commit.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Pre-Commit Checks
2+
3+
# Triggers on pull requests and pushes to master or main branches
4+
on:
5+
pull_request:
6+
push:
7+
branches: [master, main]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# Fetches full Git history to enable branch comparison
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.x'
23+
24+
- name: Install pre-commit
25+
run: pip install pre-commit
26+
27+
# Identifies changed files using git diff
28+
- name: Get modified files
29+
id: modified_files
30+
run: |
31+
if [ "${{ github.event_name }}" == "pull_request" ]; then
32+
BASE_BRANCH="${{ github.base_ref }}"
33+
git fetch origin $BASE_BRANCH --depth=1
34+
MODIFIED_FILES="$(git diff --name-only origin/$BASE_BRANCH...HEAD || echo "")"
35+
else
36+
MODIFIED_FILES="$(git diff --name-only HEAD~1 HEAD || echo "")"
37+
fi
38+
39+
if [ -n "$MODIFIED_FILES" ]; then
40+
echo "Running pre-commit on changed files:"
41+
echo "$MODIFIED_FILES"
42+
echo "files=$(echo "$MODIFIED_FILES" | tr '\n' ' ')" >> $GITHUB_OUTPUT
43+
echo "has_files=true" >> $GITHUB_OUTPUT
44+
else
45+
echo "No modified files to check."
46+
echo "has_files=false" >> $GITHUB_OUTPUT
47+
fi
48+
49+
- name: Run pre-commit on modified files
50+
if: steps.modified_files.outputs.has_files == 'true'
51+
run: pre-commit run --files ${{ steps.modified_files.outputs.files }}
52+

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repos:
2+
- repo: https://github.com/codespell-project/codespell
3+
rev: v2.4.1
4+
hooks:
5+
- id: codespell
6+
args: [--config=.codespellrc]
7+

esptouch/src/main/java/com/espressif/iot/esptouch/task/ICodeData.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ public interface ICodeData {
99
/**
1010
* Get the byte[] to be transformed.
1111
*
12-
* @return the byte[] to be transfromed
12+
* @return the byte[] to be transformed
1313
*/
1414
byte[] getBytes();
1515

1616
/**
17-
* Get the char[](u8[]) to be transfromed.
17+
* Get the char[](u8[]) to be transformed.
1818
*
1919
* @return the char[](u8) to be transformed
2020
*/

log/log-en.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ EspTouch v0.3.7.1
6969
- Modify bssid post sequence
7070

7171
## v0.3.6.0
72-
- Fix bug that cann't configure Chinese SSID
72+
- Fix bug that can't configure Chinese SSID
7373

7474
## v0.3.4.7
7575
- Change project from Eclipse to Android Studio
@@ -98,7 +98,7 @@ EspTouch v0.3.7.1
9898
- Esptouch v0.3.4.3 only support Espressif's Smart Config v2.4
9999

100100
## v0.3.4.2
101-
- Espressif's Smart Config is updated to v2.4, and some paremeters are changed.
101+
- Espressif's Smart Config is updated to v2.4, and some parameters are changed.
102102
- Esptouch v0.3.4.2 only support Espressif's Smart Config v2.4
103103
```
104104
The usage of v0.3.4 is supported, besides one new API is added:
@@ -107,7 +107,7 @@ EspTouch v0.3.7.1
107107
```
108108

109109
## v0.3.4
110-
- Espressif's Smart Config is updated to v2.4, and some paremeters are changed.
110+
- Espressif's Smart Config is updated to v2.4, and some parameters are changed.
111111
- Esptouch v0.3.4 only support Espressif's Smart Config v2.4
112112

113113
## v0.3.3
@@ -116,7 +116,7 @@ EspTouch v0.3.7.1
116116
```
117117
The usage of v0.3.0 is supported, besides one new API is added:
118118
List<IEsptouchResult> executeForResults(int expectTaskResultCount)
119-
The only differece is that it return list, and require expectTaskResultCount
119+
The only difference is that it return list, and require expectTaskResultCount
120120
```
121121

122122
## v0.3.2
@@ -207,7 +207,7 @@ IEsptouchTask esptouchTask = new EsptouchTask(apSsid, apPassword);
207207
IEsptouchTask esptouchTask = new EsptouchTask(apSsid, apPassword);
208208
// execute syn util it suc or timeout
209209
IEsptouchResult result = esptouchTask.executeForResult();
210-
// check whehter the execute is suc
210+
// check whether the execute is suc
211211
boolean isSuc = result.isSuc();
212212
// get the device's bssid, the format of the bssid is like this format: "18fe3497f310"
213213
String bssid = result.getBssid();

0 commit comments

Comments
 (0)