Skip to content
Merged
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
20 changes: 16 additions & 4 deletions src/exportify/validator/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ def validate_file(
) -> tuple[list[ValidationError | ValidationWarning], int, ast.AST | None]:
"""Validate a single Python file and count lateimport calls.

Args:
file_path: Path to Python file to validate

Returns:
Tuple of (list of issues, count of lateimport calls, parsed AST tree or None)
"""
issues, _, _ = self._validate_file_with_metrics(file_path)
return issues

def _validate_file_with_metrics(
self, file_path: Path
) -> tuple[list[ValidationError | ValidationWarning], int, ast.AST | None]:
"""Validate a single Python file and count lateimport calls.

Args:
file_path: Path to Python file to validate

Expand Down Expand Up @@ -274,7 +288,7 @@ def validate(self, file_paths: list[Path] | None = None) -> ValidationReport:
parsed_trees: dict[Path, ast.AST] = {}

for file_path in file_paths:
results, count, tree = self.validate_file(file_path)
results, count, tree = self._validate_file_with_metrics(file_path)

# Separate errors and warnings
errors = [r for r in results if isinstance(r, ValidationError)]
Expand All @@ -296,9 +310,7 @@ def validate(self, file_paths: list[Path] | None = None) -> ValidationReport:

for init_file in init_files:
tree = parsed_trees.get(init_file)
consistency_issues = self.consistency_checker.check_file_consistency(
init_file, tree=tree
)
consistency_issues = self.consistency_checker.check_file_consistency(init_file, tree=tree)
consistency_checks += len(consistency_issues)

# Convert ConsistencyIssue to ValidationError/Warning
Expand Down
Loading