From c97d0103cc8d2a1350bee58eee6a8cf5d13f21eb Mon Sep 17 00:00:00 2001 From: Ame <104745335+ameknite@users.noreply.github.com> Date: Mon, 26 Feb 2024 10:19:40 -0600 Subject: [PATCH] Add `typos` - Source code spell checker (#12036) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Objective - Avoid misspellings throughout the codebase by using [`typos`](https://github.com/crate-ci/typos) in CI Inspired by https://github.com/gfx-rs/wgpu/pull/5191 Typos is a minimal code speller written in rust that finds and corrects spelling mistakes among source code. - Fast enough to run on monorepos - Low false positives so you can run on PRs ## Solution - Use [typos-action](https://github.com/marketplace/actions/typos-action) in CI - Add how to use typos in the Contribution Guide --------- Co-authored-by: François Co-authored-by: Alice Cecile Co-authored-by: Joona Aalto --- .github/workflows/ci.yml | 16 ++++++++++ CONTRIBUTING.md | 12 +++---- .../bevy_ecs/src/schedule/executor/simple.rs | 2 +- typos.toml | 31 +++++++++++++++++++ 4 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 typos.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96068912a5b89..3bd0a0b1d5a4b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -183,6 +183,22 @@ jobs: echo 'Or if you use VSCode, use the `Even Better Toml` extension with 2 spaces' echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml' + typos: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - name: Check for typos + uses: crate-ci/typos@v1.18.2 + - name: Typos info + if: failure() + run: | + echo 'To fix typos, please run `typos -w`' + echo 'To check for a diff, run `typos`' + echo 'You can find typos here: https://crates.io/crates/typos' + echo 'if you use VSCode, you can also install `Typos Spell Checker' + echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode' + run-examples-on-windows-dx12: runs-on: windows-latest diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f4f2aa890b178..51ee566dfa510 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -334,19 +334,19 @@ If you're new to Bevy, here's the workflow we use: * `cargo run -p ci -- doc` - to run doc tests and doc checks. * `cargo run -p ci -- compile` - to check that everything that must compile still does (examples and benches), and that some that shouldn't still don't ([`crates/bevy_ecs_compile_fail_tests`](./crates/bevy_ecs_compile_fail_tests)). * to get more information on commands available and what is run, check the [tools/ci crate](./tools/ci). - 4. When working with Markdown (`.md`) files, Bevy's CI will check markdown files (like this one) using [markdownlint](https://github.com/DavidAnson/markdownlint). To locally lint your files using the same workflow as our CI: 1. Install [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli). 2. Run `markdownlint -f -c .github/linters/.markdown-lint.yml .` in the root directory of the Bevy project. - 5. When working with Toml (`.toml`) files, Bevy's CI will check toml files using [taplo](https://taplo.tamasfe.dev/): `taplo fmt --check --diff` 1. If you use VSCode, install [Even better toml](https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml) and format your files. 2. If you want to use the cli tool, install [taplo-cli](https://taplo.tamasfe.dev/cli/installation/cargo.html) and run `taplo fmt --check --diff` to check for the formatting. Fix any issues by running `taplo fmt` in the root directory of the Bevy project. - -6. Push your changes to your fork on Github and open a Pull Request. -7. Respond to any CI failures or review feedback. While CI failures must be fixed before we can merge your PR, you do not need to *agree* with all feedback from your reviews, merely acknowledge that it was given. If you cannot come to an agreement, leave the thread open and defer to a Maintainer or Project Lead's final judgement. -8. When your PR is ready to merge, a Maintainer or Project Lead will review it and suggest final changes. If those changes are minimal they may even apply them directly to speed up merging. +6. Check for typos. Bevy's CI will check for them using [typos](https://github.com/crate-ci/typos). + 1. If you use VSCode, install [Typos Spell Checker](https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode). + 2. You can also use the cli tool. Install [typos-cli](https://github.com/crate-ci/typos?tab=readme-ov-file#install) and run `typos` to check for typos, and fix them by running `typos -w`. +7. Push your changes to your fork on Github and open a Pull Request. +8. Respond to any CI failures or review feedback. While CI failures must be fixed before we can merge your PR, you do not need to *agree* with all feedback from your reviews, merely acknowledge that it was given. If you cannot come to an agreement, leave the thread open and defer to a Maintainer or Project Lead's final judgement. +9. When your PR is ready to merge, a Maintainer or Project Lead will review it and suggest final changes. If those changes are minimal they may even apply them directly to speed up merging. If you end up adding a new official Bevy crate to the `bevy` repo: diff --git a/crates/bevy_ecs/src/schedule/executor/simple.rs b/crates/bevy_ecs/src/schedule/executor/simple.rs index 882a7736f67b8..7e5ce65a2022e 100644 --- a/crates/bevy_ecs/src/schedule/executor/simple.rs +++ b/crates/bevy_ecs/src/schedule/executor/simple.rs @@ -133,7 +133,7 @@ fn evaluate_and_fold_conditions(conditions: &mut [BoxedCondition], world: &mut W #[cfg(test)] #[test] fn skip_automatic_sync_points() { - // Schedules automatically insert appy_deferred systems, but these should + // Schedules automatically insert apply_deferred systems, but these should // not be executed as they only serve as markers and are not initialized use crate::prelude::*; let mut sched = Schedule::default(); diff --git a/typos.toml b/typos.toml new file mode 100644 index 0000000000000..4e77918adcdfd --- /dev/null +++ b/typos.toml @@ -0,0 +1,31 @@ +[files] +extend-exclude = [ + "*.pbxproj", # metadata file + "CHANGELOG.md", # To keep consistency between the commit history/PRs. +] + +# 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. +# the toi of the mountain + +# Match Whole Word - Case Sensitive +[default.extend-identifiers] +ser = "ser" # ron::ser - Serializer +Sur = "Sur" # macOS Big Sur - South + +# Match Inside a Word - Case Insensitive +[default.extend-words] +LOD = "LOD" # Level of detail +TOI = "TOI" # Time of impact + +[default] +extend-ignore-identifiers-re = [ + "NDK", # NDK - Native Development Kit + "inventario", # Inventory in Portuguese + # Used in bevy_mikktspace + "iFO", + "vOt", + "fLenOt", +]