gui.model.finding_location(finding, root)
Where to open a finding and how to label it.
Parameters
| finding |
Finding |
The finding. |
required |
| root |
Path | str |
The repository root. |
required |
Returns
| Location |
Location |
The label for the table and the file and line for the editor. |
Examples
from pathlib import Path
from tempfile import TemporaryDirectory
from spotregen import load_spec, make_sample_repo, run_checks
from spotregen.gui.model import finding_location
with TemporaryDirectory() as tmp:
root = make_sample_repo(Path(tmp) / "demo")
(root / "scripts").mkdir()
(root / "scripts/use_it.py").write_text("from samplepkg.core import calc\n")
finding = run_checks(load_spec(root))[0]
print(finding.code, finding_location(finding, root).label)
DEL01 regen/units/core.calc.toml:1