Skip to content

Add configuration values auto markdown links to CHANGELOG.md #10889

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

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

blyxyas
Copy link
Member

@blyxyas blyxyas commented Jun 4, 2023

Related to this Zulip discussion.

Now cargo dev update_lints also includes configurations as Markdown links, so changes to configuration can be linked directly.
It links to this file (book/src/lint_configuration.md) because a new changelog may be deployed before the website is updated. So, in order to avoid broken links, this is the simplest way.

changelog:none

@rustbot
Copy link
Collaborator

rustbot commented Jun 4, 2023

r? @dswij

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 4, 2023
@xFrednet
Copy link
Member

xFrednet commented Jun 6, 2023

The implementation looks good to me, but I'm not sure, if we want to add clippy_lints as a dependency to cargo_dev @flip1995, do you have any thoughts?

@flip1995
Copy link
Member

flip1995 commented Jun 7, 2023

I don't really like depending on clippy_* crates from clippy_dev. This feels a little cyclic.

Also linking to source code instead of documentation feels wrong.

It also doesn't make things easier that the stable book is usually updated after the changelog is written.

It doesn't happen that often that a new configuration is added. Couldn't we add the link to it manually, if this happens? linkcheck should validate that we only add links that actually exist.

@xFrednet
Copy link
Member

xFrednet commented Jun 7, 2023

It also doesn't make things easier that the stable book is usually updated after the changelog is written.

Is to book updated, at the same time that the new version is released? I'm guessing that most people only check the changelog after a release. This would most likely be fine.

It doesn't happen that often that a new configuration is added. Couldn't we add the link to it manually, if this happens?

I mean we could, but it's very likely that the list will get outdated fast. Since we already collect the data I think it would be better to automatically add the lints. Maybe we can do it as part of cargo collect-metadata since that command has to be run after adding a new configuration anyways

@flip1995
Copy link
Member

flip1995 commented Jun 7, 2023

Maybe we can do it as part of cargo collect-metadata since that command has to be run after adding a new configuration anyways

Good idea, let's update the changelog from cargo collect-metadata then. I would still link to the book, even if the config is not there yet. At least, if linkcheck allows us to do so.

The wrong part of the link should just be the #<section> part at the end of the link. So the link would still work, it would just go to the start of the book page and wouldn't jump to the section of the config. Let's hope linkcheck agrees with this interpretation.

Is to book updated, at the same time that the new version is released?

IIUC, yes. The Clippy book rides the same release train as normal Clippy.

@flip1995
Copy link
Member

flip1995 commented Jun 7, 2023

FWIW, there is also a nightly/beta version of the book: https://doc.rust-lang.org/nightly/clippy/ But it would still have the same link problems as the stable version, since the Clippy book is deployed from the Rust repo, not the Clippy repo.

@xFrednet
Copy link
Member

xFrednet commented Jun 7, 2023

Nice, I was looking for something like that earlier. It should be fine linking to that one. We also link to the master version of our lint list.

But it would still have the same link problems as the stable version

Which problem do you mean? At the point when a changelog entry is added, it's already on rustc's master and the nightly book will also have been updated 🤔

@flip1995
Copy link
Member

flip1995 commented Jun 7, 2023

Which problem do you mean?

We run a link checker in CI, that verifies links in the book, so that we don't link to a 404 page. I'm not sure, if the link checker cares about the #<section> part of a link. If it does, we would only be able to add those links, once the config documentation is deployed in the book. If not (what I hope for) we don't have any problem.

@xFrednet
Copy link
Member

xFrednet commented Jun 7, 2023

The #<section> directive is mainly for browsers, to directly jump to a location. I would strongly guess that it would work perfectly. At the same time, I'm not really web developer ^^

@flip1995
Copy link
Member

flip1995 commented Jun 7, 2023

It should be fine linking to that one

I don't think we have to link to the nightly one in the changelog. The changelog gets written for the stable version. By the time people click on the changelog (through the rustc release notes) the stable book will already have the stable config values of the changelog in it.

@blyxyas blyxyas closed this Jun 11, 2023
@blyxyas blyxyas force-pushed the link-config-desc branch from 7bacfa8 to f93df98 Compare June 11, 2023 19:08
@blyxyas
Copy link
Member Author

blyxyas commented Jun 11, 2023

?
I just resetted the branch. Guess Github interprets reseting to upstream/master as closing the PR? Welp, I'm going to re-open it in a few minutes

@blyxyas blyxyas reopened this Jun 11, 2023
@blyxyas
Copy link
Member Author

blyxyas commented Jun 11, 2023

Could you re-review it? Now it works with cargo collect-metadata

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

LGTM. Only one comment. Please excuse my OCD. 😅

}
writeln!(
changelog_file,
"{changelog}<!-- begin autogenerated links to configuration documentation -->\n{}\n<!-- end autogenerated links to configuration documentation -->\n",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"{changelog}<!-- begin autogenerated links to configuration documentation -->\n{}\n<!-- end autogenerated links to configuration documentation -->\n",
"{changelog}<!-- begin autogenerated links to configuration documentation -->\n{}\n<!-- end autogenerated links to configuration documentation -->",

Now remove the extra newline and this is good to go. :shipit:

@flip1995
Copy link
Member

r=me once my comment is addressed. (You might want to squash the commits)

@bors delegate+

@bors
Copy link
Contributor

bors commented Jun 13, 2023

✌️ @blyxyas, you can now approve this pull request!

If @flip1995 told you to "r=me" after making some further change, please make that change, then do @bors r=@flip1995

@xFrednet
Copy link
Member

This new extra comment from bors, about r=me is awesome! Good to know :D

@flip1995
Copy link
Member

flip1995 commented Jun 13, 2023

Yes, I was excited about this too. I even thought about including an explanation what r=me means in my comment. Good to know, that bors does that now :)

@blyxyas
Copy link
Member Author

blyxyas commented Jun 13, 2023

Bors is truly AI blockchain-based machine learning technology

@xFrednet
Copy link
Member

I'm sure the profile picture is an NFT worth millions!

@blyxyas blyxyas force-pushed the link-config-desc branch from 5de579e to 013dbbc Compare June 13, 2023 14:22
@blyxyas
Copy link
Member Author

blyxyas commented Jun 13, 2023

@bors r=@flip1995

@bors
Copy link
Contributor

bors commented Jun 13, 2023

📌 Commit 013dbbc has been approved by flip1995

It is now in the queue for this repository.

bors added a commit that referenced this pull request Jun 13, 2023
Add configuration values auto markdown links to `CHANGELOG.md`

Related to [this Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Revisiting.20.20Clippy's.20configuration.20discover/near/363119950).

Now `cargo dev update_lints` also includes configurations as Markdown links, so changes to configuration can be linked directly.
It links to [this file](https://github.com/rust-lang/rust-clippy/blob/master/book/src/lint_configuration.md) (`book/src/lint_configuration.md`) because a new changelog may be deployed before the website is updated. So, in order to avoid broken links, this is the simplest way.

changelog:none
@bors
Copy link
Contributor

bors commented Jun 13, 2023

⌛ Testing commit 013dbbc with merge 6fbdf0f...

@bors
Copy link
Contributor

bors commented Jun 13, 2023

💔 Test failed - checks-action_test

@flip1995
Copy link
Member

run cargo collect-metadata if this fails

How ironic. Please rebase on current master and run that and then this should merge.

@blyxyas blyxyas force-pushed the link-config-desc branch from 013dbbc to 060c9bc Compare June 13, 2023 14:50
@blyxyas blyxyas force-pushed the link-config-desc branch from 060c9bc to d5b2f11 Compare June 13, 2023 14:52
@blyxyas
Copy link
Member Author

blyxyas commented Jun 13, 2023

@bors r=flip1995

@bors
Copy link
Contributor

bors commented Jun 13, 2023

📌 Commit d5b2f11 has been approved by flip1995

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jun 13, 2023

⌛ Testing commit d5b2f11 with merge 5164458...

@bors
Copy link
Contributor

bors commented Jun 13, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing 5164458 to master...

@bors bors merged commit 5164458 into rust-lang:master Jun 13, 2023
@blyxyas blyxyas deleted the link-config-desc branch October 5, 2023 09:03
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.

6 participants