Open jzumwalt opened 6 months ago
I don't have permission to create a Pull request, but I have fixed this locally.
Exclude directory fully resolved here: https://github.com/simonw/symbex/blob/071d8a841c78718713cd4bd83bddd55544d639c8/symbex/cli.py#L55
When files are evaluated https://github.com/simonw/symbex/blob/071d8a841c78718713cd4bd83bddd55544d639c8/symbex/cli.py#L399
change to:
if any(path.resolve().is_relative_to(exclude) for exclude in excludes): continue
Also noticed that path lib has a function that appears to be identical to is_subpath
so I used that instead.
def is_subpath(path: pathlib.Path, parent: pathlib.Path) -> bool: try: path.relative_to(parent) return True except ValueError: return False
def is_relative_to(self, *other): """Return True if the path is relative to another path or False. """ try: self.relative_to(*other) return True except ValueError: return False
I believe I found a case where
excludes
aren't found because the file path is relative, but the directory has been fully resolved.To Reproduce
symbex "*" -x .venv -s
Expected
Actual