From 1c16255884d79a7c3bf50f32b661449bf994cc7a Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 29 Dec 2022 13:15:44 -0500 Subject: [PATCH] Include docstrings for settings enum members (#1446) --- README.md | 2 +- ruff.schema.json | 59 ++++++++++++++++++++++------- src/flake8_quotes/settings.rs | 2 + src/flake8_tidy_imports/settings.rs | 4 +- src/pydocstyle/settings.rs | 2 + 5 files changed, 54 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 9c5c1c58ea..53caed4b0d 100644 --- a/README.md +++ b/README.md @@ -2461,7 +2461,7 @@ multiline-quotes = "single" #### [`ban-relative-imports`](#ban-relative-imports) Whether to ban all relative imports (`"all"`), or only those imports -that extend into the parent module and beyond (`"parents"`). +that extend into the parent module or beyond (`"parents"`). **Default value**: `"parents"` diff --git a/ruff.schema.json b/ruff.schema.json index 963426068e..eab05826b2 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -918,10 +918,21 @@ ] }, "Convention": { - "type": "string", - "enum": [ - "google", - "numpy" + "oneOf": [ + { + "description": "Use Google-style docstrings.", + "type": "string", + "enum": [ + "google" + ] + }, + { + "description": "Use NumPy-style docstrings.", + "type": "string", + "enum": [ + "numpy" + ] + } ] }, "Flake8AnnotationsOptions": { @@ -1065,7 +1076,7 @@ "type": "object", "properties": { "ban-relative-imports": { - "description": "Whether to ban all relative imports (`\"all\"`), or only those imports that extend into the parent module and beyond (`\"parents\"`).", + "description": "Whether to ban all relative imports (`\"all\"`), or only those imports that extend into the parent module or beyond (`\"parents\"`).", "anyOf": [ { "$ref": "#/definitions/Strictness" @@ -1261,10 +1272,21 @@ ] }, "Quote": { - "type": "string", - "enum": [ - "single", - "double" + "oneOf": [ + { + "description": "Use single quotes (`'`).", + "type": "string", + "enum": [ + "single" + ] + }, + { + "description": "Use double quotes (`\"`).", + "type": "string", + "enum": [ + "double" + ] + } ] }, "SerializationFormat": { @@ -1279,10 +1301,21 @@ ] }, "Strictness": { - "type": "string", - "enum": [ - "parents", - "all" + "oneOf": [ + { + "description": "Ban imports that extend into the parent module or beyond.", + "type": "string", + "enum": [ + "parents" + ] + }, + { + "description": "Ban all relative imports.", + "type": "string", + "enum": [ + "all" + ] + } ] }, "Version": { diff --git a/src/flake8_quotes/settings.rs b/src/flake8_quotes/settings.rs index ae17f1b4dd..3809ff5434 100644 --- a/src/flake8_quotes/settings.rs +++ b/src/flake8_quotes/settings.rs @@ -7,7 +7,9 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash, JsonSchema)] #[serde(deny_unknown_fields, rename_all = "kebab-case")] pub enum Quote { + /// Use single quotes (`'`). Single, + /// Use double quotes (`"`). Double, } diff --git a/src/flake8_tidy_imports/settings.rs b/src/flake8_tidy_imports/settings.rs index 7a6baa6615..945b5ecaef 100644 --- a/src/flake8_tidy_imports/settings.rs +++ b/src/flake8_tidy_imports/settings.rs @@ -7,7 +7,9 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash, JsonSchema)] #[serde(deny_unknown_fields, rename_all = "kebab-case")] pub enum Strictness { + /// Ban imports that extend into the parent module or beyond. Parents, + /// Ban all relative imports. All, } @@ -29,7 +31,7 @@ pub struct Options { "# )] /// Whether to ban all relative imports (`"all"`), or only those imports - /// that extend into the parent module and beyond (`"parents"`). + /// that extend into the parent module or beyond (`"parents"`). pub ban_relative_imports: Option, } diff --git a/src/pydocstyle/settings.rs b/src/pydocstyle/settings.rs index 31daa36f55..8787f25b42 100644 --- a/src/pydocstyle/settings.rs +++ b/src/pydocstyle/settings.rs @@ -7,7 +7,9 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash, JsonSchema)] #[serde(deny_unknown_fields, rename_all = "kebab-case")] pub enum Convention { + /// Use Google-style docstrings. Google, + /// Use NumPy-style docstrings. Numpy, }