From 7918716a43a48b300cc562b09b607004a5cb6f77 Mon Sep 17 00:00:00 2001 From: Hennadii Chernyshchyk Date: Mon, 2 Dec 2024 02:20:08 +0300 Subject: [PATCH] Fix typos and add `typos` to CI (#373) --- .github/workflows/main.yml | 12 +++++++++++- src/core/event_registry/client_event.rs | 2 +- src/core/event_registry/server_event.rs | 2 +- .../replicated_clients/client_visibility.rs | 10 +++++----- .../replication/replication_registry/test_fns.rs | 2 +- src/core/replicon_tick.rs | 2 +- src/lib.rs | 2 +- src/server/replicated_archetypes.rs | 2 +- src/server/replication_messages/serialized_data.rs | 2 +- tests/despawn.rs | 2 +- tests/server_event.rs | 10 +++++----- 11 files changed, 29 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 422f5b7c..7dffaccb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,6 +15,16 @@ on: env: CARGO_TERM_COLOR: always jobs: + typos: + name: Typos + runs-on: ubuntu-latest + steps: + - name: Clone repo + uses: actions/checkout@v4 + + - name: Check typos + uses: crate-ci/typos@v1.28.1 + format: name: Format runs-on: ubuntu-latest @@ -121,7 +131,7 @@ jobs: codecov: name: Upload to Codecov if: github.actor != 'dependabot[bot]' - needs: [format, lint, doctest, feature-combinations, test] + needs: [typos, format, lint, doctest, feature-combinations, test] runs-on: ubuntu-latest steps: - name: Clone repo diff --git a/src/core/event_registry/client_event.rs b/src/core/event_registry/client_event.rs index 31c128ec..37f142d0 100644 --- a/src/core/event_registry/client_event.rs +++ b/src/core/event_registry/client_event.rs @@ -449,7 +449,7 @@ impl FromWorld for ClientEventReader { } /// An event indicating that a message from client was received. -/// Emited only on server. +/// Emitted only on server. #[derive(Clone, Copy, Event)] pub struct FromClient { pub client_id: ClientId, diff --git a/src/core/event_registry/server_event.rs b/src/core/event_registry/server_event.rs index eb1a7868..039995dd 100644 --- a/src/core/event_registry/server_event.rs +++ b/src/core/event_registry/server_event.rs @@ -690,7 +690,7 @@ enum SerializedMessage { Raw(Vec), /// A message with serialized tick. /// - /// `tick | messsage` + /// `tick | message` Resolved { tick: RepliconTick, bytes: Bytes }, } diff --git a/src/core/replication/replicated_clients/client_visibility.rs b/src/core/replication/replicated_clients/client_visibility.rs index 02f30968..021ba697 100644 --- a/src/core/replication/replicated_clients/client_visibility.rs +++ b/src/core/replication/replicated_clients/client_visibility.rs @@ -134,10 +134,10 @@ impl ClientVisibility { /// Sets visibility for a specific entity. /// /// Does nothing if the visibility policy for the server plugin is set to [`VisibilityPolicy::All`]. - pub fn set_visibility(&mut self, entity: Entity, visibile: bool) { + pub fn set_visibility(&mut self, entity: Entity, visible: bool) { match &mut self.filter { VisibilityFilter::All { .. } => { - if visibile { + if visible { debug!( "ignoring visibility enable due to {:?}", VisibilityPolicy::All @@ -154,8 +154,8 @@ impl ClientVisibility { added, removed, } => { - if visibile { - // If the entity is already visibile, do nothing. + if visible { + // If the entity is already visible, do nothing. let Entry::Occupied(mut entry) = list.entry(entity) else { return; }; @@ -187,7 +187,7 @@ impl ClientVisibility { added, removed, } => { - if visibile { + if visible { // Similar to blacklist removal, we don't just add the entity to the list. // Instead we mark it as `WhitelistInfo::JustAdded` and then set it to // 'WhitelistInfo::Visible' in `Self::update`. diff --git a/src/core/replication/replication_registry/test_fns.rs b/src/core/replication/replication_registry/test_fns.rs index 7f292c82..f3926a07 100644 --- a/src/core/replication/replication_registry/test_fns.rs +++ b/src/core/replication/replication_registry/test_fns.rs @@ -79,7 +79,7 @@ pub trait TestFnsEntityExt { /// See also [`AppMarkerExt`](crate::core::replication::command_markers::AppMarkerExt). fn apply_write(&mut self, data: &[u8], fns_id: FnsId, message_tick: RepliconTick) -> &mut Self; - /// Remvoes a component using a registered function for it. + /// Removes a component using a registered function for it. /// /// See also [`AppMarkerExt`](crate::core::replication::command_markers::AppMarkerExt). fn apply_remove(&mut self, fns_id: FnsId, message_tick: RepliconTick) -> &mut Self; diff --git a/src/core/replicon_tick.rs b/src/core/replicon_tick.rs index c922003f..49cefcb7 100644 --- a/src/core/replicon_tick.rs +++ b/src/core/replicon_tick.rs @@ -82,7 +82,7 @@ mod tests { use super::*; #[test] - fn tick_comparsion() { + fn tick_comparison() { assert_eq!(RepliconTick::new(0), RepliconTick::new(0)); assert!(RepliconTick::new(0) < RepliconTick::new(1)); assert!(RepliconTick::new(0) > RepliconTick::new(u32::MAX)); diff --git a/src/lib.rs b/src/lib.rs index 048d4b60..bdf52a3c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -598,7 +598,7 @@ World state on the client is only "eventually consistent" with the server's. # Troubleshooting If you face any issue, try to enable logging to see what is going on. -To enable logging, you can temporarely set `RUST_LOG` environment variable to `bevy_replicon=debug` +To enable logging, you can temporarily set `RUST_LOG` environment variable to `bevy_replicon=debug` (or `bevy_replicon=trace` for more noisy output) like this: ```bash diff --git a/src/server/replicated_archetypes.rs b/src/server/replicated_archetypes.rs index 7f53e685..0ae1c9b0 100644 --- a/src/server/replicated_archetypes.rs +++ b/src/server/replicated_archetypes.rs @@ -215,7 +215,7 @@ mod tests { } #[test] - fn grup_with_subset() { + fn group_with_subset() { let mut app = App::new(); app.init_resource::() .init_resource::() diff --git a/src/server/replication_messages/serialized_data.rs b/src/server/replication_messages/serialized_data.rs index 41333e75..43a1752e 100644 --- a/src/server/replication_messages/serialized_data.rs +++ b/src/server/replication_messages/serialized_data.rs @@ -14,7 +14,7 @@ use crate::{ server::client_entity_map::ClientMapping, }; -/// Single continious buffer that stores serialized data for messages. +/// Single continuous buffer that stores serialized data for messages. /// /// See [`UpdateMessage`](super::update_message::UpdateMessage) and /// [`MutateMessage`](super::mutate_message::MutateMessage). diff --git a/tests/despawn.rs b/tests/despawn.rs index 25b2b642..cffc2f19 100644 --- a/tests/despawn.rs +++ b/tests/despawn.rs @@ -42,7 +42,7 @@ fn single() { } #[test] -fn with_heirarchy() { +fn with_hierarchy() { let mut server_app = App::new(); let mut client_app = App::new(); for app in [&mut server_app, &mut client_app] { diff --git a/tests/server_event.rs b/tests/server_event.rs index db129764..54acaeaf 100644 --- a/tests/server_event.rs +++ b/tests/server_event.rs @@ -50,7 +50,7 @@ fn sending_receiving() { assert_eq!( events.drain().count(), events_count, - "event should be emited {events_count} times for {mode:?}" + "event should be emitted {events_count} times for {mode:?}" ); } } @@ -150,7 +150,7 @@ fn sending_receiving_without_plugins() { assert_eq!( events.drain().count(), events_count, - "event should be emited {events_count} times for {mode:?}" + "event should be emitted {events_count} times for {mode:?}" ); } } @@ -189,7 +189,7 @@ fn local_resending() { assert_eq!( dummy_events.drain().count(), events_count, - "event should be emited {events_count} times for {mode:?}" + "event should be emitted {events_count} times for {mode:?}" ); } } @@ -466,7 +466,7 @@ fn independent() { assert_eq!( events.drain().count(), events_count, - "event should be emited {events_count} times for {mode:?}" + "event should be emitted {events_count} times for {mode:?}" ); } } @@ -570,7 +570,7 @@ fn different_ticks() { server_app.exchange_with_client(&mut client_app1); // Connect client 2 later to make it have a higher replicon tick than client 1, - // since only client 1 will recieve a update message here. + // since only client 1 will receive a update message here. server_app.connect_client(&mut client_app2); server_app.world_mut().send_event(ToClients {