-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Improve documentation for fast-unstake
pallet
#14101
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.
This looks great, let me push out another version of docify that uses the original span locations so we get exact source text and then should be good RE your issue you showed me of comments not copying over. Will also remove the need for prettyplease dependency
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
…/substrate into kiz-improve-fast-unstake-dcos
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
btw, also planning on doing a thing eventually that by default will make it so you don't have to write |
The main components of this pallet are: | ||
- [`Pallet`], which implements all of the dispatchable extrinsics of the pallet, among | ||
other public functions. | ||
- The subset of the functions that are dispatchable can be identified either in |
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.
- The subset of the functions that are dispatchable can be identified either in | |
- The subset of the functions that are dispatchable can be identified either in |
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.
It should be an indented list, why are you suggesting otherwise?
frame/fast-unstake/src/lib.rs
Outdated
//! | ||
//! ## Overview | ||
//! | ||
//! This pallet that's designed to JUST do the following: |
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.
//! This pallet that's designed to JUST do the following: | |
//! This pallet is designed to JUST do the following: |
Although TBH I'm not sure what purpose this line serves, can it be removed?
Also, since we are improving the docs: I feel like the text that follows could use some structure, e.g. subsections or bullet points. Right now it seems (to me) like an unapproachable wall of text.
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.
I find your comment about this sentence fair, but not the rest. It is organized into a series of paragraphs and is following a logical chain. Perhaps if you describe further which part of it is unapprochable, I can improve.
Nonetheless though, this is in realm of subjective measures harder to align on. I don't think we can ever make everyone write docs that are understandable to everyone. Simply things like different ways of thinking and language levels will make that impossible.
What we want to ensure is at least following the structure mentioned in #14115, and doing your best.
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.
Fair enough, it was indeed a subjective impression I got as someone new to this pallet. Reading my post again it sounds more critical than I intended it to be, sorry. 🙈 To be concrete, I would suggest adding subsections like e.g. "Registration" and "Checking". Feel free to ignore if you think that's unnecessary. The new docs are already awesome as is!
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>
Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>
…/substrate into kiz-improve-fast-unstake-dcos
docify 0.1.11 should fix the termcolor issue |
bot rebase |
Rebased |
bot merge |
Waiting for commit status. |
Merge cancelled due to error. Error: Statuses failed for 351ee05 |
@@ -1520,6 +1520,17 @@ pub mod tests { | |||
} | |||
} | |||
|
|||
/// Prelude to be used for pallet testing, for ease of use. | |||
#[cfg(feature = "std")] | |||
pub mod testing_prelude { |
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.
Do we want to use the same naming in #13454?
…rove-fast-unstake-dcos
bot merge |
* improve documentation of fast-unstake pallet * using Sam's crate now * fix * remove stuff not needed * Some updates * use new prelude. * update * some other fancy docs * Update frame/fast-unstake/src/lib.rs Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> * Update frame/support/procedural/src/pallet/expand/mod.rs Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> * update * Update frame/fast-unstake/src/lib.rs Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> * update * fix no_std issue by updating to latest version of docify * get things compiling by adding a use for StakingInterface * fix docify paths to their proper values, still not working because bug * embed working 🎉 * update syn * upgrade to docify v0.1.10 for some fixes * Apply suggestions from code review Co-authored-by: Juan <juangirini@gmail.com> Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com> * improve docs * Update frame/support/procedural/src/pallet/expand/doc_only.rs Co-authored-by: Juan <juangirini@gmail.com> * fmt * fix * Update frame/support/procedural/src/pallet/expand/doc_only.rs Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> * Update frame/support/procedural/src/pallet/expand/config.rs Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> * Update frame/support/procedural/src/pallet/expand/config.rs Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> * remove redundant * update docify rev * update. * update. * update lock file --------- Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com> Co-authored-by: Sam Johnson <sam@durosoft.com> Co-authored-by: Juan <juangirini@gmail.com> Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com> Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> Co-authored-by: parity-processbot <>
@@ -310,6 +311,65 @@ pub fn process_generics(def: &mut Def) -> syn::Result<Vec<ResultOnEmptyStructMet | |||
Ok(on_empty_struct_metadata) | |||
} | |||
|
|||
fn augment_final_docs(def: &mut Def) { |
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.
@kianenigma this actually prevents #[deny(missing_docs)]
from working correctly for storage items, since they now always have a default doc comment.
We could only do this if there is already a comment, or always emit a warning when there is not doc. WDYT?
This is my effort to try and improve the documentation of a single pallet, in order to identify some patters that we can try and enforce across all pallets. Most of my efforts was around making the experience of navigating the rust-docs better.
Should close #13299 with collaboration with @ggwpez
relates to paritytech/polkadot-sdk-docs#1
Should go hand-in-hand with #13987 which is improving some macros to improve storage docs.
Some of the things that I have done in macros:
mod
pallet that tells you where you should go. This can also live in the top level file, perhaps, but then we have to repeat it all the time.Pallet
function.mod dispatchables
also points toPallet
. Both of these is to establish the fact that the "real thing" is the method defined onPallet
.mod storage_types
, but if the storage is private, we copy-paste the doc over.frame_support::testing_prelude
that can be used.