Skip to content

chore: introduce crate-ci/typos #2430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,20 @@ jobs:
- name: clippy check (default features)
run: cargo clippy --workspace --all-targets

check_typos:
timeout-minutes: 30
name: Checking typos
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "on"
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@v2
with:
tool: typos-cli
- run: typos

msrv:
if: "github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')"
timeout-minutes: 30
Expand Down
25 changes: 25 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[files]
# We can't change the `CHANGELOG` without changing old commit message
extend-exclude = [
"CHANGELOG_old.md",
"CHANGELOG.md"
]

[default]
extend-ignore-re = [
# Line ignore with trailing `// spellchecker:disable-line`
"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$",

# Abbreviations
"UPnP",

# Library name
"tung",

# Hex
"ba",
]

[default.extend-words]
# Library name
ratatui = "ratatui"
2 changes: 1 addition & 1 deletion iroh-blobs/src/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub trait Dialer: Stream<Item = (NodeId, anyhow::Result<Self::Connection>)> + Un
pub enum FailureAction {
/// The request was cancelled by us.
AllIntentsDropped,
/// An error ocurred that prevents the request from being retried at all.
/// An error occurred that prevents the request from being retried at all.
AbortRequest(anyhow::Error),
/// An error occurred that suggests the node should not be used in general.
DropPeer(anyhow::Error),
Expand Down
4 changes: 2 additions & 2 deletions iroh-blobs/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub async fn export<D: BaoStore>(
}
}

/// Export all entries of a collection, recursively, to files on the local fileystem.
/// Export all entries of a collection, recursively, to files on the local filesystem.
pub async fn export_collection<D: BaoStore>(
db: &D,
hash: Hash,
Expand All @@ -55,7 +55,7 @@ pub async fn export_collection<D: BaoStore>(
Ok(())
}

/// Export a single blob to a file on the local fileystem.
/// Export a single blob to a file on the local filesystem.
pub async fn export_blob<D: BaoStore>(
db: &D,
hash: Hash,
Expand Down
2 changes: 1 addition & 1 deletion iroh-blobs/src/store/bao_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ impl Default for BaoFileStorage {
impl BaoFileStorage {
/// Take the storage out, leaving an empty storage in its place.
///
/// Be careful to put somethign back in its place, or you will lose data.
/// Be careful to put something back in its place, or you will lose data.
#[cfg(feature = "fs-store")]
pub fn take(&mut self) -> Self {
std::mem::take(self)
Expand Down
2 changes: 1 addition & 1 deletion iroh-blobs/src/store/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub trait BaoBatchWriter {
/// Write a batch of bao content items to the underlying storage.
///
/// The batch is guaranteed to be sorted as data is received from the network.
/// So leafs will be sorted by offset, and parents will be sorted by pre order
/// So leaves will be sorted by offset, and parents will be sorted by pre order
/// traversal offset. There is no guarantee that they will be consecutive
/// though.
///
Expand Down
2 changes: 1 addition & 1 deletion iroh-dns-server/examples/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async fn main() -> Result<()> {
s
}
Err(_) => {
bail!("Environtment variable IROH_SECRET is not set. To create a new secret, use the --create option.")
bail!("Environment variable IROH_SECRET is not set. To create a new secret, use the --create option.")
}
};

Expand Down
2 changes: 1 addition & 1 deletion iroh-dns-server/src/http/doh/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub struct DnsQuery {
/// Privacy setting for how your IP address is forwarded to authoritative nameservers
#[allow(dead_code)]
pub edns_client_subnet: Option<String>,
/// Some url-safe random characters to pad your messages for privacy (to avoid being fingerprinted by encrytped message length)
/// Some url-safe random characters to pad your messages for privacy (to avoid being fingerprinted by encrypted message length)
#[allow(dead_code)]
pub random_padding: Option<String>,
/// Whether to provide answers for all records up to the root
Expand Down
2 changes: 1 addition & 1 deletion iroh-docs/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl DefaultAuthorStorage {
}
}

/// Peristent default author for a docs engine.
/// Persistent default author for a docs engine.
#[derive(Debug)]
pub struct DefaultAuthor {
value: RwLock<AuthorId>,
Expand Down
4 changes: 2 additions & 2 deletions iroh-docs/src/store/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ impl Store {
})
}

/// Delte an author.
/// Delete an author.
pub fn delete_author(&mut self, author: AuthorId) -> Result<()> {
self.modify(|tables| {
tables.authors.remove(author.as_bytes())?;
Expand Down Expand Up @@ -881,7 +881,7 @@ impl Iterator for ParentIterator {
/// a database snapshot open until it is dropped.
///
/// Also, this represents a snapshot of the database at the time of creation.
/// It nees a copy of a redb::ReadOnlyTable to be self-contained.
/// It needs a copy of a redb::ReadOnlyTable to be self-contained.
#[derive(derive_more::Debug)]
pub struct ContentHashesIterator {
#[debug(skip)]
Expand Down
2 changes: 1 addition & 1 deletion iroh-gossip/examples/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async fn main() -> anyhow::Result<()> {
};
println!("> our secret key: {secret_key}");

// confgure our relay map
// configure our relay map
let relay_mode = match (args.no_relay, args.relay) {
(false, None) => RelayMode::Default,
(false, Some(url)) => RelayMode::Custom(RelayMap::from_url(url)),
Expand Down
2 changes: 1 addition & 1 deletion iroh-net/src/bin/iroh-relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl Default for Config {
/// Defaults for fields from [`Config`].
///
/// These are the defaults that serde will fill in. Other defaults depends on each other
/// and can not immediately be substituded by serde.
/// and can not immediately be substituted by serde.
mod cfg_defaults {
pub(crate) fn enable_relay() -> bool {
true
Expand Down
2 changes: 1 addition & 1 deletion iroh-net/src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub struct DiscoveryItem {
///
/// Must be microseconds since the unix epoch.
pub last_updated: Option<u64>,
/// The adress info for the node being resolved.
/// The address info for the node being resolved.
pub addr_info: AddrInfo,
}

Expand Down
8 changes: 4 additions & 4 deletions iroh-net/src/discovery/pkarr_publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,20 @@ struct PublisherService {

impl PublisherService {
async fn run(self) {
let mut failed_attemps = 0;
let mut failed_attempts = 0;
let republish = tokio::time::sleep(Duration::MAX);
tokio::pin!(republish);
loop {
if let Some(info) = self.watcher.get() {
if let Err(err) = self.publish_current(info).await {
warn!(?err, url = %self.pkarr_client.pkarr_relay_url , "Failed to publish to pkarr");
failed_attemps += 1;
failed_attempts += 1;
// Retry after increasing timeout
republish
.as_mut()
.reset(Instant::now() + Duration::from_secs(failed_attemps));
.reset(Instant::now() + Duration::from_secs(failed_attempts));
} else {
failed_attemps = 0;
failed_attempts = 0;
// Republish after fixed interval
republish
.as_mut()
Expand Down
4 changes: 2 additions & 2 deletions iroh-net/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ impl Endpoint {
///
/// Then [`Endpoint`] stores some information about all the other iroh-net nodes it has
/// information about. This includes information about the relay server in use, any
/// known direct addresses, when there was last any conact with this node and what kind
/// known direct addresses, when there was last any contact with this node and what kind
/// of connection this was.
pub fn connection_info(&self, node_id: NodeId) -> Option<ConnectionInfo> {
self.msock.connection_info(node_id)
Expand Down Expand Up @@ -1038,7 +1038,7 @@ fn try_send_rtt_msg(conn: &quinn::Connection, magic_ep: &Endpoint) {
}
}

/// Read a proxy url from the environemnt, in this order
/// Read a proxy url from the environment, in this order
///
/// - `HTTP_PROXY`
/// - `http_proxy`
Expand Down
2 changes: 1 addition & 1 deletion iroh-net/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
//!
//! The [`DnsDiscovery`] service is a discovery service which will publish the [`RelayUrl`]
//! and direct addresses to a service publishing those as DNS records. To connect it looks
//! up the [`NodeId`] in the DNS system to find the adressing details. This enables
//! up the [`NodeId`] in the DNS system to find the addressing details. This enables
//! connecting using only the [`NodeId`] which is often more convenient and resilient.
//!
//!
Expand Down
8 changes: 4 additions & 4 deletions iroh-net/src/magicsock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@ impl Stream for DirectAddrsStream {
if discovered.is_empty() {
// When we start up we might initially have empty local endpoints as
// the magic socket has not yet figured this out. Later on this set
// should never be emtpy. However even if it was the magicsock
// should never be empty. However even if it was the magicsock
// would be in a state not very useable so skipping those events is
// probably fine.
// To make sure we install the right waker we loop rather than
Expand Down Expand Up @@ -2646,7 +2646,7 @@ pub enum DirectAddrType {
///
/// When possible an iroh-net node will perform STUN to discover which is the address
/// from which it sends data on the public internet. This can be different from locally
/// bound addresses when the node is on a local network wich performs NAT or similar.
/// bound addresses when the node is on a local network which performs NAT or similar.
Stun,
/// An address assigned by the router using port mapping.
///
Expand Down Expand Up @@ -2913,7 +2913,7 @@ mod tests {
// TODO: ensure panics in this function are reported ok
assert!(
stats.path.lost_packets < 10,
"[reciever] should not loose many packets",
"[receiver] should not loose many packets",
);

info!("close");
Expand Down Expand Up @@ -3494,7 +3494,7 @@ mod tests {
mk_transmit(b"hello world", Some(5)),
mk_transmit(b"!", None)
]),
mk_expected(["hello", " worl", "d", "!"])
mk_expected(["hello", " worl", "d", "!"]) // spellchecker:disable-line
);
// split that results in 1 packet
assert_eq!(
Expand Down
4 changes: 2 additions & 2 deletions iroh-net/src/magicsock/node_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ impl NodeMap {
/// Returns a stream of [`ConnectionType`].
///
/// Sends the current [`ConnectionType`] whenever any changes to the
/// connection type for `public_key` has occured.
/// connection type for `public_key` has occurred.
///
/// # Errors
///
Expand Down Expand Up @@ -472,7 +472,7 @@ impl NodeMapInner {
/// Returns a stream of [`ConnectionType`].
///
/// Sends the current [`ConnectionType`] whenever any changes to the
/// connection type for `public_key` has occured.
/// connection type for `public_key` has occurred.
///
/// # Errors
///
Expand Down
4 changes: 2 additions & 2 deletions iroh-net/src/magicsock/node_map/node_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ impl NodeState {
best_addr::State::Empty | best_addr::State::Outdated(_)
) {
// We also need to send a ping to make this path available to us as well. This
// is always sent togehter with a pong. So in the worst case the pong gets lost
// is always sent together with a pong. So in the worst case the pong gets lost
// and this ping does not. In that case we ping-pong until both sides have
// received at least one pong. Once both sides have received one pong they both
// have a best_addr and this ping will stop being sent.
Expand Down Expand Up @@ -934,7 +934,7 @@ impl NodeState {
st.last_ping = None;
if !call_me_maybe_ipps.contains(ipp) {
// TODO: This seems like a weird way to signal that the endpoint no longer
// thinks it has this IpPort as an avaialable path.
// thinks it has this IpPort as an available path.
if st.recent_pong.is_some() {
debug!(path=?ipp ,"clearing recent pong");
st.recent_pong = None;
Expand Down
2 changes: 1 addition & 1 deletion iroh-net/src/netcheck/reportgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ mod tests {
// sudo sysctl net.ipv4.ping_group_range="1234 1234"
//
// Note that this does not survive a reboot usually, commonly you need to edit
// /etc/sysctl.conf or /etc/sysctl.d/* to persist this accross reboots.
// /etc/sysctl.conf or /etc/sysctl.d/* to persist this across reboots.
//
// TODO: Not sure what about IPv6 pings using sysctl.
#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion iroh-net/src/relay/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub(super) const PER_CLIENT_READ_QUEUE_DEPTH: usize = 512;
/// ProtocolVersion is bumped whenever there's a wire-incompatible change.
/// - version 1 (zero on wire): consistent box headers, in use by employee dev nodes a bit
/// - version 2: received packets have src addrs in FrameType::RecvPacket at beginning
/// NOTE: we are techincally running a modified version of the protocol.
/// NOTE: we are technically running a modified version of the protocol.
/// `FrameType::PeerPresent`, `FrameType::WatchConn`, `FrameType::ClosePeer`, have been removed.
/// The server will error on that connection if a client sends one of these frames.
/// We have split with the DERP protocol significantly starting with our relay protocol 3
Expand Down
2 changes: 1 addition & 1 deletion iroh-net/src/util/chain.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! IO utilitiy to chain `AsyncRead`s together.
//! IO utility to chain `AsyncRead`s together.

// Based on tokios chain implementation, that doesn't make the concrete type public.

Expand Down
2 changes: 1 addition & 1 deletion iroh/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<D: BaoStore> Node<D> {
&self.inner.client
}

/// Returns a referenc to the used `LocalPoolHandle`.
/// Returns a reference to the used `LocalPoolHandle`.
pub fn local_pool_handle(&self) -> &LocalPoolHandle {
&self.inner.rt
}
Expand Down
6 changes: 3 additions & 3 deletions iroh/src/rpc_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl ServerStreamingMsg<RpcService> for BlobDownloadRequest {
type Response = BlobDownloadResponse;
}

/// Progress resposne for [`BlobDownloadRequest`]
/// Progress response for [`BlobDownloadRequest`]
#[derive(Debug, Clone, Serialize, Deserialize, derive_more::From, derive_more::Into)]
pub struct BlobDownloadResponse(pub DownloadProgress);

Expand Down Expand Up @@ -143,7 +143,7 @@ impl ServerStreamingMsg<RpcService> for BlobExportRequest {
type Response = BlobExportResponse;
}

/// Progress resposne for [`BlobExportRequest`]
/// Progress response for [`BlobExportRequest`]
#[derive(Debug, Clone, Serialize, Deserialize, derive_more::From, derive_more::Into)]
pub struct BlobExportResponse(pub ExportProgress);

Expand Down Expand Up @@ -953,7 +953,7 @@ pub struct BlobReadAtRequest {
pub hash: Hash,
/// Offset to start reading at
pub offset: u64,
/// Lenghth of the data to get
/// Length of the data to get
pub len: Option<usize>,
}

Expand Down
Loading