[docs] improve and fix entry for analyze.include-dependencies (#15197)

## Summary

Changes two things about the entry:
* make the example valid TOML - inline tables must be a single line, at
least till v1.1.0 is released,
but also while in the future the toml version used by ruff might handle
it, it would probably be
good to stick to a spec that's readable by the vast majority of other
tools and versions as well,
especially if people are using `pyproject.toml`. The current example
leads to `ruff` failure.
See https://github.com/toml-lang/toml/pull/904
* adds a line about the ability to add non-Python files to the map,
which I think is a specific and
important feature people should know about (in fact, I would assume this
could potentially
become the single biggest use-case for this).

## Test Plan

Ran doc creation as described in the
[contribution](https://docs.astral.sh/ruff/contributing/#mkdocs) guide.

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This commit is contained in:
purajit 2024-12-30 07:45:19 -08:00 committed by GitHub
parent 280ba75100
commit 42cc67a87c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -3494,15 +3494,15 @@ pub struct AnalyzeOptions {
"#
)]
pub detect_string_imports: Option<bool>,
/// A map from file path to the list of file paths or globs that should be considered
/// dependencies of that file, regardless of whether relevant imports are detected.
/// A map from file path to the list of Python or non-Python file paths or globs that should be
/// considered dependencies of that file, regardless of whether relevant imports are detected.
#[option(
default = "{}",
scope = "include-dependencies",
value_type = "dict[str, list[str]]",
example = r#"
include-dependencies = {
"foo/bar.py": ["foo/baz/*.py"],
}
"foo/bar.py" = ["foo/baz/*.py"]
"foo/baz/reader.py" = ["configs/bar.json"]
"#
)]
pub include_dependencies: Option<BTreeMap<PathBuf, Vec<String>>>,