This document explains how we handle spelling in the Torrust Tracker Deployer project using CSpell.
We use CSpell for spell checking across all project files including documentation, comments, and code identifiers. This helps maintain consistency and professionalism in our codebase.
Our spell checking is configured through cspell.json in the project root:
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"dictionaryDefinitions": [
{
"name": "project-words",
"path": "./project-words.txt",
"addWords": true
}
],
"dictionaries": ["project-words"],
"ignorePaths": ["target", "/project-words.txt"]
}The project-words.txt file contains:
- Technical terms specific to our domain
- Proper nouns (company names, product names)
- Acronyms and abbreviations
- Valid identifiers that aren't in standard dictionaries
# Run CSpell individually
cargo run --bin linter cspell
# Run all linters including CSpell
cargo run --bin linter all# Check all files
cspell .
# Check with suggestions and context
cspell . --no-progress --show-suggestions --show-context
# Check specific files
cspell "src/**/*.rs" "docs/**/*.md"
# Get list of unknown words
cspell --words-only --unique .For genuine spelling errors, fix them directly in the source files.
For legitimate technical terms, proper nouns, or domain-specific vocabulary:
# Add words to project-words.txt (one per line, sorted alphabetically)
echo "kubernetes" >> project-words.txt
echo "dockerfile" >> project-words.txt
sort -u project-words.txt -o project-words.txtValid variable names, function names, and identifiers should be added to the dictionary:
# Examples in project-words.txt
ansible
containerd
rustfmt
shellcheck
torrust
For security tokens, API keys, and similar strings, there are several approaches:
-
Add to Dictionary (Recommended):
# In project-words.txt - for test/fixture tokens only AAAAB EAAAADAQABAAABAQC -
Use CSpell Ignore Comments:
// cspell:disable-next-line const API_TOKEN: &str = "abc123def456ghi789"; /* cspell:disable */ const COMPLEX_TOKEN: &str = "very-long-generated-token-here"; /* cspell:enable */
-
Configuration Patterns:
{ "ignoreRegExpList": ["/auth_token: .*/g", "/api[_-]key: .*/gi"] }
- ✅ Technical terms:
kubernetes,dockerfile,ansible - ✅ Project names:
torrust,opentofu - ✅ Tool names:
rustfmt,shellcheck,yamllint - ✅ Domain concepts:
provisioning,infra - ✅ Test fixture data (non-sensitive)
- ❌ Actual misspellings
- ❌ Typos in variable names
- ❌ Real secrets or production tokens
- ❌ Random strings that could mask real errors
- Be Conservative: Only add words you're confident are correct
- Use Lowercase: Add words in lowercase unless they're proper nouns
- Check Alternatives: Consider if there's a standard spelling first
- Document Context: Add comments in
project-words.txtfor unusual terms
Example project-words.txt structure:
# Infrastructure and DevOps
ansible
containerd
dockerfile
kubernetes
multipass
opentofu
# Project-specific terms
torrust
rustfmt
shellcheck
# Test fixtures (non-sensitive)
testkey
mocksecret
-
Too Many False Positives
- Review and clean up the project dictionary
- Use more specific ignore patterns
- Consider CSpell ignore comments for edge cases
-
Missing Technical Terms
- Add them to
project-words.txt - Keep them lowercase unless proper nouns
- Sort alphabetically for maintainability
- Add them to
-
Generated or Binary Content
- Add paths to
ignorePathsincspell.json - Use glob patterns to exclude file types
- Add paths to
- Check CSpell suggestions:
cspell --show-suggestions <file> - View CSpell documentation: https://cspell.org/docs/
- Review existing patterns in
cspell.json
CSpell is included in the mandatory pre-commit checks:
cargo run --bin linter all # Includes CSpellThe spell checker runs automatically in CI/CD pipelines as part of the linting process.
Consider installing CSpell extensions for your IDE:
- VS Code: "Code Spell Checker" extension
- Other IDEs: Check CSpell documentation for integration options
- Consistency: Maintain professional spelling across all project content
- Quality: Catch typos early in the development process
- Maintainability: Keep a clean, well-organized project dictionary
- Developer Experience: Provide clear guidance for handling spelling issues
By following these guidelines, we ensure that our codebase maintains high quality while accommodating the technical nature of our domain vocabulary.