Skip to content

Commit

Permalink
Fix for files that comes from the site-packages
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Dec 25, 2024
1 parent 09dc59d commit 35801f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion prospector/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def absolute_path(self) -> Optional[Path]:
def relative_path(self, root: Optional[Path]) -> Optional[Path]:
if self._path is None:
return None
return self._path.relative_to(root) if root else self._path
if root is None:
return self
return self._path.relative_to(root) if self._path.is_relative_to(root) else self._path

def __repr__(self) -> str:
return f"{self._path}:L{self.line}:{self.character}"
Expand Down

0 comments on commit 35801f7

Please sign in to comment.