Validating code in documentation #17970
lilatomic
started this conversation in
Development
Replies: 1 comment
-
This is a great use case to take into account when we evaluate replacements for our current doc publishing via readme.com |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The code samples in the documentation may not be updated when the code they reference is. The case I found was with the plugin howto docs, where we changed the code but not the samples for writing a plugin. We may also not be running linters or formatters on them.
I think the main value we gain is in simple validations, like if the sample is syntactically valid and if all the symbols are importable. I think that will do most of the work of prompting us to update the samples when the code they reference updates.
I see several distinct types of code samples:
I think these 3 cases need to be treated separately. Justifying, for the full usage examples, we may have to spin up separate
rule_runners
, as the different examples might have conflicting Pants configurations. At a minimum, in some way we'd need to spin up a Pants instance to test them. The internal usage examples might be suitable to extract in whole from the markdown, but the incomplete examples will need to have their code synthesised together with supporting information.Options:
I see type 1 (full examples) as a challenge to all of these, but it's reasonably straightforward to just throw them all at a rule_runner
Beta Was this translation helpful? Give feedback.
All reactions