rust-lang / rust-lang/rust-clippy

Warn against here-links in doc comments

Open
#13,480 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lint
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

What it does

Warns when a user writes [here], [click here], [link] or [this link] in a doc comment. This lint would be in the “Style” category, as I think it is fairly universally agreed-upon that such links should be avoided (I have not seen arguments to the contrary, at least).

Advantage

Links of this form are widely considered bad for accessibility[1][2][3], among other reasons. It is recommended to change the link text to a short description of what is at the URL instead.

Drawbacks

Sometimes it is non-obvious how to rewrite a here-link into the preferred form, which could increase friction when writing docs.

Example
/// For more details on this function, click [here](crate).

Could be written as:

/// For more details on this function, see [the crate-level docs](crate).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue does not name an implementation file or test. Start by locating Clippy's existing documentation-comment style lints and their tests, then determine where the proposed patterns should be recognized. Done means the Style lint warns for the four listed link texts and has coverage for the examples, while allowing descriptive link text.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.