Skip to content

fix: add check for image with embedded link - #16773

Open
Francisco-Andre-Martins wants to merge 1 commit into
rust-lang:masterfrom
Francisco-Andre-Martins:fix/#16439-false-positive-missing-punctuation
Open

fix: add check for image with embedded link#16773
Francisco-Andre-Martins wants to merge 1 commit into
rust-lang:masterfrom
Francisco-Andre-Martins:fix/#16439-false-positive-missing-punctuation

Conversation

@Francisco-Andre-Martins

@Francisco-Andre-Martins Francisco-Andre-Martins commented Mar 28, 2026

Copy link
Copy Markdown

View all comments

This fix adds an aditional check, by checking if the previous element was an image, and ignoring the lack of punctuation for a subsequent link. An aditional test was added to account for this case.

Closes #16439

changelog: [doc_paragraphs_missing_punctuation]: fixed false positive on images with embedded link and added a test for such a case

This fix adds an aditional check, by checking if the previous
element was an image, and ignoring the lack of punctuation
for a subsequent link. An aditional test was added to account
for this case.

Closes rust-lang#16439
@rustbot

rustbot commented Mar 28, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in clippy_lints/src/doc

cc @notriddle

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Mar 28, 2026
@rustbot

rustbot commented Mar 28, 2026

Copy link
Copy Markdown
Collaborator

r? @llogiq

rustbot has assigned @llogiq.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: 7 candidates
  • 7 candidates expanded to 7 candidates
  • Random selection from Jarcho, dswij, llogiq, samueltardieu

@rustbot

rustbot commented Mar 28, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@github-actions

Copy link
Copy Markdown

Lintcheck changes for 71e4ac9

Lint Added Removed Changed
clippy::doc_paragraphs_missing_punctuation 0 16 9

This comment will be updated if you push new changes

current_paragraph = None;
},
Event::InlineHtml(_) | Event::Start(Tag::Image { .. }) | Event::End(TagEnd::Image) => {
Event::InlineHtml(_) | Event::Start(Tag::Image { .. }) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It should be any kind of hyperlink, not just an image.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/// See: <https://example.com>

@Francisco-Andre-Martins Francisco-Andre-Martins Apr 1, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

However you have the following example:
I like potatoes
Which I think should have a comma at the end.

I like potatoes [potatoes](https://en.wikipedia.org/wiki/Potato)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@BenjaminBrienen sorry to bother, just to check if this didn't get lost in your inbox

@BenjaminBrienen BenjaminBrienen Apr 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree. Maybe we could base it on whether the URL is bare or not? Or maybe use the : as punctuation if there is only a url after? I would rather not have false positives.

another example that should not trigger the lint:

See: [GitHub: rust-lang/rust-clippy](<https://github.com/rust-lang/rust-clippy>)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

of course my remark is not blocking and this is objectively already an improvement, so maybe my comment could be a follow up

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Still taking a look on this, if relevant still

@Francisco-Andre-Martins Francisco-Andre-Martins Apr 21, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@BenjaminBrienen I looked into the code, and there is already a test that explicitly considers that autolinks should receive coverage. (I found out when I finally managed to get a fix for it, and found out I was failing tests, lol) . And I am not sure I do want to change the meaning of the lint (unless everyone agrees to it)

enum Exceptions {
    /// Question marks are fine?
    QuestionMark,
    /// Exclamation marks are fine!
    ExclamationMark,
    /// Ellipses are ok too…
    Ellipsis,
    /// HTML content is however not checked:
    /// <em>Raw HTML is allowed as well</em>
    RawHtml,
    /// The raw HTML exception actually does the right thing to autolinks:
    /// <https://spec.commonmark.org/0.31.2/#autolinks>
    //~^ doc_paragraphs_missing_punctuation
    MarkdownAutolink,
    /// This table introduction ends with a colon:
    ///
    /// | Exception      | Note  |
    /// | -------------- | ----- |
    /// | Markdown table | A-ok  |
    MarkdownTable,
}

@Francisco-Andre-Martins

Copy link
Copy Markdown
Author

@llogiq sorry to bother, but it seems that this may have gotten lost in your inbox, if you're not the right maintainer, do you mind pointing me in the right direction?

@Francisco-Andre-Martins

Copy link
Copy Markdown
Author

@llogiq Has this gotten lost?

@Francisco-Andre-Martins

Copy link
Copy Markdown
Author

r? clippy

@rustbot rustbot assigned Jarcho and unassigned llogiq Jun 8, 2026
@blyxyas

blyxyas commented Jun 14, 2026

Copy link
Copy Markdown
Member

Hello @Francisco-Andre-Martins, I hope that you don't mind we using this contribution to teach @medzernik some things about reviewing (they were very interested!).

cc @medzernik Check out this comment first. This one is a little bit different due to this pull request being about documentation. We parse it will pulldown-cmark, so take that into account.

@medzernik

Copy link
Copy Markdown

r? @medzernik

@rustbot rustbot assigned medzernik and unassigned Jarcho Jun 14, 2026
@Francisco-Andre-Martins

Copy link
Copy Markdown
Author

Hello @Francisco-Andre-Martins, I hope that you don't mind we using this contribution to teach @medzernik some things about reviewing (they were very interested!).

cc @medzernik Check out this comment first. This one is a little bit different due to this pull request being about documentation. We parse it will pulldown-cmark, so take that into account.

No problem, glad to help!

@medzernik medzernik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems to work from my testing... I think I approve? :D

View changes since this review

@blyxyas blyxyas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for addressing this issue! ❤️ ฅ•ω•ฅ

Now, let's see how this works.
@rustbot delegate @medzernik

View changes since this review

@rustbot

rustbot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

✌️ @Francisco-Andre-Martins, you can now merge this pull request!

If @blyxyas told you to merge after making some further change, then please make that change and post @rustbot merge.

View changes since this delegation.

@blyxyas

blyxyas commented Jul 6, 2026

Copy link
Copy Markdown
Member

Error in my command! I forgot the =

@rustbot delegate=@medzernik

@rustbot

rustbot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Error: merge handler unexpectedly failed in this comment: no base sha

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@blyxyas

blyxyas commented Jul 6, 2026

Copy link
Copy Markdown
Member

Sorry for the ping @Francisco-Andre-Martins, I'll contact the infra team for that last message and see we can fix this issue.

@blyxyas

blyxyas commented Jul 6, 2026

Copy link
Copy Markdown
Member

Anyway, do note that the delegation was registered in the database.

Seems that @medzernik got delegated the PR, even if triagebot didn't respond. So as soon as they take a second (probably the tenth) look, they're allowed to merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc_paragraphs_missing_punctuation fires when embedding linked images

8 participants