From 9db9d90c31459668cfeda508c88771b23b7ecf1a Mon Sep 17 00:00:00 2001 From: Sijie Yang Date: Wed, 13 Dec 2023 16:38:56 +0800 Subject: [PATCH] Add typos.toml and fix typos (#95) --- .github/workflows/rust.yml | 4 ++++ CHANGELOG.md | 4 ++-- src/lib.rs | 2 +- src/packet.rs | 4 ++-- src/qlog/events.rs | 2 +- src/ranges.rs | 2 +- typos.toml | 24 ++++++++++++++++++++++++ 7 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 typos.toml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b19d2e6ee..8071612f6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -84,6 +84,10 @@ jobs: run: rustup update - name: Code format check run: cargo fmt --check + - name: Code spell check + run: | + cargo install typos-cli + typos -c ./typos.toml - name: Code lint check run: cargo clippy --all -- -D warnings diff --git a/CHANGELOG.md b/CHANGELOG.md index 9347a76d7..2873b13b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,13 +20,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add quic_conn_index() for getting connection index - tquic_client: create the output directory if it does not exist - tquic_client: convert unspecified address to localhost address -- tquic_client: prompt help messages for wrong command args - +- tquic_client: prompt help messages for wrong command args - tquic_client: print statistics at the end of execution - Improve unit testing - Improve static analysis ### Changed -- endpoint: change Endpoint.close() to support forcily close the endpint +- endpoint: change Endpoint.close() to support forcily close the endpoint - endpoint: quic_endpoint_new() no longer takes ownership of the resources provides by the C caller - tquic_client: change `-p` option to write the response header and body to stdout diff --git a/src/lib.rs b/src/lib.rs index b1e2ab1a2..61ad89081 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -144,7 +144,7 @@ pub type Result = std::result::Result; pub struct ConnectionId { /// length of cid len: u8, - /// octects of cid + /// octets of cid data: [u8; MAX_CID_LEN], } diff --git a/src/packet.rs b/src/packet.rs index cbd408000..6e3019e6e 100644 --- a/src/packet.rs +++ b/src/packet.rs @@ -180,7 +180,7 @@ impl PacketHeader { /// /// The Length/Packet Number field are intentionally not written to the /// buffer for the moment. - /// See RFC 9002 Section 17 Packet Fromats + /// See RFC 9002 Section 17 Packet Formats pub fn to_bytes(&self, mut buf: &mut [u8]) -> Result { let len = buf.len(); @@ -267,7 +267,7 @@ impl PacketHeader { /// The Length/Packet Number field in packet header are intentionally not /// read from the buffer for the moment. /// - /// See RFC 9002 Section 17 Packet Fromats + /// See RFC 9002 Section 17 Packet Formats pub fn from_bytes(mut buf: &[u8], dcid_len: usize) -> Result<(PacketHeader, usize)> { let len = buf.len(); let first = buf.read_u8()?; diff --git a/src/qlog/events.rs b/src/qlog/events.rs index fe66e6990..ae68011d6 100644 --- a/src/qlog/events.rs +++ b/src/qlog/events.rs @@ -721,7 +721,7 @@ impl EventImportance { /// The "time" field indicates the timestamp at which the event occurred. #[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)] pub enum TimeFormat { - /// Iclude the full absolute timestamp with each event. This approach uses + /// Include the full absolute timestamp with each event. This approach uses /// the largest amount of characters. Absolute, diff --git a/src/ranges.rs b/src/ranges.rs index 52a1b50ba..401b92b29 100644 --- a/src/ranges.rs +++ b/src/ranges.rs @@ -948,7 +948,7 @@ mod tests { // Insert range [0, 1), only one elem. r.insert(0..1); assert_eq!(r.len(), 1); - // Tranverse the range from both directions. + // Traverse the range from both directions. assert_eq!(&r.flatten().collect::>(), &[0]); assert_eq!(&r.flatten().rev().collect::>(), &[0]); diff --git a/typos.toml b/typos.toml new file mode 100644 index 000000000..8fa53dbe2 --- /dev/null +++ b/typos.toml @@ -0,0 +1,24 @@ +[default] +binary = false +check-filename = true + +[default.extend-identifiers] +referes = "referes" +StatuS = "StatuS" + +[default.extend-words] +# ECN Capable Transport +ect = "ect" + +[files] +extend-exclude = [ + "*.snap", + "*.bin", + "*.der", + "*.pem", + "LICENSE", + "**/website/**/*", + "**/target/**/*", + "**/deps/**/*", + "**/corpus/**/*", +]