From 097b654ba71e603d68610122c85e666de8f74063 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 9 Oct 2023 23:04:08 -0400 Subject: [PATCH] fix(schema): restore limit on line-length (#7883) ## Summary Restores functionality of #7875 but in the correct place. Closes #7877. ~~I couldn't figure out how to get cargo fmt to work, so hopefully that's run in CI.~~ Nevermind, figured it out. ## Test Plan Can see output of json. --- crates/ruff_linter/src/line_width.rs | 4 +++- ruff.schema.json | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/ruff_linter/src/line_width.rs b/crates/ruff_linter/src/line_width.rs index 685e473ecc..6f54a6a645 100644 --- a/crates/ruff_linter/src/line_width.rs +++ b/crates/ruff_linter/src/line_width.rs @@ -15,7 +15,9 @@ use ruff_text_size::TextSize; /// The allowed range of values is 1..=320 #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] -pub struct LineLength(NonZeroU16); +pub struct LineLength( + #[cfg_attr(feature = "schemars", schemars(range(min = 1, max = 320)))] NonZeroU16, +); impl LineLength { /// Maximum allowed value for a valid [`LineLength`] diff --git a/ruff.schema.json b/ruff.schema.json index 49be9e2ae2..b5a43347b2 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -1556,6 +1556,7 @@ "description": "The length of a line of text that is considered too long.\n\nThe allowed range of values is 1..=320", "type": "integer", "format": "uint16", + "maximum": 320.0, "minimum": 1.0 }, "LintOptions": {