Skip to content

Commit c97d010

Browse files
ameknitemockersfalice-i-cecileJondolf
authored
Add typos - Source code spell checker (#12036)
# Objective - Avoid misspellings throughout the codebase by using [`typos`](https://github.com/crate-ci/typos) in CI Inspired by gfx-rs/wgpu#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 <[email protected]> Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: Joona Aalto <[email protected]>
1 parent 2b7a3b2 commit c97d010

File tree

4 files changed

+54
-7
lines changed

4 files changed

+54
-7
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,22 @@ jobs:
183183
echo 'Or if you use VSCode, use the `Even Better Toml` extension with 2 spaces'
184184
echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml'
185185
186+
typos:
187+
runs-on: ubuntu-latest
188+
timeout-minutes: 30
189+
steps:
190+
- uses: actions/checkout@v4
191+
- name: Check for typos
192+
uses: crate-ci/[email protected]
193+
- name: Typos info
194+
if: failure()
195+
run: |
196+
echo 'To fix typos, please run `typos -w`'
197+
echo 'To check for a diff, run `typos`'
198+
echo 'You can find typos here: https://crates.io/crates/typos'
199+
echo 'if you use VSCode, you can also install `Typos Spell Checker'
200+
echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode'
201+
186202
187203
run-examples-on-windows-dx12:
188204
runs-on: windows-latest

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,19 +334,19 @@ If you're new to Bevy, here's the workflow we use:
334334
* `cargo run -p ci -- doc` - to run doc tests and doc checks.
335335
* `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)).
336336
* to get more information on commands available and what is run, check the [tools/ci crate](./tools/ci).
337-
338337
4. When working with Markdown (`.md`) files, Bevy's CI will check markdown files (like this one) using [markdownlint](https://github.com/DavidAnson/markdownlint).
339338
To locally lint your files using the same workflow as our CI:
340339
1. Install [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli).
341340
2. Run `markdownlint -f -c .github/linters/.markdown-lint.yml .` in the root directory of the Bevy project.
342-
343341
5. When working with Toml (`.toml`) files, Bevy's CI will check toml files using [taplo](https://taplo.tamasfe.dev/): `taplo fmt --check --diff`
344342
1. If you use VSCode, install [Even better toml](https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml) and format your files.
345343
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.
346-
347-
6. Push your changes to your fork on Github and open a Pull Request.
348-
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.
349-
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.
344+
6. Check for typos. Bevy's CI will check for them using [typos](https://github.com/crate-ci/typos).
345+
1. If you use VSCode, install [Typos Spell Checker](https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode).
346+
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`.
347+
7. Push your changes to your fork on Github and open a Pull Request.
348+
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.
349+
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.
350350

351351
If you end up adding a new official Bevy crate to the `bevy` repo:
352352

crates/bevy_ecs/src/schedule/executor/simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn evaluate_and_fold_conditions(conditions: &mut [BoxedCondition], world: &mut W
133133
#[cfg(test)]
134134
#[test]
135135
fn skip_automatic_sync_points() {
136-
// Schedules automatically insert appy_deferred systems, but these should
136+
// Schedules automatically insert apply_deferred systems, but these should
137137
// not be executed as they only serve as markers and are not initialized
138138
use crate::prelude::*;
139139
let mut sched = Schedule::default();

typos.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[files]
2+
extend-exclude = [
3+
"*.pbxproj", # metadata file
4+
"CHANGELOG.md", # To keep consistency between the commit history/PRs.
5+
]
6+
7+
# Corrections take the form of a key/value pair. The key is the incorrect word
8+
# and the value is the correct word. If the key and value are the same, the
9+
# word is treated as always correct. If the value is an empty string, the word
10+
# is treated as always incorrect.
11+
# the toi of the mountain
12+
13+
# Match Whole Word - Case Sensitive
14+
[default.extend-identifiers]
15+
ser = "ser" # ron::ser - Serializer
16+
Sur = "Sur" # macOS Big Sur - South
17+
18+
# Match Inside a Word - Case Insensitive
19+
[default.extend-words]
20+
LOD = "LOD" # Level of detail
21+
TOI = "TOI" # Time of impact
22+
23+
[default]
24+
extend-ignore-identifiers-re = [
25+
"NDK", # NDK - Native Development Kit
26+
"inventario", # Inventory in Portuguese
27+
# Used in bevy_mikktspace
28+
"iFO",
29+
"vOt",
30+
"fLenOt",
31+
]

0 commit comments

Comments
 (0)