From c5e8b95e7f399478ab1a0a91abe04f9501818b84 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Thu, 9 Mar 2023 15:55:51 +0100 Subject: [PATCH] ci: add spellcheck with "typos" This adds the "typos" utility as additional CI step. Additionally, all existing typos are fixed. --- .github/workflows/qa.yml | 12 ++++++++++++ .typos.toml | 13 +++++++++++++ PUBLISHING.md | 2 +- book/src/concepts/gpt.md | 2 +- uefi-test-runner/src/proto/debug.rs | 2 +- uefi/src/data_types/mod.rs | 2 +- uefi/src/proto/console/gop.rs | 4 ++-- uefi/src/proto/console/pointer/mod.rs | 2 +- uefi/src/proto/debug/context.rs | 2 +- uefi/src/proto/device_path/mod.rs | 2 +- uefi/src/proto/device_path/text.rs | 8 ++++---- uefi/src/proto/media/disk.rs | 2 +- uefi/src/proto/media/file/regular.rs | 2 +- uefi/src/proto/network/snp.rs | 2 +- uefi/src/proto/string/unicode_collation.rs | 2 +- xtask/src/device_path/README.md | 2 +- 16 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/qa.yml create mode 100644 .typos.toml diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml new file mode 100644 index 000000000..30bddfa5f --- /dev/null +++ b/.github/workflows/qa.yml @@ -0,0 +1,12 @@ +name: QA + +on: [ push, pull_request ] + +jobs: + spellcheck: + name: Spellcheck + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + # Executes "typos ." + - uses: crate-ci/typos@v1.13.20 diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 000000000..f413b730e --- /dev/null +++ b/.typos.toml @@ -0,0 +1,13 @@ +# Configuration for the typos spell checker utility (). + +[files] +extend-exclude = [ + # "uefi/src/table/boot.rs" +] + +[default.extend-words] +# FOOBAR = "FOOBAR" + +[default.extend-identifiers] +# FOOBAR = "FOOBAR" + diff --git a/PUBLISHING.md b/PUBLISHING.md index c75c668a4..ae3959a90 100644 --- a/PUBLISHING.md +++ b/PUBLISHING.md @@ -15,7 +15,7 @@ which crates were modified and how should their version numbers be incremented. Incrementing the version number of a crate is as simple as editing the corresponding `Cargo.toml` file and updating the `version = ...` line, -then commiting the change (preferrably on a new branch, so that all of the version bumps +then committing the change (preferably on a new branch, so that all the version bumps can be combined in a single pull request). ### Crate dependencies diff --git a/book/src/concepts/gpt.md b/book/src/concepts/gpt.md index 1beb889ca..954518348 100644 --- a/book/src/concepts/gpt.md +++ b/book/src/concepts/gpt.md @@ -10,7 +10,7 @@ systems too. There are a couple big advantages of using GPT over MBR: A GPT disk contains a primary header near the beginning of the disk, followed by a partition entry array. The header and partition entry -array have a secondary copy at the end of the disk for redundency. The +array have a secondary copy at the end of the disk for redundancy. The partition entry arrays contain structures that describe each partition, including a GUID to identify the individual partition, a partition type GUID to indicate the purpose of the partition, and start/end block diff --git a/uefi-test-runner/src/proto/debug.rs b/uefi-test-runner/src/proto/debug.rs index 1b2364108..40b0cc50d 100644 --- a/uefi-test-runner/src/proto/debug.rs +++ b/uefi-test-runner/src/proto/debug.rs @@ -96,7 +96,7 @@ fn test_invalidate_instruction_cache(debug_support: &mut DebugSupport) { debug_support .invalidate_instruction_cache(0, ptr, 64) // Should always pass, since the spec says this always returns EFI_SUCCESS - .expect("Error occured while invalidating instruction cache"); + .expect("Error occurred while invalidating instruction cache"); } } diff --git a/uefi/src/data_types/mod.rs b/uefi/src/data_types/mod.rs index f3df90227..9bd9a6568 100644 --- a/uefi/src/data_types/mod.rs +++ b/uefi/src/data_types/mod.rs @@ -176,7 +176,7 @@ mod tests { assert_eq!(X::round_up_to_alignment(7), 8); assert_eq!(X::round_up_to_alignment(8), 8); - // Get an intentionally mis-aligned buffer. + // Get an intentionally misaligned buffer. let mut buffer = [0u8; 16]; let mut buffer = &mut buffer[..]; if (buffer.as_ptr() as usize) % X::alignment() == 0 { diff --git a/uefi/src/proto/console/gop.rs b/uefi/src/proto/console/gop.rs index e8d62d9ca..14eacec93 100644 --- a/uefi/src/proto/console/gop.rs +++ b/uefi/src/proto/console/gop.rs @@ -631,7 +631,7 @@ impl<'gop> FrameBuffer<'gop> { /// # Safety /// /// This operation is unsafe because... - /// - It is your reponsibility to make sure that the value type makes sense + /// - It is your responsibility to make sure that the value type makes sense /// - You must honor the pixel format and stride specified by the mode info /// - There is no bound checking on memory accesses in release mode #[inline] @@ -653,7 +653,7 @@ impl<'gop> FrameBuffer<'gop> { /// # Safety /// /// This operation is unsafe because... - /// - It is your reponsibility to make sure that the value type makes sense + /// - It is your responsibility to make sure that the value type makes sense /// - You must honor the pixel format and stride specified by the mode info /// - There is no bound checking on memory accesses in release mode #[inline] diff --git a/uefi/src/proto/console/pointer/mod.rs b/uefi/src/proto/console/pointer/mod.rs index 0ef123263..0d0939fc9 100644 --- a/uefi/src/proto/console/pointer/mod.rs +++ b/uefi/src/proto/console/pointer/mod.rs @@ -27,7 +27,7 @@ impl<'boot> Pointer<'boot> { (self.reset)(self, extended_verification).into() } - /// Retrieves the pointer device's current state, if a state change occured + /// Retrieves the pointer device's current state, if a state change occurred /// since the last time this function was called. /// /// Use `wait_for_input_event()` with the `BootServices::wait_for_event()` diff --git a/uefi/src/proto/debug/context.rs b/uefi/src/proto/debug/context.rs index 188309e05..359717ab0 100644 --- a/uefi/src/proto/debug/context.rs +++ b/uefi/src/proto/debug/context.rs @@ -1,7 +1,7 @@ // note from the spec: // When the context record field is larger than the register being stored in it, the upper bits of the // context record field are unused and ignored -/// Universal EFI_SYSTEM_CONTEXT defintion +/// Universal EFI_SYSTEM_CONTEXT definition /// This is passed to debug callbacks #[repr(C)] pub union SystemContext { diff --git a/uefi/src/proto/device_path/mod.rs b/uefi/src/proto/device_path/mod.rs index 3394b6e65..d9afc7580 100644 --- a/uefi/src/proto/device_path/mod.rs +++ b/uefi/src/proto/device_path/mod.rs @@ -1,7 +1,7 @@ //! Device Path protocol //! //! A UEFI device path is a very flexible structure for encoding a -//! programatic path such as a hard drive or console. +//! programmatic path such as a hard drive or console. //! //! A device path is made up of a packed list of variable-length nodes of //! various types. The entire device path is terminated with an diff --git a/uefi/src/proto/device_path/text.rs b/uefi/src/proto/device_path/text.rs index 5cfdc8e36..a835e1216 100644 --- a/uefi/src/proto/device_path/text.rs +++ b/uefi/src/proto/device_path/text.rs @@ -99,7 +99,7 @@ pub struct DevicePathToText { impl DevicePathToText { /// Convert a device node to its text representation. /// - /// Returns an [`OUT_OF_RESOURCES`] error if there is unsufficient + /// Returns an [`OUT_OF_RESOURCES`] error if there is insufficient /// memory for the conversion. /// /// [`OUT_OF_RESOURCES`]: Status::OUT_OF_RESOURCES @@ -122,7 +122,7 @@ impl DevicePathToText { /// Convert a device path to its text representation. /// - /// Returns an [`OUT_OF_RESOURCES`] error if there is unsufficient + /// Returns an [`OUT_OF_RESOURCES`] error if there is insufficient /// memory for the conversion. /// /// [`OUT_OF_RESOURCES`]: Status::OUT_OF_RESOURCES @@ -164,7 +164,7 @@ impl DevicePathFromText { /// Conversion starts with the first character and continues until /// the first non-device node character. /// - /// Returns an [`OUT_OF_RESOURCES`] error if there is unsufficient + /// Returns an [`OUT_OF_RESOURCES`] error if there is insufficient /// memory for the conversion. /// /// [`OUT_OF_RESOURCES`]: Status::OUT_OF_RESOURCES @@ -188,7 +188,7 @@ impl DevicePathFromText { /// Conversion starts with the first character and continues until /// the first non-device path character. /// - /// Returns an [`OUT_OF_RESOURCES`] error if there is unsufficient + /// Returns an [`OUT_OF_RESOURCES`] error if there is insufficient /// memory for the conversion. /// /// [`OUT_OF_RESOURCES`]: Status::OUT_OF_RESOURCES diff --git a/uefi/src/proto/media/disk.rs b/uefi/src/proto/media/disk.rs index 8d0562f33..3a041d891 100644 --- a/uefi/src/proto/media/disk.rs +++ b/uefi/src/proto/media/disk.rs @@ -8,7 +8,7 @@ use core::ptr::NonNull; /// /// This protocol is used to abstract the block accesses of the block I/O /// protocol to a more general offset-length protocol. Firmware is -/// reponsible for adding this protocol to any block I/O interface that +/// responsible for adding this protocol to any block I/O interface that /// appears in the system that does not already have a disk I/O protocol. #[repr(C)] #[unsafe_protocol("ce345171-ba0b-11d2-8e4f-00a0c969723b")] diff --git a/uefi/src/proto/media/file/regular.rs b/uefi/src/proto/media/file/regular.rs index f289fb56d..0f5338eee 100644 --- a/uefi/src/proto/media/file/regular.rs +++ b/uefi/src/proto/media/file/regular.rs @@ -63,7 +63,7 @@ impl RegularFile { /// Write `buffer` to file, increment the file pointer. /// /// If an error occurs, returns the number of bytes that were actually written. If no error - /// occured, the entire buffer is guaranteed to have been written successfully. + /// occurred, the entire buffer is guaranteed to have been written successfully. /// /// # Arguments /// * `buffer` Buffer to write to file diff --git a/uefi/src/proto/network/snp.rs b/uefi/src/proto/network/snp.rs index 8f55c0cb4..d57d43fc8 100644 --- a/uefi/src/proto/network/snp.rs +++ b/uefi/src/proto/network/snp.rs @@ -287,7 +287,7 @@ bitflags! { bitflags! { /// Flags returned by get_interrupt_status to indicate which interrupts have fired on the - /// interace since the last call. + /// interface since the last call. pub struct InterruptStatus : u32 { /// Packet received. const RECEIVE = 0x01; diff --git a/uefi/src/proto/string/unicode_collation.rs b/uefi/src/proto/string/unicode_collation.rs index 78866cdc8..0a80b11d5 100644 --- a/uefi/src/proto/string/unicode_collation.rs +++ b/uefi/src/proto/string/unicode_collation.rs @@ -9,7 +9,7 @@ use uefi::data_types::{CStr16, CStr8, Char16, Char8}; /// The Unicode Collation Protocol. /// -/// Used to perform case-insensitive comaprisons of strings. +/// Used to perform case-insensitive comparisons of strings. #[repr(C)] #[unsafe_protocol("a4c751fc-23ae-4c3e-92e9-4964cf63f349")] pub struct UnicodeCollation { diff --git a/xtask/src/device_path/README.md b/xtask/src/device_path/README.md index 78818add8..a5de7d927 100644 --- a/xtask/src/device_path/README.md +++ b/xtask/src/device_path/README.md @@ -70,7 +70,7 @@ struct, is motivated primarily by DST nodes. Many nodes end in a dynamically-sized slice, which prevents the normal struct construction syntax from being used. One option would be to generate a construction function that takes an argument for each field, but that can negatively -impact readibility since there's no named-argument syntax. Having a +impact readability since there's no named-argument syntax. Having a separate builder struct allows us to use the normal struct construction syntax. DST fields in the builder are replaced with slice references.