Skip to content

Add codespell spell-checking to pre-commit hooks#2375

Open
mr-raj12 wants to merge 2 commits intoborgbase:masterfrom
mr-raj12:feature/add-codespell-precommit
Open

Add codespell spell-checking to pre-commit hooks#2375
mr-raj12 wants to merge 2 commits intoborgbase:masterfrom
mr-raj12:feature/add-codespell-precommit

Conversation

@mr-raj12
Copy link
Contributor

@mr-raj12 mr-raj12 commented Feb 4, 2026

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 codespell spell-checking to the existing pre-commit hook
configuration to automatically catch typos before code is committed.

.pre-commit-config.yaml:

  • Add codespell hook (v2.4.1) after the ruff hooks
  • Exclude src/vorta/i18n/ (non-English Qt Linguist translation files) and
    uv.lock (contains package name astroid)
  • Include tomli as additional dependency for pyproject.toml config
    reading

pyproject.toml:

  • Add [tool.codespell] configuration section
  • skip: i18n directory and .qm binary files (for direct CLI usage
    outside pre-commit)
  • ignore-words-list: doubleclick (Qt enum
    QSystemTrayIcon.ActivationReason.DoubleClick), caf (part of unicode
    café in test path), datas (PyInstaller Analysis() 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. Adding
codespell 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 zero
    findings
  • uv run pre-commit run --all-files — all 9 hooks pass
  • Verified codespell catches real typos by testing with deliberate
    misspellings (speling, eror) — both were detected
  • Verified all 3 suppressed words are genuine false positives:
    • doubleclick → Qt enum value in tray_menu.py:39
    • caf → part of unicode literal caf\u00e9 (café) in
      test_utils.py:118
    • datas → PyInstaller API keyword in package/vorta.spec:23,57
  • Verified all excluded paths only contain false positives (hundreds of
    non-English words in translation files, astroid package name in lock
    file)

Screenshots (if appropriate):

image

N/A — No visual changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing
    functionality to change)

Checklist:

  • I have read the
    CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the
license of this repository and I affirm the Developer
Certificate of Origin
.

@mr-raj12 mr-raj12 force-pushed the feature/add-codespell-precommit branch from 7aac696 to ca283e3 Compare February 4, 2026 15:10
@m3nu
Copy link
Contributor

m3nu commented Feb 4, 2026

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:

  • PR Fix spelling errors in comments, docstrings, and UI widget names #2373 found only 6 typos across the entire codebase, all in comments/docstrings/widget names rather than user-facing text
  • The configuration already requires ignoring 3 legitimate words (doubleclick, caf, datas) and excluding 2 paths
  • Over time, more false positives will accumulate, requiring ongoing maintenance of the ignore list

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!

@mr-raj12
Copy link
Contributor Author

mr-raj12 commented Feb 4, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add spell-checking to pre-commit hooks

2 participants