No type hints on function return values #11

Open
opened 2025-11-15 03:44:14 +00:00 by snegov · 0 comments
Owner

No type hints on function return values

Priority: Low
Component: All
Type: Code Quality

Description

The codebase uses Python 3.6+ but most functions lack type hints, especially for return values. This makes the code harder to understand and prevents static type checking tools from catching bugs.

Examples

# Current
def _get_latest_backup(backups_dir: str):
    """Returns path to latest backup created in backups_dir or None."""

# Should be
def _get_latest_backup(backups_dir: str) -> Optional[os.DirEntry]:
    """Returns path to latest backup created in backups_dir or None."""

Scope

Affects most functions across:

  • curateipsum/backup.py
  • curateipsum/fs.py
  • curateipsum/cli.py

Proposed Solution

Add complete type hints to all functions, including imports from typing module where needed.

Benefits

  • Better IDE autocomplete
  • Static type checking with mypy
  • Improved documentation
  • Catch bugs earlier

Impact

Low - Code quality improvement, doesn't affect runtime behavior.

# No type hints on function return values **Priority:** Low **Component:** All **Type:** Code Quality ## Description The codebase uses Python 3.6+ but most functions lack type hints, especially for return values. This makes the code harder to understand and prevents static type checking tools from catching bugs. ## Examples ```python # Current def _get_latest_backup(backups_dir: str): """Returns path to latest backup created in backups_dir or None.""" # Should be def _get_latest_backup(backups_dir: str) -> Optional[os.DirEntry]: """Returns path to latest backup created in backups_dir or None.""" ``` ## Scope Affects most functions across: - `curateipsum/backup.py` - `curateipsum/fs.py` - `curateipsum/cli.py` ## Proposed Solution Add complete type hints to all functions, including imports from `typing` module where needed. ## Benefits - Better IDE autocomplete - Static type checking with mypy - Improved documentation - Catch bugs earlier ## Impact **Low** - Code quality improvement, doesn't affect runtime behavior.
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: snegov/cura-te-ipsum#11
No description provided.