1515from exportify .common .config import CONFIG_ENV_VAR , ExportifyConfig , find_config_file , load_config
1616from exportify .export_manager import RuleEngine
1717from exportify .types import ValidationReport
18- from exportify .utils import detect_source_root , locate_project_root
18+ from exportify .utils import detect_source_root , display_path , locate_project_root
1919
2020
2121logger = logging .getLogger (__name__ )
@@ -46,12 +46,14 @@ def resolve_checks(all_checks: set[str], **flags: bool | None) -> set[str]:
4646
4747def get_all_source_roots (source_override : Path | None = None ) -> list [Path ]:
4848 """Get all source roots: primary (detected or overridden) + additional from config."""
49- source_root = source_override or detect_source_root ()
49+ source_root = ( source_override or detect_source_root ()). resolve ()
5050 additional_source_roots : list [Path ] = []
5151
5252 if config_path := find_config_file ():
5353 config = load_config (config_path )
54- additional_source_roots = config .project .additional_source_paths
54+ additional_source_roots = [
55+ Path (p ).resolve () for p in config .project .additional_source_paths
56+ ]
5557
5658 return [source_root , * additional_source_roots ]
5759
@@ -206,15 +208,23 @@ def print_output_validation_verbose(results: ValidationReport) -> None:
206208 CONSOLE .print (f"[red]Errors found: { len (results .errors )} [/red]" )
207209 CONSOLE .print ()
208210 for error in results .errors :
209- location = f"{ error .file } :{ error .line } " if error .line else str (error .file )
211+ location = (
212+ f"{ display_path (error .file )} :{ error .line } "
213+ if error .line
214+ else display_path (error .file )
215+ )
210216 CONSOLE .print (f"[red]ERROR[/red] { location } : [bold]{ error .code } [/bold]" )
211217 _print_error_in_validation (error )
212218 # Show warnings with full context
213219 if results .warnings :
214220 CONSOLE .print (f"[yellow]Warnings found: { len (results .warnings )} [/yellow]" )
215221 CONSOLE .print ()
216222 for warning in results .warnings :
217- location = f"{ warning .file } :{ warning .line } " if warning .line else str (warning .file )
223+ location = (
224+ f"{ display_path (warning .file )} :{ warning .line } "
225+ if warning .line
226+ else display_path (warning .file )
227+ )
218228 CONSOLE .print (f"[yellow]WARNING[/yellow] { location } " )
219229 _print_error_in_validation (warning )
220230 # Show metrics
@@ -231,12 +241,20 @@ def print_output_validation_concise(results: ValidationReport) -> None:
231241 """Output validation results in concise human-readable format."""
232242 if results .errors :
233243 for error in results .errors :
234- location = f"{ error .file } :{ error .line } " if error .line else str (error .file )
244+ location = (
245+ f"{ display_path (error .file )} :{ error .line } "
246+ if error .line
247+ else display_path (error .file )
248+ )
235249 CONSOLE .print (f"[red][ERROR][/red] { location } : { error .code } ({ error .message } )" )
236250
237251 if results .warnings :
238252 for warning in results .warnings :
239- location = f"{ warning .file } :{ warning .line } " if warning .line else str (warning .file )
253+ location = (
254+ f"{ display_path (warning .file )} :{ warning .line } "
255+ if warning .line
256+ else display_path (warning .file )
257+ )
240258 CONSOLE .print (f"[yellow][WARNING][/yellow] { location } : { warning .message } " )
241259
242260 # Show summary
@@ -261,19 +279,23 @@ def collect_py_files(paths: tuple[Path, ...], source: Path | None) -> list[Path]
261279 Returns:
262280 List of Python file paths to process.
263281 """
282+ from exportify .discovery .file_discovery import FileDiscovery
283+
284+ discovery = FileDiscovery ()
285+
264286 if not paths :
265287 source_root = source or detect_source_root ()
266- return list ( source_root . rglob ( "*.py" ) )
288+ return discovery . discover_python_files ( source_root )
267289
268290 all_files : list [Path ] = []
269291 for p in paths :
270292 if not p .exists ():
271293 print_error (f"Path does not exist: { p } " )
272294 raise SystemExit (1 )
273295 if p .is_file ():
274- all_files .append (p )
296+ all_files .append (p . resolve () )
275297 else :
276- all_files .extend (p . rglob ( "*.py" ))
298+ all_files .extend (discovery . discover_python_files ( p . resolve () ))
277299 return all_files
278300
279301
0 commit comments