Coverage for lintro / utils / environment / project_info.py: 67%
18 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
1"""Project detection information."""
3from __future__ import annotations
5from dataclasses import dataclass
8@dataclass
9class ProjectInfo:
10 """Project detection information."""
12 working_dir: str
13 git_root: str | None
14 languages: list[str]
15 package_managers: dict[str, str]
17 @property
18 def section_title(self) -> str:
19 """Return the section title for display."""
20 return "Project"
22 def to_display_rows(self) -> list[tuple[str, str]]:
23 """Return label-value pairs for rendering."""
24 rows: list[tuple[str, str]] = [
25 ("Working Dir", self.working_dir),
26 ("Git Root", self.git_root or "(not a git repo)"),
27 ("Languages", ", ".join(self.languages) or "(none detected)"),
28 ]
29 for pm, manifest in sorted(self.package_managers.items()):
30 rows.append((pm, manifest))
31 return rows
33 def is_available(self) -> bool:
34 """Return whether this section has data to display."""
35 return True