Coverage for lintro / utils / environment / lintro_info.py: 63%

19 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-04-03 18:53 +0000

1"""Lintro installation information.""" 

2 

3from __future__ import annotations 

4 

5from dataclasses import dataclass 

6 

7 

8@dataclass 

9class LintroInfo: 

10 """Lintro installation information.""" 

11 

12 version: str 

13 install_path: str 

14 config_file: str | None 

15 config_valid: bool 

16 

17 @property 

18 def section_title(self) -> str: 

19 """Return the section title for display.""" 

20 return "Lintro" 

21 

22 def to_display_rows(self) -> list[tuple[str, str]]: 

23 """Return label-value pairs for rendering.""" 

24 rows: list[tuple[str, str]] = [ 

25 ("Version", self.version), 

26 ("Install Path", self.install_path), 

27 ("Config File", self.config_file or "(not found)"), 

28 ] 

29 if self.config_file: 

30 status = ( 

31 "[green]\u2713[/green]" if self.config_valid else "[red]\u2717[/red]" 

32 ) 

33 rows.append(("Config Valid", status)) 

34 return rows 

35 

36 def is_available(self) -> bool: 

37 """Return whether this section has data to display.""" 

38 return True