Add codespell spell-checking to pre-commit hooks#2375
Add codespell spell-checking to pre-commit hooks#2375mr-raj12 wants to merge 2 commits intoborgbase:masterfrom
Conversation
7aac696 to
ca283e3
Compare
|
Thanks for putting this together, @mr-raj12, and for the thorough documentation in the PR description. After reviewing this, I've decided not to add codespell to the pre-commit hooks. The main reason is that the cost-benefit ratio doesn't quite work out for this project:
For a project with years of history and only 6 spelling issues, the maintenance overhead of keeping the spell checker config up to date likely exceeds the value it provides. If typos become a recurring problem in the future, we can revisit this. I appreciate the effort here and the spelling fixes in #2373 - those are merged. Thanks for contributing! |
|
Thanks for the feedback and the detailed explanation, @m3nu . I completely understand the desire to keep the maintenance overhead low, especially given the clean state of the codebase. Glad the spelling fixes themselves were helpful! Happy to contribute in other areas moving forward. |
Adds codespell (v2.4.1) as a pre-commit hook to catch spelling errors
before commits are pushed. Configuration in pyproject.toml excludes
translation files (i18n), lock files, and known false positives (Qt enum names, unicode test strings, PyInstaller keywords).
Closes #2374
Description
Add
codespellspell-checking to the existing pre-commit hookconfiguration to automatically catch typos before code is committed.
.pre-commit-config.yaml:src/vorta/i18n/(non-English Qt Linguist translation files) anduv.lock(contains package nameastroid)tomlias additional dependency for pyproject.toml configreading
pyproject.toml:[tool.codespell]configuration sectionskip: i18n directory and.qmbinary files (for direct CLI usageoutside pre-commit)
ignore-words-list:doubleclick(Qt enumQSystemTrayIcon.ActivationReason.DoubleClick),caf(part of unicodecaféin test path),datas(PyInstallerAnalysis()keyword)Related Issue
Closes #2374
Motivation and Context
Issue #2371 identified several spelling errors (
incase,everytime,wont,posess,seperator) that had to be caught manually. Addingcodespell to pre-commit hooks prevents typos from reaching the codebase in
the first place, using the existing pre-commit infrastructure that
contributors already have set up.
How Has This Been Tested?
uv run pre-commit run codespell --all-files— passes clean with zerofindings
uv run pre-commit run --all-files— all 9 hooks passmisspellings (
speling,eror) — both were detecteddoubleclick→ Qt enum value intray_menu.py:39caf→ part of unicode literalcaf\u00e9(café) intest_utils.py:118datas→ PyInstaller API keyword inpackage/vorta.spec:23,57non-English words in translation files,
astroidpackage name in lockfile)
Screenshots (if appropriate):
N/A — No visual changes
Types of changes
functionality to change)
Checklist:
CONTRIBUTING guide.
I provide my contribution under the terms of the
license of this repository and I affirm the Developer
Certificate of Origin.