From a73b8c82a83336d76e69ee779d1f0648d1fdc667 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Mon, 6 May 2024 14:12:29 -0400 Subject: [PATCH] Add globbing to isort sections docs (#11311) Closes https://github.com/astral-sh/ruff/issues/11310. --- clippy.toml | 11 ++++++----- crates/ruff_workspace/src/options.rs | 6 ++++++ ruff.schema.json | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/clippy.toml b/clippy.toml index 28b63ab0d2..6cacb00103 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,12 +1,13 @@ doc-valid-idents = [ - "StackOverflow", + "..", "CodeQL", + "FastAPI", "IPython", - "NumPy", + "LangChain", "LibCST", + "McCabe", + "NumPy", "SCREAMING_SNAKE_CASE", "SQLAlchemy", - "McCabe", - "FastAPI", - "..", + "StackOverflow", ] diff --git a/crates/ruff_workspace/src/options.rs b/crates/ruff_workspace/src/options.rs index 2fd4bc2db3..fbd76b7e84 100644 --- a/crates/ruff_workspace/src/options.rs +++ b/crates/ruff_workspace/src/options.rs @@ -2267,6 +2267,12 @@ pub struct IsortOptions { /// testing = ["pytest", "hypothesis"] /// ``` /// + /// The values in the list are treated as glob patterns. For example, to match all packages in + /// the LangChain ecosystem (`langchain-core`, `langchain-openai`, etc.): + /// ```toml + /// langchain = ["langchain-*"] + /// ``` + /// /// 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 diff --git a/ruff.schema.json b/ruff.schema.json index 3c0072df3e..21a4165b5b 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -1698,7 +1698,7 @@ } }, "sections": { - "description": "A list of mappings from section names to modules.\n\nBy 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.\n\nFor example, to group all testing utilities, you could create a `testing` section: ```toml testing = [\"pytest\", \"hypothesis\"] ```\n\nCustom 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\" ] ```\n\nIf a custom section is omitted from `section-order`, imports in that section will be assigned to the `default-section` (which defaults to `third-party`).", + "description": "A list of mappings from section names to modules.\n\nBy 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.\n\nFor example, to group all testing utilities, you could create a `testing` section: ```toml testing = [\"pytest\", \"hypothesis\"] ```\n\nThe values in the list are treated as glob patterns. For example, to match all packages in the LangChain ecosystem (`langchain-core`, `langchain-openai`, etc.): ```toml langchain = [\"langchain-*\"] ```\n\nCustom 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\" ] ```\n\nIf a custom section is omitted from `section-order`, imports in that section will be assigned to the `default-section` (which defaults to `third-party`).", "type": [ "object", "null"