From 1ec5f465c181c644f0fa92c254a49d4dac197479 Mon Sep 17 00:00:00 2001 From: Julian Hofer Date: Sun, 19 Mar 2023 19:40:42 +0100 Subject: [PATCH] Check typos in CI --- .github/workflows/typos.yml | 13 +++++++++++++ .typos.toml | 6 ++++++ src/completion/base.rs | 2 +- src/completion/default.rs | 6 +++--- src/core_editor/editor.rs | 2 +- src/core_editor/line_buffer.rs | 4 ++-- src/edit_mode/keybindings.rs | 2 +- 7 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/typos.yml create mode 100644 .typos.toml diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml new file mode 100644 index 00000000..bcc7b12c --- /dev/null +++ b/.github/workflows/typos.yml @@ -0,0 +1,13 @@ +name: Typos +on: [pull_request] + +jobs: + run: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v3 + + - name: Check spelling + uses: crate-ci/typos@master diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 00000000..2e4bc6fb --- /dev/null +++ b/.typos.toml @@ -0,0 +1,6 @@ +[files] +extend-exclude = ["src/core_editor/line_buffer.rs"] + +[default.extend-words] +# Ignore false-positives +iterm = "iterm" diff --git a/src/completion/base.rs b/src/completion/base.rs index 44da56b2..3de63c8d 100644 --- a/src/completion/base.rs +++ b/src/completion/base.rs @@ -61,7 +61,7 @@ pub struct Suggestion { /// Optional description for the replacement pub description: Option, /// Optional vector of strings in the suggestion. These can be used to - /// represent examples comming from a suggestion + /// represent examples coming from a suggestion pub extra: Option>, /// Replacement span in the buffer pub span: Span, diff --git a/src/completion/default.rs b/src/completion/default.rs index ab938f25..6f674f3b 100644 --- a/src/completion/default.rs +++ b/src/completion/default.rs @@ -72,10 +72,10 @@ impl Completer for DefaultCompleter { let mut span_line_whitespaces = 0; let mut completions = vec![]; if !line.is_empty() { - let mut splitted = line[0..pos].split(' ').rev(); + let mut split = line[0..pos].split(' ').rev(); let mut span_line: String = String::new(); - for _ in 0..splitted.clone().count() { - if let Some(s) = splitted.next() { + for _ in 0..split.clone().count() { + if let Some(s) = split.next() { if s.is_empty() { span_line_whitespaces += 1; continue; diff --git a/src/core_editor/editor.rs b/src/core_editor/editor.rs index 0c4298ab..59d645bc 100644 --- a/src/core_editor/editor.rs +++ b/src/core_editor/editor.rs @@ -556,7 +556,7 @@ mod test { } #[test] - fn test_undo_insert_works_on_work_boundries() { + fn test_undo_insert_works_on_work_boundaries() { let mut editor = editor_with("This is a"); for cmd in str_to_edit_commands(" test") { editor.run_edit_command(&cmd); diff --git a/src/core_editor/line_buffer.rs b/src/core_editor/line_buffer.rs index f5db2aa8..c8230153 100644 --- a/src/core_editor/line_buffer.rs +++ b/src/core_editor/line_buffer.rs @@ -67,7 +67,7 @@ impl LineBuffer { /// Sets the current edit position /// ## Unicode safety: - /// Not checked, inproper use may cause panics in following operations + /// Not checked, improper use may cause panics in following operations pub fn set_insertion_point(&mut self, offset: usize) { self.insertion_point = offset; } @@ -998,7 +998,7 @@ mod test { #[rstest] #[case("This is a test", 13, "This is a tets", 14)] - #[case("This is a test", 14, "This is a tets", 14)] // NOTE: Swaping works in opposite direction at last index + #[case("This is a test", 14, "This is a tets", 14)] // NOTE: Swapping works in opposite direction at last index #[case("This is a test", 4, "Thi sis a test", 5)] // NOTE: Swaps space, moves right #[case("This is a test", 0, "hTis is a test", 2)] fn swap_graphemes_work( diff --git a/src/edit_mode/keybindings.rs b/src/edit_mode/keybindings.rs index ca6b602f..772e4199 100644 --- a/src/edit_mode/keybindings.rs +++ b/src/edit_mode/keybindings.rs @@ -41,7 +41,7 @@ impl Keybindings { /// /// # Panics /// - /// If `comamnd` is an empty [`ReedlineEvent::UntilFound`] + /// If `command` is an empty [`ReedlineEvent::UntilFound`] pub fn add_binding( &mut self, modifier: KeyModifiers,