Skip to content

Commit 9b9abc1

Browse files
ci: add codespell spell-check workflow and fix typos in core
Add .github/workflows/spell-check.yml running codespell on every push and pull_request, and a .codespellrc limiting the check to core/. Fix all typos caught by the new check: - Deafult -> Default (log.py) - caculate -> calculate (federated_class_incremental_learning.py) - enviroment -> environment (simulation.py, simulation_system_admin.py) - segmantation -> segmentation (dataset.py) Fixes #232 Signed-off-by: dev-aditya-hub <premjadhvar95@gmail.com>
1 parent bd88857 commit 9b9abc1

7 files changed

Lines changed: 40 additions & 14 deletions

File tree

.codespellrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[codespell]
2+
# examples/ and docs/proposals/ contain pre-existing issues from many
3+
# contributors; they are tracked separately. CI focuses on core/ only.
4+
skip = *.pyc,__pycache__,*.egg-info,.git

.github/workflows/spell-check.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Spell Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
codespell:
11+
runs-on: ubuntu-22.04
12+
name: codespell
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Set up Python
16+
uses: actions/setup-python@v3
17+
with:
18+
python-version: "3.9"
19+
- name: Install codespell
20+
run: python -m pip install codespell
21+
- name: Run codespell
22+
run: codespell --config .codespellrc core

core/common/log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# pylint: disable=too-few-public-methods
2222
class Logger:
2323
"""
24-
Deafult logger in ianvs
24+
Default logger in ianvs
2525
Args:
2626
name(str) : Logger name, default is 'ianvs'
2727
"""

core/testcasecontroller/algorithm/paradigm/federated_learning/federated_class_incremental_learning.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def evaluation(self, testdataset_files, incremental_round):
249249
if isinstance(testdataset_files, str):
250250
testdataset_files = [testdataset_files]
251251
job = self.get_global_model()
252-
# caculate the seen class accuracy
252+
# calculate the seen class accuracy
253253
old_class_acc_list = (
254254
[]
255255
) # for current round [class_0: acc_0, class_1: acc1, ....]
@@ -272,7 +272,7 @@ def evaluation(self, testdataset_files, incremental_round):
272272
self.system_metric_info[SystemMetricType.TASK_AVG_ACC.value]["accuracy"] = (
273273
np.mean(old_class_acc_list)
274274
)
275-
# caculate the forget rate
275+
# calculate the forget rate
276276
for i in range(len(old_class_acc_list)):
277277
max_acc_diff = 0
278278
for j in range(incremental_round):

core/testcasecontroller/simulation/simulation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# pylint: disable=too-few-public-methods
1919
class Simulation:
2020
"""
21-
Simulation: The simulation enviroment, e.g. config of simulation.
21+
Simulation: The simulation environment, e.g. config of simulation.
2222
2323
Parameters
2424
----------

core/testcasecontroller/simulation_system_admin/simulation_system_admin.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ def check_host_cpu():
135135
raise RuntimeError("The number os cpus is insufficient.")
136136

137137

138-
def check_host_enviroment():
138+
def check_host_environment():
139139
"""
140-
check the host enviroment, includes docker, kind, cpu and memory.
140+
check the host environment, includes docker, kind, cpu and memory.
141141
142142
"""
143143
check_host_docker()
@@ -146,13 +146,13 @@ def check_host_enviroment():
146146
check_host_cpu()
147147

148148

149-
def build_simulation_enviroment(simulation):
149+
def build_simulation_environment(simulation):
150150
"""
151-
build a simulation enviroment
151+
build a simulation environment
152152
153153
"""
154154

155-
check_host_enviroment() # check the enviroment
155+
check_host_environment() # check the environment
156156

157157
shell_cmd = "curl https://raw.githubusercontent.com/kubeedge/sedna\
158158
/master/scripts/installation/all-in-one.sh | " \
@@ -167,14 +167,14 @@ def build_simulation_enviroment(simulation):
167167

168168
if build_simulation_env_ret.returncode == 0:
169169
LOGGER.info(
170-
"Congratulation! The simulation enviroment build successful!")
170+
"Congratulation! The simulation environment build successful!")
171171
else:
172-
raise RuntimeError("The simulation enviroment build failed.")
172+
raise RuntimeError("The simulation environment build failed.")
173173

174174

175-
def destory_simulation_enviroment(simulation):
175+
def destory_simulation_environment(simulation):
176176
"""
177-
build the simulation enviroment
177+
build the simulation environment
178178
179179
"""
180180
shell_cmd = "curl https://raw.githubusercontent.com/kubeedge/sedna\

core/testenvmanager/dataset/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def split_dataset(
228228
output_dir=output_dir,
229229
times=times,
230230
)
231-
# add new splitting method for semantic segmantation
231+
# add new splitting method for semantic segmentation
232232
if method == "city_splitting":
233233
return self._city_splitting(
234234
dataset_url,

0 commit comments

Comments
 (0)