-
Notifications
You must be signed in to change notification settings - Fork 1.6k
We have now the CI ensure all doc strings remain formatted #16916
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @yazanmashal03 -- this is looking like a very nice improvement
Given the fact that this feature requires cargo nightly which we don't typically use in CI here is what I suggest:
- Remove the changes to CI and
rustfmt.toml
from this PR - Run the tool manually to format the examples (keep that in this PR)
- File a new ticket/PR with just the changes to
rustfmt.toml
which we can merge once theformat_code_in_doc_comments
feature is related in stable
@@ -17,6 +17,7 @@ | |||
|
|||
edition = "2021" | |||
max_width = 90 | |||
format_code_in_doc_comments = true # nightly-only feature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I run cargo fmt
now locally I see many warnings like this
(venv) andrewlamb@Andrews-MacBook-Pro-3:~/Software/datafusion$ cargo fmt
Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `format_code_in_doc_comments = true`, unstable features are only available in nightly channel.
Which I think means we have to wait until this feature is actually released in stable Rust to add it to this file
run: rustup toolchain install nightly | ||
|
||
- name: Run rustfmt (nightly) | ||
run: cargo +nightly fmt --all -- --config format_code_in_doc_comments=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @yazanmashal03
I am not sure what this check is doing - it seems to just run the fmt rather than check its output, for example
Which issue does this PR close?
Rationale for this change
This change ensures the CI process has all docs strings remain formatted.
What changes are included in this PR?
The rustfmt.toml enables the "format_code_in_doc_comments" feature. I also added the ci file in the .github directory.
Are these changes tested?
Yes, running "cargo +nightly fmt --all -- --config format_code_in_doc_comments=true" can duplicate the effect of this solution.
Are there any user-facing changes?
No. And thank you for a first-issue. I hope it is good, and if there is anything I can add, let me know.