Skip to content

Documentation-coverage scan doesn't prune os.walk, walks every file in node_modules/.git/etc. anyway #256

Description

@squid-protocol

File: guidestar_lens.py
Labels: bug, performance, priority:medium
pythonfor root_dir, dirs, files in os.walk(self.root):
dir_path = Path(root_dir)
if any(part in self._gs_config.get("IGNORED_DIRECTORIES", set()) for part in dir_path.parts):
continue
...
continue only skips processing files for the current directory — it never mutates dirs in place (dirs[:] = [...]), which is the only way to stop os.walk from recursing into a subdirectory. So os.walk still descends into and enumerates every single file inside node_modules, .git, vendor, build, etc. before this check discards the result. On any JS/Node repo with a large node_modules, this is a full, pointless filesystem traversal running before the "real" aperture-filtered scan even begins — directly undercutting the project's own "100,000+ LOC/s" performance claims. (This check also compares dir_path.parts against IGNORED_DIRECTORIES without lowercasing, so it inherits the same case-mismatch as Issue #11 independently.)
Fix: prune in place: dirs[:] = [d for d in dirs if d.lower() not in ignored_lower] before the file loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnintended behavior or logic failure in the enginethreat: false-negativeAccuracy tuning: Engine missed a bypass or vulnerability

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions