Skip to content

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

Closed

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.

Activity

  1. added
    bug
    threat: false-negative
    on Jul 18, 2026
  2. added a commit that references this issue on Aug 4, 2026
    32e6fa6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugthreat: false-negative

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions