Skip to content

Conversation

@mre
Copy link
Member

@mre mre commented Aug 29, 2025

I wasn't too happy with our input handling module anymore, so I tried to split up the functionality up into multiple smaller structs.

One benefit is that I got rid of the unreachable! branch for glob patterns, because that case can no longer happen: I introduced a new ResolvedInput type instead, which is the representation of plain file paths and raw inputs (strings, URLs, and stdin) where globs got resolved to paths as well.

The final result is an incremental improvement in my opinion. We could still do a lot more, however I wanted to keep the logic identical to before.

Details

  • Introduced InputResolver to centralize input source resolution and content extraction.
  • Moved content-related logic from Input to InputResolver.
  • Created new modules for input handling: content, core, resolver, and source.
  • Updated Collector to utilize InputResolver for obtaining input sources and contents.
  • Improved the docs

I wasn't too happy with our input handling module anymore, so I tried to split up the functionality up into multiple smaller structs.

One benefit is that I got rid of the `unreachable!` branch for glob patterns, because that case can no longer happen: I introduced a new `ResolvedInput` type instead, which is the representation of plain file paths and raw inputs (strings, URLs, and `stdin`) where globs got resolved to paths as well.

The final result is an incremental improvement in my opinion. We could still do a lot more, however I wanted to keep the logic identical to before.

## Details

- Introduced `InputResolver` to centralize input source resolution and content extraction.
- Moved content-related logic from `Input` to `InputResolver`.
- Created new modules for input handling: `content`, `core`, `resolver`, and `source`.
- Updated `Collector` to utilize `InputResolver` for obtaining input sources and contents.
- Improved the docs
@mre mre force-pushed the refactor-inputs branch from 205d9ea to e433f2d Compare August 29, 2025 11:50
Copy link
Member

@thomas-zahner thomas-zahner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, that look like a big improvement to me. Makes a lot of sense to split it up and the documentation is great!

I just wonder, if we still need get_input_sources.

@mre mre force-pushed the refactor-inputs branch from 003a907 to e139131 Compare August 29, 2025 17:57
@mre mre merged commit 213eca0 into master Aug 29, 2025
6 checks passed
@mre mre deleted the refactor-inputs branch August 29, 2025 18:02
@mre mre mentioned this pull request Aug 29, 2025
This was referenced Oct 21, 2025
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.

3 participants