Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add feature: no-metadata-doc which removes doc from metadata and full-metadata which build metadata with all doc #10493

Merged
merged 5 commits into from
Jan 17, 2022

Conversation

thiolliere
Copy link
Contributor

@thiolliere thiolliere commented Dec 15, 2021

Fix #9235

Currently the metadata contains some doc for some types.

This PR add 2 new features:

  • no-metadata-docs which most docs from types. and docs from storage and constant. Note: this doesn't remove docs from other types which define scale_info(capture_doc = "always") if some other types make use of such attribute, their crate should provide a feature to remove their doc as well. (in substrate I'm not aware of other types always capturing docs).
  • full-metadata-docs which will add the doc for most types. It simply activate the feature scale_info/docs which enables docs on types by default. So all types that end up in the metadata will have their documentation.

Note: this PR is not a breaking change, current behavior is still the default behavior.

TODO:

  • test for event/call/error.

@github-actions github-actions bot added the A3-in_progress Pull request is in progress. No review needed at this stage. label Dec 15, 2021
@thiolliere thiolliere marked this pull request as ready for review December 16, 2021 06:51
@thiolliere thiolliere requested a review from a team as a code owner December 16, 2021 06:51
@github-actions github-actions bot added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Dec 16, 2021
@thiolliere thiolliere added B3-apinoteworthy C1-low PR touches the given topic and has a low impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. labels Dec 16, 2021
@thiolliere thiolliere changed the title Add feature: no-metadata-doc which removes doc from metadata Add feature: no-metadata-doc which removes doc from metadata and full-metadata which build metadata with all doc Dec 16, 2021
@thiolliere thiolliere added this to In progress in Runtime via automation Dec 16, 2021
@thiolliere thiolliere moved this from In progress to Please Review in Runtime Dec 16, 2021
Copy link
Member

@shawntabrizi shawntabrizi left a comment

Choose a reason for hiding this comment

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

makes sense to me

Runtime automation moved this from Please Review to Needs Audit Jan 12, 2022
@@ -137,6 +137,8 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
let count = COUNTER.with(|counter| counter.borrow_mut().inc());
let macro_ident = syn::Ident::new(&format!("__is_call_part_defined_{}", count), span);

let capture_docs = if cfg!(feature = "no-metadata-docs") { "never" } else { "always" };
Copy link
Contributor

Choose a reason for hiding this comment

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

would have liked a test that would fail if the rust team decided to change these two pairs to Never and Always, but I guess that's extremely unlikely at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is scale-info crate, I think if they do such change, they will do compile-time error for invalid input

@bkchr bkchr merged commit 963ee8a into master Jan 17, 2022
@bkchr bkchr deleted the gui-remove-metadata-doc-unless-feature branch January 17, 2022 21:21
Runtime automation moved this from Needs Audit to Done Jan 17, 2022
@shawntabrizi shawntabrizi moved this from Done to Archive in Runtime Jan 20, 2022
grishasobol pushed a commit to gear-tech/substrate that referenced this pull request Mar 28, 2022
…ull-metadata` which build metadata with all doc (paritytech#10493)

* add features to remove or add doc

* fmt

* add test for event/error/call

* fmt
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
…ull-metadata` which build metadata with all doc (paritytech#10493)

* add features to remove or add doc

* fmt

* add test for event/error/call

* fmt
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature flags to disable docs in metadata
6 participants