From efe7c393d1eb6bfa60a9f6c9c8dbb0863858baf9 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos Orfanos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 8 Jul 2023 12:33:18 +0200 Subject: [PATCH] Fix typos found by codespell (#5607) ## Summary Fix typos found by [codespell](https://github.com/codespell-project/codespell). I have left out `memoize` for now (see #5606). ## Test Plan CI tests. --- Cargo.toml | 2 +- _typos.toml | 1 - crates/ruff/src/rules/ruff/rules/unreachable.rs | 2 +- crates/ruff_formatter/src/format_extensions.rs | 2 +- crates/ruff_formatter/src/printer/mod.rs | 2 +- .../resources/test/fixtures/ruff/expression/dict.py | 2 +- .../resources/test/fixtures/ruff/expression/string.py | 2 +- .../test/fixtures/ruff/skip_magic_trailing_comma.py | 2 +- crates/ruff_python_formatter/src/lib.rs | 2 +- .../tests/snapshots/format@expression__dict.py.snap | 4 ++-- .../tests/snapshots/format@expression__string.py.snap | 6 +++--- .../snapshots/format@skip_magic_trailing_comma.py.snap | 6 +++--- 12 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index de63ac83b6..bec1ee357d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,7 @@ toml = { version = "0.7.2" } # v1.0.1 libcst = { git = "https://github.com/Instagram/LibCST.git", rev = "3cacca1a1029f05707e50703b49fe3dd860aa839", default-features = false } -# Please tag the RustPython version everytime you update its revision here and in fuzz/Cargo.toml +# Please tag the RustPython version every time you update its revision here and in fuzz/Cargo.toml # Tagging the version ensures that older ruff versions continue to build from source even when we rebase our RustPython fork. # Current tag: v0.0.7 ruff_text_size = { git = "https://github.com/astral-sh/RustPython-Parser.git", rev = "c174bbf1f29527edd43d432326327f16f47ab9e0" } diff --git a/_typos.toml b/_typos.toml index cf274a9fcf..6d9da48c39 100644 --- a/_typos.toml +++ b/_typos.toml @@ -2,7 +2,6 @@ extend-exclude = ["resources", "snapshots"] [default.extend-words] -trivias = "trivias" hel = "hel" whos = "whos" spawnve = "spawnve" diff --git a/crates/ruff/src/rules/ruff/rules/unreachable.rs b/crates/ruff/src/rules/ruff/rules/unreachable.rs index 8aede6a613..5c81acd9be 100644 --- a/crates/ruff/src/rules/ruff/rules/unreachable.rs +++ b/crates/ruff/src/rules/ruff/rules/unreachable.rs @@ -693,7 +693,7 @@ impl<'stmt> BasicBlocksBuilder<'stmt> { } } - /// Select the next block from `blocks` unconditonally. + /// Select the next block from `blocks` unconditionally. fn unconditional_next_block(&self, after: Option) -> NextBlock<'static> { if let Some(after) = after { return NextBlock::Always(after); diff --git a/crates/ruff_formatter/src/format_extensions.rs b/crates/ruff_formatter/src/format_extensions.rs index 317d9c1337..cde30df58a 100644 --- a/crates/ruff_formatter/src/format_extensions.rs +++ b/crates/ruff_formatter/src/format_extensions.rs @@ -42,7 +42,7 @@ pub trait MemoizeFormat { /// # fn main() -> FormatResult<()> { /// let normal = MyFormat::new(); /// - /// // Calls `format` for everytime the object gets formatted + /// // Calls `format` every time the object gets formatted /// assert_eq!( /// "Formatted 1 times. Formatted 2 times.", /// format!(SimpleFormatContext::default(), [normal, space(), normal])?.print()?.as_code() diff --git a/crates/ruff_formatter/src/printer/mod.rs b/crates/ruff_formatter/src/printer/mod.rs index df4608f733..25687b7631 100644 --- a/crates/ruff_formatter/src/printer/mod.rs +++ b/crates/ruff_formatter/src/printer/mod.rs @@ -701,7 +701,7 @@ struct PrinterState<'a> { verbatim_markers: Vec, group_modes: GroupModes, // Re-used queue to measure if a group fits. Optimisation to avoid re-allocating a new - // vec everytime a group gets measured + // vec every time a group gets measured fits_stack: Vec, fits_queue: Vec<&'a [FormatElement]>, } diff --git a/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/dict.py b/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/dict.py index a0631959db..b53ff5c6f3 100644 --- a/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/dict.py +++ b/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/dict.py @@ -26,7 +26,7 @@ b } { - **a # comment before preceeding node's comma + **a # comment before preceding node's comma , # before ** # between diff --git a/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/string.py b/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/string.py index f9c4fe8b1d..6767a2463e 100644 --- a/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/string.py +++ b/crates/ruff_python_formatter/resources/test/fixtures/ruff/expression/string.py @@ -92,7 +92,7 @@ if "Let's" "start" "with" "a" "simple" "example" "now repeat after me:" "I am co ( # leading - "a" # trailing part commen + "a" # trailing part comment # leading part comment diff --git a/crates/ruff_python_formatter/resources/test/fixtures/ruff/skip_magic_trailing_comma.py b/crates/ruff_python_formatter/resources/test/fixtures/ruff/skip_magic_trailing_comma.py index 8f4c58789a..1c138f163d 100644 --- a/crates/ruff_python_formatter/resources/test/fixtures/ruff/skip_magic_trailing_comma.py +++ b/crates/ruff_python_formatter/resources/test/fixtures/ruff/skip_magic_trailing_comma.py @@ -18,5 +18,5 @@ "fifth entry", "sixt entry", "seventh entry", - "eigth entry", + "eighth entry", ) diff --git a/crates/ruff_python_formatter/src/lib.rs b/crates/ruff_python_formatter/src/lib.rs index dcdf449795..eebcf05664 100644 --- a/crates/ruff_python_formatter/src/lib.rs +++ b/crates/ruff_python_formatter/src/lib.rs @@ -76,7 +76,7 @@ where /// default implementation formats the dangling comments at the end of the node, which isn't ideal but ensures that /// no comments are dropped. /// - /// A node can have dangling comments if all its children are tokens or if all node childrens are optional. + /// A node can have dangling comments if all its children are tokens or if all node children are optional. fn fmt_dangling_comments(&self, node: &N, f: &mut PyFormatter) -> FormatResult<()> { dangling_node_comments(node).fmt(f) } diff --git a/crates/ruff_python_formatter/tests/snapshots/format@expression__dict.py.snap b/crates/ruff_python_formatter/tests/snapshots/format@expression__dict.py.snap index bfafb3e2e7..043bd0e952 100644 --- a/crates/ruff_python_formatter/tests/snapshots/format@expression__dict.py.snap +++ b/crates/ruff_python_formatter/tests/snapshots/format@expression__dict.py.snap @@ -32,7 +32,7 @@ b } { - **a # comment before preceeding node's comma + **a # comment before preceding node's comma , # before ** # between @@ -91,7 +91,7 @@ a = { } { - **a, # comment before preceeding node's comma + **a, # comment before preceding node's comma # before **b, # between } diff --git a/crates/ruff_python_formatter/tests/snapshots/format@expression__string.py.snap b/crates/ruff_python_formatter/tests/snapshots/format@expression__string.py.snap index 7bdc05dbb5..53afe8b2a3 100644 --- a/crates/ruff_python_formatter/tests/snapshots/format@expression__string.py.snap +++ b/crates/ruff_python_formatter/tests/snapshots/format@expression__string.py.snap @@ -98,7 +98,7 @@ if "Let's" "start" "with" "a" "simple" "example" "now repeat after me:" "I am co ( # leading - "a" # trailing part commen + "a" # trailing part comment # leading part comment @@ -255,7 +255,7 @@ if ( ( # leading - "a" # trailing part commen + "a" # trailing part comment # leading part comment "b" # trailing second part comment # trailing @@ -403,7 +403,7 @@ if ( ( # leading - 'a' # trailing part commen + 'a' # trailing part comment # leading part comment 'b' # trailing second part comment # trailing diff --git a/crates/ruff_python_formatter/tests/snapshots/format@skip_magic_trailing_comma.py.snap b/crates/ruff_python_formatter/tests/snapshots/format@skip_magic_trailing_comma.py.snap index e035e69a1c..f3613924cc 100644 --- a/crates/ruff_python_formatter/tests/snapshots/format@skip_magic_trailing_comma.py.snap +++ b/crates/ruff_python_formatter/tests/snapshots/format@skip_magic_trailing_comma.py.snap @@ -24,7 +24,7 @@ input_file: crates/ruff_python_formatter/resources/test/fixtures/ruff/skip_magic "fifth entry", "sixt entry", "seventh entry", - "eigth entry", + "eighth entry", ) ``` @@ -54,7 +54,7 @@ magic-trailing-comma = Respect "fifth entry", "sixt entry", "seventh entry", - "eigth entry", + "eighth entry", ) ``` @@ -80,7 +80,7 @@ magic-trailing-comma = Ignore "fifth entry", "sixt entry", "seventh entry", - "eigth entry", + "eighth entry", ) ```