feat: support parsing multiple files#326
Conversation
8dd969f to
d7774d7
Compare
d7774d7 to
5ea410b
Compare
5ea410b to
7ae6302
Compare
7ae6302 to
f34ee63
Compare
f34ee63 to
10d59b0
Compare
10d59b0 to
3b14409
Compare
| def auto_detect_dependency_file_parser(self) -> list[AbstractParser]: | ||
| parsers: list[AbstractParser] = [] | ||
| for dependency_parser in DEPENDENCY_FILE_MAPPING.values(): | ||
| if dependency_parser().file_exists(): |
There was a problem hiding this comment.
It only auto detects files in the root directory for now. We'll update this behaviour in upcoming PRs.
3b14409 to
5d6386a
Compare
|
We are doing like 1 breaking change per week! |
|
I need a bit of convincing. Why do we want this? |
I'm trying to mimic the behaviour of other tools (i.e. osv-scanner) where you can feed it multiple files, and where you have the option of recursively find all your lock files within a directory. The best use case I can think of for this is a monorepo. For now it does not recursively look for files, it only find them in the CWD. This is something to implement later if this PR gets merged and we like the idea. |
Sky is the limit! Yes that's unfortunate, but I'm not planning any other major update anytime soon once we release 5.0.0. |
|
/lgtm review |
There was a problem hiding this comment.
🦉 lgtm Review
Score: Nitpicks 🤓
🔍 Summary
This PR introduces significant new functionality for handling multiple dependency files and improves the overall code structure. The refactoring in src/twyn/main.py and the introduction of a dedicated models.py are excellent changes that improve code clarity and separation of concerns. The changes are well-tested and the breaking change to the JSON output is correctly noted.
I found a couple of minor issues: an incorrect type hint and a small opportunity for code cleanup. After addressing these, the PR will be in great shape. Overall, great work!
More information
- Id:
cfb08c36675c4bb88d4808162af2beaa - Model:
gemini-2.5-pro - Created at:
2025-09-15T14:10:06.449091+00:00
Usage summary
- Request count:
2 - Request tokens:
109,721 - Response tokens:
8,873 - Total tokens:
118,594
See the 📚 lgtm-ai repository for more information about lgtm.
5d6386a to
f86e3b0
Compare
BREAKING CHANGE
f86e3b0 to
9efcfcd
Compare
Introduces the behaviour for supporting multiple lock files at once, as well as autodetecting them.
It does not yet support introducing multiple dependency files through the CLI.
It changes the json format output to https://github.com/elementsinteractive/twyn/pull/326/files#diff-ae0b15b531bda07c4292b5e4d8acb8b370f8a2e8c511a85ba548ad7d4491cc22R262
closes #325
BREAKING CHANGE