Skip to content

Commit

Permalink
ci: add spellchecking (#6297)
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen-CH-Leung committed Jan 29, 2024
1 parent e53b92a commit 131e7b4
Show file tree
Hide file tree
Showing 73 changed files with 616 additions and 282 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
- check-external-types
- check-fuzzing
- check-unstable-mt-counters
- check-spelling
steps:
- run: exit 0

Expand Down Expand Up @@ -994,3 +995,22 @@ jobs:
- name: Check /tokio-stream/
run: cargo fuzz check --all-features
working-directory: tokio-stream

check-spelling:
name: check-spelling
needs: basics
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust ${{ env.rust_stable }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_stable }}
- name: Install cargo-spellcheck
uses: taiki-e/install-action@v2
with:
tool: cargo-spellcheck
- uses: actions/checkout@v4
- name: Run cargo-spellcheck
run: cargo spellcheck --code 1

18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,24 @@ MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-tag-raw-pointers" \
cargo +nightly miri test --features full --lib
```

### Performing spellcheck on tokio codebase

You can perform spell-check on tokio codebase. For details of how to use the spellcheck tool, feel free to visit
https://github.com/drahnr/cargo-spellcheck
```
# First install the spell-check plugin
cargo install --locked cargo-spellcheck
# Then run the cargo spell check command
cargo spellcheck check
```

if the command rejects a word, you should backtick the rejected word if it's code related. If not, the
rejected word should be put into `spellcheck.dic` file.

Note that when you add a word into the file, you should also update the first line which tells the spellcheck tool
the total number of words included in the file

### Tests

If the change being proposed alters code (as opposed to only documentation for
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ members = [
"tests-build",
"tests-integration",
]

[workspace.metadata.spellcheck]
config = "spellcheck.toml"

279 changes: 279 additions & 0 deletions spellcheck.dic
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
279
\
~
~4
~12
±1m
±1ms
&
+
0o777
0s
0xA
0xD
100ms
10ms
1ms
1s
250ms
2x
443
450ms
50ms
8MB
<
=
>
adaptor
adaptors
Adaptors
AIO
ambiant
amongst
api
APIs
async
awaitable
backend
backpressure
backtrace
backtraces
backtracing
binded
bitfield
bitfields
Blockingly
boolean
broadcasted
cancelled
cancelling
Cancelling
CLI
cloneable
codebase
codec
codecs
combinator
combinators
Config
config
connectionless
cpu
cpus
Customizable
Datagram
datagram
datagrams
deallocate
deallocated
Deallocates
decrementing
dequeued
deregister
deregistered
deregistering
Deregisters
deregisters
deregistration
descriptor's
destructor
destructors
destructure
Destructures
Dev
dns
DNS
DoS
dwOpenMode
endian
enqueue
enqueued
EntryInner
enum
eof
errored
EWMA
expirations
fcntl
fd's
FIFOs
filename
filesystem
filesystems
fn
fns
FreeBSD
frontend
fs
functionalities
getters
GID
Growable
gzip
hashmaps
HashMaps
hashsets
ie
Illumos
impl
implementers
implementor
implementors
incrementing
interoperate
Invariants
invariants
io
IOCP
iOS
IOs
IP
IPv4
IPv6
iteratively
latencies
Lauck
libc
lifecycle
lifo
lookups
macOS
MacOS
Marsaglia's
metadata
mio
Mio
mio's
misconfigured
mock's
mpmc
mpsc
Multi
multi
multicast
Multithreaded
mut
mutex
Mutex
Nagle
nonblocking
nondecreasing
noop
ntasks
ok
oneshot
ORed
os
overweighing
parker
parsers
peekable
PGID
PID
plaintext
poller
POSIX
proxied
qos
RAII
reallocations
recv's
refactors
refcount
refcounting
repo
repr
representable
reqwest
reregistering
resize
resized
RMW
runtime
runtimes
runtime's
rwlock
rx
scalability
scheduler's
semver
setpgid
sharded
signalled
signalling
SmallCrush
Solaris
spawner
Splitter
spmc
spsc
src
stabilised
startup
stateful
stderr
stdin
stdout
stealable
stealer
stealers
struct
structs
subfield
suboptimal
subprocess
superset
symlink
symlinks
sys
syscall
syscalls
TCP
tcp
TestU01
threadpool
timestamp
timestamps
TLS
TOCTOU
TODO
Tokio
tokio
tokio's
Tokio's
Tuple
tuple
tx
UDP
udp
UID
unhandled
unix
unlink
unpark
Unpark
unparked
unparking
Unparks
unparks
unreceived
unsafety
Unsets
unsynchronized
untrusted
usecases
Valgrind
Varghese
vec
versa
versioned
versioning
vtable
waker
wakers
Wakers
wakeup
wakeups
workstealing

13 changes: 13 additions & 0 deletions spellcheck.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
dev_comments = false
skip_readme = false

[Hunspell]
lang = "en_US"
search_dirs = ["."]
extra_dictionaries = ["spellcheck.dic"]
skip_os_lookups = true
use_builtin = true

[Hunspell.quirks]
allow_concatenation = true

2 changes: 1 addition & 1 deletion tokio-stream/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
//!
//! [async-stream]: https://docs.rs/async-stream
//!
//! # Conversion to and from AsyncRead/AsyncWrite
//! # Conversion to and from `AsyncRead`/`AsyncWrite`
//!
//! It is often desirable to convert a `Stream` into an [`AsyncRead`],
//! especially when dealing with plaintext formats streamed over the network.
Expand Down
4 changes: 2 additions & 2 deletions tokio-stream/src/stream_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,9 +658,9 @@ mod rand {

/// Fast random number generate
///
/// Implement xorshift64+: 2 32-bit xorshift sequences added together.
/// Implement `xorshift64+`: 2 32-bit `xorshift` sequences added together.
/// Shift triplet `[17,7,16]` was calculated as indicated in Marsaglia's
/// Xorshift paper: <https://www.jstatsoft.org/article/view/v008i14/xorshift.pdf>
/// `Xorshift` paper: <https://www.jstatsoft.org/article/view/v008i14/xorshift.pdf>
/// This generator passes the SmallCrush suite, part of TestU01 framework:
/// <http://simul.iro.umontreal.ca/testu01/tu01.html>
#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion tokio-stream/src/wrappers/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use tokio::sync::watch::error::RecvError;

/// A wrapper around [`tokio::sync::watch::Receiver`] that implements [`Stream`].
///
/// This stream will start by yielding the current value when the WatchStream is polled,
/// This stream will start by yielding the current value when the `WatchStream` is polled,
/// regardless of whether it was the initial value or sent afterwards,
/// unless you use [`WatchStream<T>::from_changes`].
///
Expand Down
2 changes: 1 addition & 1 deletion tokio-util/src/codec/framed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl<T, U> Framed<T, U> {
/// things like gzip or TLS, which require both read and write access to the
/// underlying object.
///
/// This objects takes a stream and a readbuffer and a writebuffer. These field
/// This objects takes a stream and a `readbuffer` and a `writebuffer`. These field
/// can be obtained from an existing `Framed` with the [`into_parts`] method.
///
/// If you want to work more directly with the streams and sink, consider
Expand Down
Loading

0 comments on commit 131e7b4

Please sign in to comment.