GreatDocs.spell_check()

Check spelling in documentation files and optionally docstrings.

Usage

Source

GreatDocs.spell_check(
    include_docs=True,
    include_docstrings=False,
    custom_dictionary=None,
    language="en",
    verbose=False
)
Note

In practice, you would normally use the great-docs spell-check CLI command rather than calling this method directly. See the CLI reference for details.

This method scans documentation files (.qmd, .md) for spelling errors using a dictionary-based approach. It intelligently skips code blocks, inline code, URLs, and common technical terms.

Parameters

include_docs: bool = True

If True, scan documentation files (.qmd, .md) for spelling errors. Default is True.

include_docstrings: bool = False

If True, also scan Python docstrings in the package. Default is False.

custom_dictionary: list[str] | None = None

List of additional words to consider correct (e.g., project-specific terms, library names). Default is None.

language: str = "en"

Language for spell checking. Currently supports “en” (English). Default is "en".

verbose: bool = False
If True, print detailed progress information. Default is False.

Returns

dict

A dictionary containing:

  • total_words: total number of words checked
  • misspelled: list of dicts with word, suggestions, files, contexts
  • by_file: dict mapping file paths to misspelled words in each file
  • skipped_files: list of files that couldn’t be read

Examples

Check spelling in documentation:

from great_docs import GreatDocs

docs = GreatDocs()
results = docs.spell_check()

print(f"Checked {results['total_words']} words")
print(f"Misspelled: {len(results['misspelled'])}")

for item in results['misspelled']:
    print(f"  {item['word']}: {item['suggestions'][:3]}")

Check with custom dictionary:

results = docs.spell_check(
    custom_dictionary=["griffe", "docstring", "navbar"]
)