Repository: facundobatista/pyempaq (language: python)

Issue:
Add `codespell` to the automatic verifications
We should run `codespell` before merging anything to main...


Discussion / hints:

Fix patch:
diff --git a/README.md b/README.md
index acd41b9..80c6e1a 100644
--- a/README.md
+++ b/README.md
@@ -121,7 +121,7 @@ The following is the structure of the `pyempaq.yaml` configuration file:
 
     - `entrypoint` [†]: freeform, as a list of strings; when unpacking PyEmpaq will only insert the proper python3 at the beginning: `python3 STR1 STR2 ...`.
 
-    - `default-args` [optional]: the default arguments to be passed to the script/module/entrypoint (if not overriden when the distributed `.pyz` is executed).
+    - `default-args` [optional]: the default arguments to be passed to the script/module/entrypoint (if not overridden when the distributed `.pyz` is executed).
 
 - `requirements` [optional]: a list of filepaths pointing to the requirement files with pip-installable dependencies.
 
diff --git a/pyempaq/unpacker.py b/pyempaq/unpacker.py
index 35ddeb8..8051bc2 100644
--- a/pyempaq/unpacker.py
+++ b/pyempaq/unpacker.py
@@ -25,7 +25,7 @@
 # one to run unpacker itself)
 PROJECT_VENV_DIR = "project_venv"
 
-# the file name to flag that the project setup completed succesfully
+# the file name to flag that the project setup completed successfully
 COMPLETE_FLAG_FILE = "complete.flag"
 
 # setup logging
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 03a4986..325e01e 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,5 +1,6 @@
 -r requirements.txt
 
+codespell
 flake8
 logassert
 packaging


Test patch:
diff --git a/tests/test_infra.py b/tests/test_infra.py
index 410aa31..4217ed6 100644
--- a/tests/test_infra.py
+++ b/tests/test_infra.py
@@ -1,4 +1,4 @@
-# Copyright 2021 Facundo Batista
+# Copyright 2021-2023 Facundo Batista
 # Licensed under the GPL v3 License
 # For further info, check https://github.com/facundobatista/pyempaq
 
@@ -8,6 +8,7 @@
 import itertools
 import os
 import re
+import subprocess
 from unittest.mock import patch
 
 import pydocstyle
@@ -26,6 +27,17 @@ def get_python_filepaths(*, roots=None, python_paths=None):
     return python_paths
 
 
+def test_codespell():
+    """Verify all words are correctly spelled."""
+    cmd = ["codespell", "pyempaq", "tests", "docs"]
+    proc = subprocess.run(cmd, capture_output=True, text=True)
+    report = [x.strip() for x in proc.stdout.split("\n")]
+    indented_issues = [f" - {issue}" for issue in report if issue]
+    if indented_issues:
+        msg = "Please fix the following codespell issues!\n" + "\n".join(indented_issues)
+        pytest.fail(msg, pytrace=False)
+
+
 def test_pep8():
     """Verify all files are nicely styled."""
     python_filepaths = get_python_filepaths()
@@ -34,7 +46,7 @@ def test_pep8():
     with patch("sys.stdout", fake_stdout):
         report = style_guide.check_files(python_filepaths)
 
-    # if flake8 didnt' report anything, we're done
+    # if flake8 didn't report anything, we're done
     if report.total_errors == 0:
         return
 
diff --git a/tests/test_load_config.py b/tests/test_load_config.py
index 4e65f8b..0282ea7 100644
--- a/tests/test_load_config.py
+++ b/tests/test_load_config.py
@@ -304,7 +304,7 @@ def test_exec_module_outside_project(tmp_path):
 
 
 def test_exec_module_absolute(tmp_path, drive_letter):
-    """Check module subkey using absoule path."""
+    """Check module subkey using absolute path."""
     config_file = tmp_path / "config.yaml"
     config_file.write_text(f"""
         name: testproject