Check typos in CI (#557)

This commit is contained in:
Hofer-Julian 2023-03-19 20:07:29 +01:00 committed by GitHub
parent af7b447a06
commit f75afbdeba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 8 deletions

13
.github/workflows/typos.yml vendored Normal file
View File

@ -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

6
.typos.toml Normal file
View File

@ -0,0 +1,6 @@
[files]
extend-exclude = ["src/core_editor/line_buffer.rs"]
[default.extend-words]
# Ignore false-positives
iterm = "iterm"

View File

@ -61,7 +61,7 @@ pub struct Suggestion {
/// Optional description for the replacement
pub description: Option<String>,
/// 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<Vec<String>>,
/// Replacement span in the buffer
pub span: Span,

View File

@ -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;

View File

@ -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);

View File

@ -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(

View File

@ -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,