Skip to content

Fix/150 tech detector exclude paths#170

Open
solo6760 wants to merge 6 commits into
ascherj:mainfrom
solo6760:fix/150-tech-detector-exclude-paths
Open

Fix/150 tech detector exclude paths#170
solo6760 wants to merge 6 commits into
ascherj:mainfrom
solo6760:fix/150-tech-detector-exclude-paths

Conversation

@solo6760

Copy link
Copy Markdown

Summary

Fix tech_detector to properly exclude vendor/build directories (node_modules, build, vendor, dist) and Python cache directories when detecting primary language. This ensures repos with bundled dependencies are correctly identified by their source language rather than the bundled code.

Issue

Closes #150

Changes

  • Added _should_skip_file() method to normalize paths and filter excluded directories
  • Implemented skip patterns for common non-source directories: /node_modules/, /vendor/, /dist/, /build/, /.git/, /__pycache__/, /.venv/, /venv/
  • Path normalization handles both Windows (\) and Unix (/) path separators
  • Filter applied before language detection to prevent bundled code from dominating counts

Testing

  • Unit tests pass (python -m pytest tests/unit/test_tech_detector.py -v python -m pytest tests/unit/test_tech_detector.py::TestTechDetector::test_build_directory_excluded -v) with no issues whatsoever.

Notes for Reviewers

The skip pattern matching requires slashes on both sides (e.g., /node_modules/) to avoid false positives with similarly-named directories like node_modules_backup. The path normalization step ensures consistent behavior across Windows and Unix systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tech detector counts vendored and build-output files, skewing language detection

1 participant