[ty] Add warning that docs are autogenerated (#18270)

## Summary

This is a practice I followed on previous projects. Should hopefully
further help developers who want to update the documentation.

The big downside is that it's annoying to see this *as a user of the
documentation* if you don't open the Markdown file in the browser. But
I'd argue that those files don't really follow the original Markdown
spirit anyway with all the inline HTML.
This commit is contained in:
David Peter 2025-05-23 11:58:16 +02:00 committed by GitHub
parent 93ac0934dd
commit 6392dccd24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 0 deletions

View file

@ -80,6 +80,7 @@ fn generate() -> String {
let mut parents = Vec::new(); let mut parents = Vec::new();
output.push_str("<!-- WARNING: This file is auto-generated (cargo dev generate-all). Edit the doc comments in 'crates/ty/src/args.rs' if you want to change anything here. -->\n\n");
output.push_str("# CLI Reference\n\n"); output.push_str("# CLI Reference\n\n");
generate_command(&mut output, &ty, &mut parents); generate_command(&mut output, &ty, &mut parents);

View file

@ -25,6 +25,10 @@ pub(crate) fn main(args: &Args) -> anyhow::Result<()> {
let file_name = "crates/ty/docs/configuration.md"; let file_name = "crates/ty/docs/configuration.md";
let markdown_path = PathBuf::from(ROOT_DIR).join(file_name); let markdown_path = PathBuf::from(ROOT_DIR).join(file_name);
output.push_str(
"<!-- WARNING: This file is auto-generated (cargo dev generate-all). Update the doc comments on the 'Options' struct in 'crates/ty_project/src/metadata/options.rs' if you want to change anything here. -->\n\n",
);
generate_set( generate_set(
&mut output, &mut output,
Set::Toplevel(Options::metadata()), Set::Toplevel(Options::metadata()),

View file

@ -56,6 +56,10 @@ fn generate_markdown() -> String {
let mut output = String::new(); let mut output = String::new();
let _ = writeln!(
&mut output,
"<!-- WARNING: This file is auto-generated (cargo dev generate-all). Edit the lint-declarations in 'crates/ty_python_semantic/src/types/diagnostic.rs' if you want to change anything here. -->\n"
);
let _ = writeln!(&mut output, "# Rules\n"); let _ = writeln!(&mut output, "# Rules\n");
let mut lints: Vec<_> = registry.lints().iter().collect(); let mut lints: Vec<_> = registry.lints().iter().collect();

2
crates/ty/docs/cli.md generated
View file

@ -1,3 +1,5 @@
<!-- WARNING: This file is auto-generated (cargo dev generate-all). Edit the doc comments in 'crates/ty/src/args.rs' if you want to change anything here. -->
# CLI Reference # CLI Reference
## ty ## ty

View file

@ -1,3 +1,5 @@
<!-- WARNING: This file is auto-generated (cargo dev generate-all). Update the doc comments on the 'Options' struct in 'crates/ty_project/src/metadata/options.rs' if you want to change anything here. -->
# Configuration # Configuration
#### `respect-ignore-files` #### `respect-ignore-files`

View file

@ -1,3 +1,5 @@
<!-- WARNING: This file is auto-generated (cargo dev generate-all). Edit the lint-declarations in 'crates/ty_python_semantic/src/types/diagnostic.rs' if you want to change anything here. -->
# Rules # Rules
## `byte-string-type-annotation` ## `byte-string-type-annotation`