docs(rust): document every public enum variant and struct field (#179 D7) - #279
Merged
Merged
Conversation
…ib#179 D7) The crate documented its item declarations and rendered their members bare: 281 public enum variants, struct fields, flag constants and accessors with no line of their own -- 239 in the introspection registry, 42 in the shipped types. Those members are the whole of what a reader meets when they open FuncInfo, OptInputType or CandleSettings. Two of the three sources are canonical strings rather than new prose, so the docs are not a second place to keep in sync. FuncId's 176 variants take the function's own `hint` -- the same string the row carries into FuncInfo::hint and that C's TA_FuncInfo.hint reports -- plus a link to the method. The 33 flag constants mirror the comments on the matching #defines in include/ta_abstract.h, whose bit values flag_sync already pins. Only the group descriptions, the two data-kind enums and CandleSettings' eleven fields are written, because nothing canonical says them. #![warn(missing_docs)] keeps the count at zero. `warn` rather than `deny`, so a future rustc widening the lint cannot break a downstream build; the nightly's `cargo clippy -- -D warnings` is what makes it a gate here. That gate does not cover rustdoc's own lints, and this change adds 176 generated intra-doc links. So the nightly also gains E4's step, `RUSTDOCFLAGS="-D warnings" cargo doc --no-deps -p ta-lib`, as one more step on the existing clippy job. Generator-only: the three generated files in this diff are the output of the three generator files above them. A full `generate` leaves C, Java, C# and all four servers byte-identical.
59 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the D7 half of #179, and the E4 step it needs to stay closed.
D7 records that the crate documents its 1,234 item declarations and then renders
the members bare. Measured on dev
500942220withRUSTFLAGS="-W missing_docs" cargo build -p ta-lib: 281 public members with no documentation — 239 inabstract_api.rs, 42 inta_func/types.rs. After this change: 0, and#![warn(missing_docs)]is what keeps it there.The introspection payloads D7 names are the ones a reader actually meets first:
FuncInfo,InputInfo,OutputInfo,OptInputInfo,OptInputType(theOptDomainof the issue text, renamed by C12) andCandleSettings. Every fieldof each now carries a line, as do
FuncId's 176 variants,FuncUnstId's 20function ids,
CandleSettingType's 11,Group's 10,InputType,OutputType,the four flag newtypes and their 33 constants.
Where the text comes from
Two of the three sources are existing canonical strings rather than new prose,
which is what stops the docs from being a second place to keep in sync:
FuncId's 176 variants take the function's ownhint— the same stringthe row already carries into
FuncInfo::hint, and that C'sTA_FuncInfo.hintreports — plus a link to the method:
/// Simple Moving Average — [`Core::SMA`](crate::Core::SMA).A wrong hint is now wrong in two renderedplaces instead of one, but it cannot be wrong in only one of them.
#defines ininclude/ta_abstract.h, soPATH_DEPENDENT,NAN_INF_OUTPUTandPERIOD1_IDENTITYsay in the crate what they say in C.flag_syncalreadypins the bit values against that header; this is the same fact for the prose.
The rest — the group descriptions, the two data-kind enums,
CandleSettings'eleven fields — is written, because nothing canonical says it. Each of those
points at its counterpart (
CandleSettingType::BodyLong↔CandleSettings::body_long) rather than paraphrasing it.warn, notdeny#![deny(missing_docs)]would make a future rustc that widens the lint's reacha broken build for every downstream consumer, on a crate they cannot patch. The
attribute is
warn; the nightly's existingcargo clippy --all-targets --manifest-path ta_codegen/output/rust/Cargo.toml -- -D warningsis what turns it into a failure here. That is the "(and rustc warnings)" the
job's comment already claimed, now load-bearing for a specific lint — noted
there.
Why E4 is in the same PR
Clippy does not run rustdoc's lints. An unresolved intra-doc link is
rustdoc::broken_intra_doc_links, which only rustdoc raises — so the 176generated
[Core::<F>]links this change adds would have had no gate at all,and docs.rs would have been the first place rustdoc ever ran on them. E4's own
proposed command is added as one step to the existing
clippyjob (Rust-only,no new runner):
Gates, and the controls that make them mean something
Both controls were applied to the generator and the tree regenerated, then
each gate run and watched to fail:
FuncIdvariant doc from the emittercargo clippy … -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc --no-deps -p ta-libThe second control is also the argument for the first row not being enough: with
the links broken, clippy stayed green. One gate does not cover the other.
Verified
cargo build -p ta-libwith-W missing_docs: 281 before, 0 after.generator,output/rust) with-D warnings: clean.RUSTDOCFLAGS="-D warnings" cargo doc --no-deps -p ta-lib, run from the reporoot exactly as the new step spells it: clean.
generateleaves the tree clean apart from the three generated Rustfiles in this diff: C, Java, C# and all four servers are byte-identical.
clippyjob's step list reads as intended.Not done
FunctionInfo's members and the C# metadatarecords have the same gap; neither is Rust: remaining loose ends before the first crates.io publish #179, and neither has a lint that would
hold the result. Not touched here.
no signature, discriminant or
#[non_exhaustive]moves, so nothing here issemver-relevant either before or after the publish.