8000 fix(init): stop naming a language from files inside dependency directories by tuyentran4992 · Pull Request #201 · habit-hooks/habit-hooks · GitHub
[go: up one dir, main page]

Skip to content

fix(init): stop naming a language from files inside dependency directories - #201

Merged
devill merged 1 commit into
habit-hooks:mainfrom
tuyentran4992:fix-init-dependency-directories
Nov 8, 2026
Merged

devill merged 1 commit into
habit-hooks:mainfrom
tuyentran4992:fix-init-dependency-directories

Conversation

@tuyentran4992
Copy link
Copy Markdown
Contributor

Closes #136.

init handed the raw git ls-files output straight to language detection, so a single .php file inside a node_modules that .gitignore does not cover (or vendor, site-packages, .venv, venv) was enough to name php — the same files the active plugins' own files globs already leave out.

The init path now drops files inside those directories before detection: no language is named from a file that only sits in one of them, a real PHP source elsewhere in the project still names php, and a file that merely resembles one of the names (src/vendorize.py) still names its language.

Test: tests/test_init_names_no_language_from_dependency_directories.py — one case per dependency directory, a real source file beside it, and both done when cases from the issue. Running alongside the existing init, recommend, report and listing tests: 6 failed / 41 passed before the change, 47 passed after.

…ories

`init` fed the raw `git ls-files` output to language detection, so a single `.php` file inside a `node_modules` that `.gitignore` does not cover was enough to name php. The init path now drops `node_modules`, `vendor`, `site-packages`, `.venv` and `venv` before detection, while a PHP source outside those directories is still named php.
@devill
devill merged commit d73b637 into habit-hooks:main Nov 8, 2026
2 checks passed
@devill
devill commented Nov 8, 2026
Copy link
Copy Markdown
Collaborator

Merged, although during review we found code duplication that introduced an inconsistency as a side effect. That will be addressed in a follow up refactor commit.

@devill
devill commented Nov 8, 2026
Copy link
Copy Markdown
Collaborator

Thanks for the contribution!

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.

init detects a language from one file inside a dependency directory

2 participants

0