Skip to content

feat: warn when exclusive '..' syntax is used in accept ranges#2169

Closed
mre wants to merge 2 commits into
masterfrom
warn-exclusive-accept-range
Closed

feat: warn when exclusive '..' syntax is used in accept ranges#2169
mre wants to merge 2 commits into
masterfrom
warn-exclusive-accept-range

Conversation

@mre

@mre mre commented Apr 25, 2026

Copy link
Copy Markdown
Member

Closes #2178.

The exclusive .. range syntax follows Rust semantics and excludes the upper bound, which is a common source of confusion (e.g. 301..302 only accepts 301). Emit a warning to make this visible.

This could be promoted to an error or downgraded to a hint once #2021 lands.

mre added 2 commits April 27, 2026 12:03
The exclusive '..' range syntax follows Rust semantics and excludes the upper bound, which is a common source of confusion (e.g. '301..302' only accepts 301, not 302). Emit a warning to help users notice the mismatch.
@thomas-zahner thomas-zahner force-pushed the warn-exclusive-accept-range branch from f821a12 to 0fe385d Compare April 27, 2026 10:03
@thomas-zahner

Copy link
Copy Markdown
Member

Hmm actually this is not getting logged :/

The reason being that the logger is initialised only after the options are parsed.

    let mut opts = LycheeOptions::parse();
    init_logging(&opts.config.verbose(), &opts.config.mode());

This would be another reason to add user-hints to lychee lib. I'm not sure how easy it is

@mre

mre commented Apr 27, 2026

Copy link
Copy Markdown
Member Author

Wellll.... I should have added a cli test for that. Nice catch.

@thomas-zahner

thomas-zahner commented Apr 28, 2026

Copy link
Copy Markdown
Member

I've now cherry picked it into #2021. The user hints are a nice workaround for this issue. It's nice that these two PRs coincided. I think other workaround wouldn't be so nice. We would have to initialise the logger with some dummy verbosity which would be quite a hack.

I'm closing this in favour of #2021.

@thomas-zahner thomas-zahner mentioned this pull request Apr 28, 2026
@mre mre deleted the warn-exclusive-accept-range branch April 28, 2026 19:49
@mre

mre commented Apr 28, 2026

Copy link
Copy Markdown
Member Author

Yes, makes a lot of sense. Than for picking that up.

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.

Range syntax for accepted status codes not working

2 participants