Skip to content

Refactor input dumping and path retrieval with extension filtering #1648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

mre
Copy link
Member

@mre mre commented Mar 2, 2025

Refactor the dump-inputs functionality to print all files checked for links and implement file path retrieval with extension filtering in the Input module.

I added this because it was hard to troubleshoot the extension changes, but I figured it would also be helpful to people who want to see which files would be checked when they write lychee ..

As an added benefit, dump-inputs now behaves more like the check command and properly ignores hidden files etc.

This is a follow-up to #1559.

Base automatically changed from extensions to master March 2, 2025 16:47
@mre mre requested a review from thomas-zahner March 2, 2025 22:48
@mre mre force-pushed the extensions-refactor branch from b68e5c3 to bfd0094 Compare May 19, 2025 08:52
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.

Whew, that's quite a lot of changes. I didn't check every single detail nor did I test it locally. Are the existing tests covering the changes? I just see that you made a lot of changes and didn't add any tests but removed some.

@mre mre force-pushed the extensions-refactor branch from bfd0094 to 7a40abf Compare May 23, 2025 20:43
@mre mre requested a review from thomas-zahner May 23, 2025 23:18
// Stop on the first match.
file_extensions: FileExtensions,
) -> impl Stream<Item = Result<InputContent>> {
) -> impl Stream<Item = Result<PathBuf>> + '_ {
Copy link
Member

@thomas-zahner thomas-zahner Jun 12, 2025

Choose a reason for hiding this comment

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

Wouldn't it make sense to update the return type to something like impl Stream<Item = Result<InputSource>> and yield the input sources directly? Then we could also print InputSource::Stdin and the other cases with for example <stdin>. Alternatively, maybe we could introduce a new enum type?

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh, that's clever. 🤔

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.

2 participants