Skip to content
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

Add typos check to CI #1065

Merged
merged 2 commits into from
Jun 10, 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
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ jobs:
run: ci/valgrind-check/run.sh
shell: bash

typos:
name: Typos Check
runs-on: ubuntu-latest
steps:
- name: Clone this repository
uses: actions/checkout@v4

- name: Check spelling
uses: crate-ci/typos@master

kilpkonn marked this conversation as resolved.
Show resolved Hide resolved
# NOTE: In GitHub repository settings, the "Require status checks to pass
# before merging" branch protection rule ensures that commits are only merged
# from branches where specific status checks have passed. These checks are
Expand All @@ -141,7 +151,7 @@ jobs:
ci:
name: CI status checks
runs-on: ubuntu-latest
needs: [check, test, valgrind]
needs: [check, test, valgrind, typos]
if: always()
steps:
- name: Check whether all jobs pass
Expand Down
18 changes: 9 additions & 9 deletions DEFAULT_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
exit_on_failure: { router: false, peer: false, client: true },
/// connect establishing retry configuration
retry: {
/// intial wait timeout until next connect try
/// initial wait timeout until next connect try
period_init_ms: 1000,
/// maximum wait timeout until next connect try
period_max_ms: 4000,
Expand Down Expand Up @@ -73,7 +73,7 @@
exit_on_failure: true,
/// listen retry configuration
retry: {
/// intial wait timeout until next try
/// initial wait timeout until next try
period_init_ms: 1000,
/// maximum wait timeout until next try
period_max_ms: 4000,
Expand Down Expand Up @@ -108,8 +108,8 @@
gossip: {
/// Whether gossip scouting is enabled or not
enabled: true,
/// When true, gossip scouting informations are propagated multiple hops to all nodes in the local network.
/// When false, gossip scouting informations are only propagated to the next hop.
/// When true, gossip scouting information are propagated multiple hops to all nodes in the local network.
/// When false, gossip scouting information are only propagated to the next hop.
/// Activating multihop gossip implies more scouting traffic and a lower scalability.
/// It mostly makes sense when using "linkstate" routing mode where all nodes in the subsystem don't have
/// direct connectivity with each other.
Expand Down Expand Up @@ -265,7 +265,7 @@
/// set the actual keep_alive interval to one fourth of the lease time: i.e. send
/// 4 keep_alive messages in a lease period. Changing the lease time will have the
/// keep_alive messages sent more or less often.
/// This is in-line with the ITU-T G.8013/Y.1731 specification on continous connectivity
/// This is in-line with the ITU-T G.8013/Y.1731 specification on continuous connectivity
/// check which considers a link as failed when no messages are received in 3.5 times the
/// target interval.
keep_alive: 4,
Expand All @@ -291,7 +291,7 @@
background: 4,
},
/// Congestion occurs when the queue is empty (no available batch).
/// Using CongestionControl::Block the caller is blocked until a batch is available and re-insterted into the queue.
/// Using CongestionControl::Block the caller is blocked until a batch is available and re-inserted into the queue.
/// Using CongestionControl::Drop the message might be dropped, depending on conditions configured here.
congestion_control: {
/// The maximum time in microseconds to wait for an available batch before dropping the message if still no batch is available.
Expand All @@ -306,7 +306,7 @@
rx: {
/// Receiving buffer size in bytes for each link
/// The default the rx_buffer_size value is the same as the default batch size: 65335.
/// For very high throughput scenarios, the rx_buffer_size can be increased to accomodate
/// For very high throughput scenarios, the rx_buffer_size can be increased to accommodate
/// more in-flight data. This is particularly relevant when dealing with large messages.
/// E.g. for 16MiB rx_buffer_size set the value to: 16777216.
buffer_size: 65535,
Expand Down Expand Up @@ -343,7 +343,7 @@
enabled: false,
},
auth: {
/// The configuration of authentification.
/// The configuration of authentication.
/// A password implies a username is required.
usrpwd: {
user: null,
Expand Down Expand Up @@ -396,7 +396,7 @@
// /// - If json objects in loaded file contains `__config__` properties, they are processed recursively
// /// This is used in the 'storage_manager' which supports subplugins, each with it's own config
// ///
// /// See below exapmle of plugin configuration using `__config__` property
// /// See below example of plugin configuration using `__config__` property
//
// /// Configure the REST API plugin
// rest: {
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ Then you can start run `zenohd`.
## How to build it

> [!WARNING]
> Zenoh and its ecosystem are under active development. When you build from git, make sure you also build from git any other Zenoh repository you plan to use (e.g. binding, plugin, backend, etc.). It may happen that some changes in git are not compatible with the most recent packaged Zenoh release (e.g. deb, docker, pip). We put particular effort in mantaining compatibility between the various git repositories in the Zenoh project.
> Zenoh and its ecosystem are under active development. When you build from git, make sure you also build from git any other Zenoh repository you plan to use (e.g. binding, plugin, backend, etc.). It may happen that some changes in git are not compatible with the most recent packaged Zenoh release (e.g. deb, docker, pip). We put particular effort in maintaining compatibility between the various git repositories in the Zenoh project.

Install [Cargo and Rust](https://doc.rust-lang.org/cargo/getting-started/installation.html). Zenoh can be succesfully compiled with Rust stable (>= 1.71.0), so no special configuration is required from your side. If you already have the Rust toolchain installed, make sure it is up-to-date with:
Install [Cargo and Rust](https://doc.rust-lang.org/cargo/getting-started/installation.html). Zenoh can be successfully compiled with Rust stable (>= 1.71.0), so no special configuration is required from your side. If you already have the Rust toolchain installed, make sure it is up-to-date with:

```bash
$ rustup update
Expand Down Expand Up @@ -170,7 +170,7 @@ See other examples of Zenoh usage in [examples/](examples)
* `--rest-http-port <rest-http-port>`: Configures the [REST plugin](https://zenoh.io/docs/manual/plugin-http/)'s HTTP port. Accepted values:
- a port number
- a string with format `<local_ip>:<port_number>` (to bind the HTTP server to a specific interface)
- `"None"` to desactivate the REST plugin
- `"None"` to deactivate the REST plugin

If not specified, the REST plugin will be active on any interface (`[::]`) and port `8000`.

Expand Down
11 changes: 11 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[files]
extend-exclude = [
# Ignore all files in transport tests as they contain
# hashes that are treated as typos.
"io/zenoh-transport/tests/*.rs",
]


[default.extend-words]
mis = "mis" # mismatch
thr = "thr" # throughput
4 changes: 2 additions & 2 deletions commons/zenoh-codec/src/core/zint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ zint_impl!(usize);
// // guarantees at this point that `x` is never `0`. Since `x` is 64bit,
// // then `n` is guaranteed to have a value between 1 and 8, both inclusives.
// // `into` is guaranteed to be exactly 9 bytes long. Therefore, copying at most
// // 8 bytes with a pointer offest of 1 is actually safe.
// // 8 bytes with a pointer offset of 1 is actually safe.
// let n = 8 - (x.leading_zeros() / 8) as usize;
// unsafe {
// core::ptr::copy_nonoverlapping(
Expand Down Expand Up @@ -348,7 +348,7 @@ zint_impl!(usize);

// macro_rules! non_zero_array {
// ($($i: expr,)*) => {
// [$(match NonZeroU8::new($i) {Some(x) => x, None => panic!("Attempted to place 0 in an array of non-zeros litteral")}),*]
// [$(match NonZeroU8::new($i) {Some(x) => x, None => panic!("Attempted to place 0 in an array of non-zeros literal")}),*]
// };
// }

Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-collections/src/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const COMMENT_PREFIX: char = '#';

/// A map of key/value (String,String) properties.
/// It can be parsed from a String, using `;` or `<newline>` as separator between each properties
/// and `=` as separator between a key and its value. Keys and values are trimed.
/// and `=` as separator between a key and its value. Keys and values are trimmed.
#[non_exhaustive]
#[derive(Clone, PartialEq, Eq, Default)]
pub struct Properties(HashMap<String, String>);
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-config/src/connection_retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::mode_dependent::*;

#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct ConnectionRetryModeDependentConf {
// intial wait timeout until next try
// initial wait timeout until next try
pub period_init_ms: Option<ModeDependentValue<i64>>,
// maximum wait timeout until next try
pub period_max_ms: Option<ModeDependentValue<i64>>,
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-config/src/include.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub(crate) fn recursive_include<P>(
where
P: AsRef<Path>,
{
// if include property is present, read the file and remove properites found in file from values
// if include property is present, read the file and remove properties found in file from values
let include_object = if let Some(include_path) = values.get(include_property_name) {
let Some(include_path) = include_path.as_str() else {
bail!(
Expand Down
14 changes: 7 additions & 7 deletions commons/zenoh-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub trait ConfigValidator: Send + Sync {
}
}

// Necessary to allow to set default emplty weak referece value to plugin.validator field
// Necessary to allow to set default emplty weak reference value to plugin.validator field
// because empty weak value is not allowed for Arc<dyn Trait>
impl ConfigValidator for () {}

Expand Down Expand Up @@ -267,8 +267,8 @@ validated_struct::validator! {
GossipConf {
/// Whether gossip scouting is enabled or not.
enabled: Option<bool>,
/// When true, gossip scouting informations are propagated multiple hops to all nodes in the local network.
/// When false, gossip scouting informations are only propagated to the next hop.
/// When true, gossip scouting information are propagated multiple hops to all nodes in the local network.
/// When false, gossip scouting information are only propagated to the next hop.
/// Activating multihop gossip implies more scouting traffic and a lower scalability.
/// It mostly makes sense when using "linkstate" routing mode where all nodes in the subsystem don't have
/// direct connectivity with each other.
Expand Down Expand Up @@ -375,7 +375,7 @@ validated_struct::validator! {
sequence_number_resolution: Bits where (sequence_number_resolution_validator),
/// Link lease duration in milliseconds (default: 10000)
lease: u64,
/// Number fo keep-alive messages in a link lease duration (default: 4)
/// Number of keep-alive messages in a link lease duration (default: 4)
keep_alive: usize,
/// Zenoh's MTU equivalent (default: 2^16-1)
batch_size: BatchSize,
Expand All @@ -396,7 +396,7 @@ validated_struct::validator! {
background: usize,
} where (queue_size_validator),
/// Congestion occurs when the queue is empty (no available batch).
/// Using CongestionControl::Block the caller is blocked until a batch is available and re-insterted into the queue.
/// Using CongestionControl::Block the caller is blocked until a batch is available and re-inserted into the queue.
/// Using CongestionControl::Drop the message might be dropped, depending on conditions configured here.
pub congestion_control: CongestionControlConf {
/// The maximum time in microseconds to wait for an available batch before dropping the message if still no batch is available.
Expand All @@ -412,7 +412,7 @@ validated_struct::validator! {
pub rx: LinkRxConf {
/// Receiving buffer size in bytes for each link
/// The default the rx_buffer_size value is the same as the default batch size: 65335.
/// For very high throughput scenarios, the rx_buffer_size can be increased to accomodate
/// For very high throughput scenarios, the rx_buffer_size can be increased to accommodate
/// more in-flight data. This is particularly relevant when dealing with large messages.
/// E.g. for 16MiB rx_buffer_size set the value to: 16777216.
buffer_size: usize,
Expand Down Expand Up @@ -455,7 +455,7 @@ validated_struct::validator! {
},
pub auth: #[derive(Default)]
AuthConf {
/// The configuration of authentification.
/// The configuration of authentication.
/// A password implies a username is required.
pub usrpwd: #[derive(Default)]
UsrPwdConf {
Expand Down
12 changes: 6 additions & 6 deletions commons/zenoh-keyexpr/src/key_expr/borrowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl keyexpr {

/// Joins both sides, inserting a `/` in between them.
///
/// This should be your prefered method when concatenating path segments.
/// This should be your preferred method when concatenating path segments.
///
/// This is notably useful for workspaces:
/// ```rust
Expand Down Expand Up @@ -137,7 +137,7 @@ impl keyexpr {
///
/// NOTE: this operation can typically be used in a backend implementation, at creation of a Storage to get the keys prefix,
/// and then in `zenoh_backend_traits::Storage::on_sample()` this prefix has to be stripped from all received
/// `Sample::key_expr` to retrieve the corrsponding key.
/// `Sample::key_expr` to retrieve the corresponding key.
///
/// # Examples:
/// ```
Expand Down Expand Up @@ -172,12 +172,12 @@ impl keyexpr {
}

/// Remove the specified `prefix` from `self`.
/// The result is a list of `keyexpr`, since there might be several ways for the prefix to match the begining of the `self` key expression.
/// The result is a list of `keyexpr`, since there might be several ways for the prefix to match the beginning of the `self` key expression.
/// For instance, if `self` is `"a/**/c/*" and `prefix` is `a/b/c` then:
/// - the `prefix` matches `"a/**/c"` leading to a result of `"*"` when stripped from `self`
/// - the `prefix` matches `"a/**"` leading to a result of `"**/c/*"` when stripped from `self`
/// So the result is `["*", "**/c/*"]`.
/// If `prefix` cannot match the begining of `self`, an empty list is reuturned.
/// If `prefix` cannot match the beginning of `self`, an empty list is reuturned.
///
/// See below more examples.
///
Expand Down Expand Up @@ -581,7 +581,7 @@ enum KeyExprConstructionError {
LoneDollarStar = -1,
SingleStarAfterDoubleStar = -2,
DoubleStarAfterDoubleStar = -3,
EmpyChunk = -4,
EmptyChunk = -4,
StarsInChunk = -5,
DollarAfterDollarOrStar = -6,
ContainsSharpOrQMark = -7,
Expand All @@ -595,7 +595,7 @@ impl<'a> TryFrom<&'a str> for &'a keyexpr {
let mut in_big_wild = false;
for chunk in value.split('/') {
if chunk.is_empty() {
bail!((KeyExprConstructionError::EmpyChunk) "Invalid Key Expr `{}`: empty chunks are forbidden, as well as leading and trailing slashes", value)
bail!((KeyExprConstructionError::EmptyChunk) "Invalid Key Expr `{}`: empty chunks are forbidden, as well as leading and trailing slashes", value)
}
if chunk == "$*" {
bail!((KeyExprConstructionError::LoneDollarStar)
Expand Down
4 changes: 2 additions & 2 deletions commons/zenoh-keyexpr/src/key_expr/format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//! ## The format syntax
//! KE formats are defined following a syntax that extends the [`keyexpr`] syntax. In addition to existing chunk types, KE formmats support "specification" chunks.
//! These chunks must follow the one of the following syntaxes: `${id:pattern}`, `${id:pattern#default}`, `$#{id:pattern}#`, or `$#{id:pattern#default}#`, where:
//! - `id` is the chunk identifer: it cannot contain the `:` character, and is used to name the chunk in accessors.
//! - `id` is the chunk identifier: it cannot contain the `:` character, and is used to name the chunk in accessors.
//! - `pattern` must be a valid KE (and therefore cannot contain `#`) and defines the range of values that the chunk may adopt.
//! - `default` (optional) is used as the chunk value when formatting if the builder wasn't supplied with a value for `id`.
//!
Expand Down Expand Up @@ -73,7 +73,7 @@ use support::{IterativeConstructor, Spec};
/// ## The format syntax
/// KE formats are defined following a syntax that extends the [`keyexpr`] syntax. In addition to existing chunk types, KE formmats support "specification" chunks.
/// These chunks must follow the one of the following syntaxes: `${id:pattern}`, `${id:pattern#default}`, `$#{id:pattern}#`, or `$#{id:pattern#default}#`, where:
/// - `id` is the chunk identifer: it cannot contain the `:` character, and is used to name the chunk in accessors.
/// - `id` is the chunk identifier: it cannot contain the `:` character, and is used to name the chunk in accessors.
/// - `pattern` must be a valid KE (and therefore cannot contain `#`) and defines the range of values that the chunk may adopt.
/// - `default` (optional) is used as the chunk value when formatting if the builder wasn't supplied with a value for `id`.
///
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-keyexpr/src/key_expr/intersect/classical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fn it_intersect<const STAR_DSL: bool>(mut it1: &[u8], mut it2: &[u8]) -> bool {
}
(it1.is_empty() || it1 == b"**") && (it2.is_empty() || it2 == b"**")
}
/// Retruns `true` if the given key expressions intersect.
/// Returns `true` if the given key expressions intersect.
///
/// I.e. if it exists a resource key (with no wildcards) that matches
/// both given key expressions.
Expand Down
4 changes: 2 additions & 2 deletions commons/zenoh-keyexpr/src/keyexpr_tree/arc_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ impl<
/// # Type inference papercut
/// Despite some of `KeArcTree`'s generic parameters having default values, those are only taken into
/// account by the compiler when a type is named with some parameters omitted, and not when a type is
/// infered with the same parameters unconstrained.
/// inferred with the same parameters unconstrained.
///
/// The simplest way to resolve this is to eventually assign to tree part of the return value
/// to a variable or field whose type is named `KeArcTree<_>` (the `Weight` parameter can generally be infered).
/// to a variable or field whose type is named `KeArcTree<_>` (the `Weight` parameter can generally be inferred).
pub fn new() -> Result<(Self, DefaultToken), <DefaultToken as TokenTrait>::ConstructionError> {
let token = DefaultToken::new()?;
Ok((Self::with_token(&token), token))
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-keyexpr/src/keyexpr_tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
//! KeTrees were designed to maximize code reuse. As such, their core properties are reflected through the [`IKeyExprTree`] and [`IKeyExprTreeMut`] traits.
//!
//! KeTrees are made up of node, where nodes may or may not have a value (called `weight`) associated with them. To access these weighs, as well as other
//! properties of a node, you can go throught the [`IKeyExprTreeNode`] and [`IKeyExprTreeNodeMut`] traits.
//! properties of a node, you can go through the [`IKeyExprTreeNode`] and [`IKeyExprTreeNodeMut`] traits.
//!
//! # Iterators
//! KeTrees provide iterators for the following operations:
Expand Down
2 changes: 1 addition & 1 deletion commons/zenoh-keyexpr/src/keyexpr_tree/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ pub trait IKeyExprTreeMut<'a, Weight>: IKeyExprTree<'a, Weight> {
self.prune_where(|node| node.weight().is_none())
}
}
/// The basic operations of a KeTree when a Token is necessary to acess data.
/// The basic operations of a KeTree when a Token is necessary to access data.
pub trait ITokenKeyExprTree<'a, Weight, Token> {
/// An immutable guard to a node of the tree.
type Node: IKeyExprTreeNode<Weight>;
Expand Down
Loading