Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/douki/_base/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ class _GitIgnoreMatcher:
"""

def __init__(self, root: Path) -> None:
"""
title: Initialize the matcher with a root directory.
parameters:
root:
type: Path
"""
self._root: Path = root.resolve()
self._rules_by_dir: dict[Path, tuple[_GitIgnoreRule, ...]] = {}

Expand Down
3 changes: 3 additions & 0 deletions src/douki/_python/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ class _FuncExtractor(ast.NodeVisitor):
"""

def __init__(self) -> None:
"""
title: Initialize the extractor with empty state.
"""
self.results: list[FuncInfo] = []
self.in_class: bool = False
# Maps class name → full list of attrs (own + inherited)
Expand Down
3 changes: 3 additions & 0 deletions src/douki/_python/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class PythonLanguage(BaseLanguage):
"""

def __init__(self) -> None:
"""
title: Initialize the Python language backend.
"""
self._config: PythonConfig = PythonConfig()

@property
Expand Down
10 changes: 10 additions & 0 deletions src/douki/_python/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ def sync_source(
if not funcs:
return source

# Check for missing docstrings — every function, class, and module
# must have a docstring.
missing = [f for f in funcs if f.docstring_node is None]
if missing:
errors = []
for f in missing:
prefix = '<module>' if f.name == '<module>' else f"'{f.name}'"
errors.append(f'- {prefix}: missing docstring')
raise DocstringValidationError('\n'.join(errors))

lines = source.splitlines(keepends=True)
# Process in reverse line order so edits don't shift indices.
funcs_with_ds = [f for f in funcs if f.docstring_node is not None]
Expand Down
Loading
Loading