Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation around custom isort sections #11050

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 25 additions & 1 deletion crates/ruff_workspace/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2257,7 +2257,31 @@ pub struct IsortOptions {

// Tables are required to go last.
/// A list of mappings from section names to modules.
/// By default custom sections are output last, but this can be overridden with `section-order`.
///
/// By default, imports are categorized according to their type (e.g., `future`, `third-party`,
/// and so on). This setting allows you to group modules into custom sections, to augment or
/// override the built-in sections.
///
/// For example, to group all testing utilities, you could create a `testing` section:
/// ```toml
/// testing = ["pytest", "hypothesis"]
/// ```
///
/// Custom sections should typically be inserted into the `section-order` list to ensure that
/// they're displayed as a standalone group and in the intended order, as in:
/// ```toml
/// section-order = [
/// "future",
/// "standard-library",
/// "third-party",
/// "first-party",
/// "local-folder",
/// "testing"
/// ]
/// ```
///
/// If a custom section is omitted from `section-order`, imports in that section will be
/// assigned to the `default-section` (which defaults to `third-party`).
#[option(
default = "{}",
value_type = "dict[str, list[str]]",
Expand Down
2 changes: 1 addition & 1 deletion ruff.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.