From d721e25f034a2f6757c6f03db496d1d707059df7 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 18 Jan 2025 18:48:07 +0700 Subject: [PATCH] Fix a typo, add CI check and typos config --- .github/workflows/main.yml | 11 ++++++++++- .typos.toml | 23 +++++++++++++++++++++++ malloc_size_of_derive/src/lib.rs | 2 +- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 .typos.toml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 71fadfd..9f31330 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,6 +60,14 @@ jobs: - name: Run clippy run: cargo clippy --all-features --all-targets -- -D warnings + # If this fails, consider changing your text or adding something to .typos.toml. + typos: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check typos + uses: crate-ci/typos@v1.29.4 + build_result: name: Result runs-on: ubuntu-latest @@ -68,6 +76,7 @@ jobs: - format - clippy - msrv + - typos steps: - name: Success @@ -75,4 +84,4 @@ jobs: run: exit 0 - name: Failure if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') - run: exit 1 \ No newline at end of file + run: exit 1 diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..e4a0f9b --- /dev/null +++ b/.typos.toml @@ -0,0 +1,23 @@ +# See the configuration reference at +# https://github.com/crate-ci/typos/blob/master/docs/reference.md + +# Corrections take the form of a key/value pair. The key is the incorrect word +# and the value is the correct word. If the key and value are the same, the +# word is treated as always correct. If the value is an empty string, the word +# is treated as always incorrect. + +# Match Identifier - Case Sensitive +[default.extend-identifiers] +colour = "color" + +# Match Inside a Word - Case Insensitive +[default.extend-words] + +[files] +# Include .github, .cargo, etc. +ignore-hidden = false +extend-exclude = [ + # /.git isn't in .gitignore, because git never tracks it. + # Typos doesn't know that, though. + "/.git", +] diff --git a/malloc_size_of_derive/src/lib.rs b/malloc_size_of_derive/src/lib.rs index 20629ca..cdb1f88 100644 --- a/malloc_size_of_derive/src/lib.rs +++ b/malloc_size_of_derive/src/lib.rs @@ -114,7 +114,7 @@ fn test_struct() { assert_eq!( no_space.matches(&$e.replace(" ", "")).count(), $count, - "counting occurences of {:?} in {:?} (whitespace-insensitive)", + "counting occurrences of {:?} in {:?} (whitespace-insensitive)", $e, expanded )