Skip to content

Commit

Permalink
Add spell checking to CI (#1492)
Browse files Browse the repository at this point in the history
* Add spell checking to CI

* Fix a bunch of typos with `typos -w`

* Manually fix some more typos

* document how to run typos locally

* fix doclink
  • Loading branch information
emilk authored Mar 3, 2023
1 parent b64a438 commit f5d0a63
Show file tree
Hide file tree
Showing 49 changed files with 88 additions and 69 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://github.com/crate-ci/typos
# Add exceptions to _typos.toml

name: Spell Check
on: [pull_request]

jobs:
run:
name: Spell Check
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v2

- name: Check spelling of entire workspace
uses: crate-ci/typos@master
6 changes: 6 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://github.com/crate-ci/typos
# install: cargo install typos-cli
# run: typos

[default.extend-words]
lod = "lod" # level-of-detail
2 changes: 1 addition & 1 deletion ci_docker/publish.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION=0.5 # Bump on each new version. Remember to update the version in the Dockerfile too.

# The build needs to run from top of repo to access the requirments.txt
# The build needs to run from top of repo to access the requirements.txt
cd `git rev-parse --show-toplevel`

# Pull :latest so we have the correct cache
Expand Down
6 changes: 3 additions & 3 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ disallowed-methods = [
"std::env::temp_dir", # Use the tempdir crate instead

# Disabled because of https://github.com/rust-lang/rust-clippy/issues/10406
# "std::time::Instant::now", # use `instant` crate instead for wasm/web compatability
"std::time::Duration::elapsed", # use `instant` crate instead for wasm/web compatability
"std::time::SystemTime::now", # use `instant` or `time` crates instead for wasm/web compatability
# "std::time::Instant::now", # use `instant` crate instead for wasm/web compatibility
"std::time::Duration::elapsed", # use `instant` crate instead for wasm/web compatibility
"std::time::SystemTime::now", # use `instant` or `time` crates instead for wasm/web compatibility

"std::thread::spawn", # Use `std::thread::Builder` and name the thread

Expand Down
2 changes: 1 addition & 1 deletion crates/re_analytics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ uuid = { version = "1.1", features = ["serde", "v4", "js"] }
directories-next = "2"
ureq = { version = "2.6", features = [
"json",
] } # TODO(emilk): use ehttp for web supprt
] } # TODO(emilk): use ehttp for web support

[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { version = "0.3.58", features = ["Storage"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/re_analytics/src/pipeline_native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ fn flush_events(
match serde_json::from_str::<Event>(&event_str) {
Ok(event) => Some(event),
Err(err) => {
// NOTE: This is effectively where we detect posssible half-writes.
// NOTE: This is effectively where we detect possible half-writes.
error!(%err, %analytics_id, %session_id,
"couldn't deserialize event from analytics data file: dropping it");
None
Expand Down
2 changes: 1 addition & 1 deletion crates/re_arrow_store/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,7 @@ pub struct ComponentTable {
/// Component buckets are append-only, they can never be written to in an out of order
/// fashion.
/// As such, a double-ended queue covers all our needs:
/// - poping from the front for garbage collection
/// - popping from the front for garbage collection
/// - pushing to the back for insertions
/// - binary search for queries
pub(crate) buckets: VecDeque<ComponentBucket>,
Expand Down
4 changes: 2 additions & 2 deletions crates/re_arrow_store/src/store_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ impl IndexBucket {
indices,
} = &mut *guard;

// append time to primary index and update time range approriately
// append time to primary index and update time range appropriately
times.push(time.as_i64());
*time_range = TimeRange::new(time_range.min.min(time), time_range.max.max(time));

Expand Down Expand Up @@ -1220,7 +1220,7 @@ impl ComponentBucket {

debug_assert!(
!self.archived,
"achiving an already archived bucket, something is likely wrong"
"archiving an already archived bucket, something is likely wrong"
);

// Chunk compaction
Expand Down
2 changes: 1 addition & 1 deletion crates/re_arrow_store/tests/data_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ fn all_components() {

let components_b = &[
ColorRGBA::name(), // added by us, timeless
Rect2D::name(), // ⚠ inherited before the buckets got splitted apart!
Rect2D::name(), // ⚠ inherited before the buckets got split apart!
Point2D::name(), // added by us
cluster_key, // always here
MsgId::name(), // automatically appended by MsgBundle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Information about the build of a Rust crate.
///
/// Create this with [`crate::build_info`].
/// Create this with [`crate::build_info!`].
///
/// The `git_` fields are all empty on failure. Most likely git fails because we're not in a git repository
/// to begin with, which happens because we've imported the published crate from crates.io.
Expand Down
4 changes: 2 additions & 2 deletions crates/re_build_info/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//!
//! To use this you also need to call `re_build_build_info::export_env_vars()` from your build.rs.
mod buid_info;
mod build_info;
mod crate_version;

pub use buid_info::BuildInfo;
pub use build_info::BuildInfo;
pub use crate_version::CrateVersion;

/// Create a [`BuildInfo`] at compile-time using environment variables exported by
Expand Down
2 changes: 1 addition & 1 deletion crates/re_log_types/src/component_types/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct AnnotationInfo {
/// Keypoints within the class can also be decorated with skeletal edges.
/// Keypoint-connections are pairs of [`KeypointId`]s. If an edge is
/// defined, and both keypoints exist within the instance of the class, then the
/// keypoints shold be connected with an edge. The edge should be labeled and
/// keypoints should be connected with an edge. The edge should be labeled and
/// colored as described by the class's [`AnnotationInfo`].
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
Expand Down
2 changes: 1 addition & 1 deletion crates/re_log_types/src/path/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub enum EntityPathPart {
/// Struct member. Each member can have a different type.
Name(InternedString),

/// Array/table/map member. Each member must be of the same type (homogenous).
/// Array/table/map member. Each member must be of the same type (homogeneous).
Index(Index),
}

Expand Down
4 changes: 2 additions & 2 deletions crates/re_log_types/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Time {
}

/// If true, this time is likely relative to unix epoch.
pub fn is_abolute_date(&self) -> bool {
pub fn is_absolute_date(&self) -> bool {
let nanos_since_epoch = self.nanos_since_epoch();
let years_since_epoch = nanos_since_epoch / 1_000_000_000 / 60 / 60 / 24 / 365;

Expand All @@ -48,7 +48,7 @@ impl Time {
/// Returns the absolute datetime if applicable.
pub fn to_datetime(&self) -> Option<OffsetDateTime> {
let ns_since_epoch = self.nanos_since_epoch();
if self.is_abolute_date() {
if self.is_absolute_date() {
OffsetDateTime::from_unix_timestamp_nanos(ns_since_epoch as i128).ok()
} else {
None
Expand Down
2 changes: 1 addition & 1 deletion crates/re_log_types/src/time_range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl From<&TimeRange> for RangeInclusive<TimeInt> {

// ----------------------------------------------------------------------------

/// Like [`TimeRange`], but using [`TimeReal`] for improved precison.
/// Like [`TimeRange`], but using [`TimeReal`] for improved precision.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct TimeRangeF {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/shader/depth_cloud.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn fs_main(in: VertexOut) -> @location(0) Vec4 {

// Sphere intersection with anti-aliasing as described by Iq here
// https://www.shadertoy.com/view/MsSSWV
// (but rearranged and labled to it's easier to understand!)
// (but rearranged and labeled to it's easier to understand!)
let d = ray_sphere_distance(ray_in_world, in.point_pos_in_world, in.point_radius);
let smallest_distance_to_sphere = d.x;
let closest_ray_dist = d.y;
Expand Down
4 changes: 2 additions & 2 deletions crates/re_renderer/shader/generic_skybox.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ fn skybox_light_srgb(dir: Vec3) -> Vec3 {
@fragment
fn main(in: VertexOutput) -> @location(0) Vec4 {
let camera_dir = camera_ray_direction_from_screenuv(in.texcoord);
// Messing with direction a bit so it looks like in our old three-d based renderer (for easier comparision)
let rgb = skybox_dark_srgb(camera_dir); // TODO(andreas): Allow switchting to skybox_light
// Messing with direction a bit so it looks like in our old three-d based renderer (for easier comparison)
let rgb = skybox_dark_srgb(camera_dir); // TODO(andreas): Allow switching to skybox_light
return Vec4(linear_from_srgb(rgb), 1.0);
//return Vec4(camera_dir, 1.0);
}
2 changes: 1 addition & 1 deletion crates/re_renderer/shader/lines.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const CAP_START_TRIANGLE: u32 = 4u;
const CAP_START_ROUND: u32 = 8u;
const NO_COLOR_GRADIENT: u32 = 16u;

// A lot of the attributes don't need to be interpolated accross triangles.
// A lot of the attributes don't need to be interpolated across triangles.
// To document that and safe some time we mark them up with @interpolate(flat)
// (see https://www.w3.org/TR/WGSL/#interpolation)
struct VertexOut {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/shader/utils/camera.wgsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// TODO(andreas): global_bindings are imported implicitely
// TODO(andreas): global_bindings are imported implicitly

fn inf() -> f32 {
return 1.0 / 0.0;
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/src/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub mod mesh_vertices {
// TODO(andreas): More properties? Different kinds of vertices?
}

/// Vertex buffer layouts describing how vertex data should be layed out.
/// Vertex buffer layouts describing how vertex data should be laid out.
///
/// Needs to be kept in sync with `mesh_vertex.wgsl`.
pub fn vertex_buffer_layouts() -> [VertexBufferLayout; 2] {
Expand Down
4 changes: 2 additions & 2 deletions crates/re_renderer/src/point_cloud_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ where
/// Returns a `PointBuilder` which can be used to set the colors, radii, and user-data for the points.
///
/// Params:
/// - `size_hint`: The `PointBuilder` will pre-allocate buffers to accomodate up to this number of points.
/// - `size_hint`: The `PointBuilder` will pre-allocate buffers to accommodate up to this number of points.
/// The resulting point batch, will still be determined by the length of the iterator.
/// - `positions`: An iterable of the positions of the collection of points
pub fn add_points(
Expand Down Expand Up @@ -242,7 +242,7 @@ where
/// Adds several 2D points. Uses an autogenerated depth value, the same for all points passed.
///
/// Params:
/// - `size_hint`: The `PointBuilder` will pre-allocate buffers to accomodate up to this number of points.
/// - `size_hint`: The `PointBuilder` will pre-allocate buffers to accommodate up to this number of points.
/// The resulting point batch, will be the size of the length of the `positions` iterator.
/// - `positions`: An iterable of the positions of the collection of points
#[inline]
Expand Down
4 changes: 2 additions & 2 deletions crates/re_renderer/src/renderer/lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//!
//! Data is provided in two separate textures, the "position data texture" and the "line strip texture".
//! The "line strip texture" contains packed information over properties that are global to a single strip (see `gpu_data::LineStripInfo`)
//! Data in the "position data texture" is layed out a follows (see `gpu_data::PositionData`):
//! Data in the "position data texture" is laid out a follows (see `gpu_data::PositionData`):
//! ```raw
//! ___________________________________________________________________
//! position data | pos, strip_idx | pos, strip_idx | pos, strip_idx | pos, strip_idx | ...
Expand Down Expand Up @@ -274,7 +274,7 @@ pub enum LineDrawDataError {

// Textures are 2D since 1D textures are very limited in size (8k typically).
// Need to keep these values in sync with lines.wgsl!
const POSITION_TEXTURE_SIZE: u32 = 512; // 512 x 512 x vec4<f32> == 4MiB, 262144 PositionDatas
const POSITION_TEXTURE_SIZE: u32 = 512; // 512 x 512 x vec4<f32> == 4MiB, 262144 PositionData
const LINE_STRIP_TEXTURE_SIZE: u32 = 256; // 256 x 256 x vec2<u32> == 0.5MiB, 65536 line strips

impl LineDrawData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl TextureManager2D {
let bytes_per_row_unaligned = width_blocks * format_info.block_size as u32;

// TODO(andreas): Once we have our own temp buffer for uploading, we can do the padding inplace
// I.e. the only difference will be if we do one memcopy or one memcopy per row, making row padding a nuissance!
// I.e. the only difference will be if we do one memcopy or one memcopy per row, making row padding a nuisance!
let data = creation_desc.data;

// TODO(andreas): temp allocator for staging data?
Expand Down
2 changes: 1 addition & 1 deletion crates/re_sdk/src/msg_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl MsgSender {

// --- Send ---

/// Consumes, packs, sanity checkes and finally sends the message to the currently configured
/// Consumes, packs, sanity checks and finally sends the message to the currently configured
/// target of the SDK.
pub fn send(self, session: &mut Session) -> Result<(), MsgSenderError> {
if !session.is_enabled() {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_ui/data/design_tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"type": "color"
},
"Pressed": {
"description": "Background color for supressed UI elements, like a select that is currently showing a menu",
"description": "Background color for suppressed UI elements, like a select that is currently showing a menu",
"value": "{Global.Color.Grey.250}",
"type": "color"
}
Expand Down
2 changes: 1 addition & 1 deletion crates/re_ui/src/design_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ fn apply_design_tokens(ctx: &egui::Context) -> DesignTokens {

egui_style.debug.show_blocking_widget = false; // turn this on to debug interaction problems

egui_style.spacing.combo_width = 8.0; // minium width of ComboBox - keep them small, with the down-arrow close.
egui_style.spacing.combo_width = 8.0; // minimum width of ComboBox - keep them small, with the down-arrow close.

egui_style.spacing.scroll_bar_inner_margin = 2.0;
egui_style.spacing.scroll_bar_width = 6.0;
Expand Down
4 changes: 2 additions & 2 deletions crates/re_viewer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ fn wait_screen_ui(ui: &mut egui::Ui, rx: &Receiver<LogMsg>) {
ready_and_waiting(ui, "Waiting for logging data from SDK");
}
re_smart_channel::Source::WsClient { ws_server_url } => {
// TODO(emilk): it would be even better to know wether or not we are connected, or are attempting to connect
// TODO(emilk): it would be even better to know whether or not we are connected, or are attempting to connect
ready_and_waiting(ui, &format!("Waiting for data from {ws_server_url}"));
}
re_smart_channel::Source::TcpServer { port } => {
Expand Down Expand Up @@ -1381,7 +1381,7 @@ fn save_buttons_ui(ui: &mut egui::Ui, app: &mut App) {
}

// We need to know the loop selection _before_ we can even display the
// button, as this will determine wether its grayed out or not!
// button, as this will determine whether its grayed out or not!
// TODO(cmc): In practice the loop (green) selection is always there
// at the moment so...
let loop_selection = app.loop_selection();
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/editable_auto_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ where
T: Clone + Default + serde::Serialize,
for<'de2> T: serde::Deserialize<'de2>,
{
/// The user explicitely specified what they wanted
/// The user explicitly specified what they wanted
UserEdited(T),

/// The value is determined automatically.
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/time_panel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ impl TimePanel {
// In the design the shadow starts under the time markers.
//let shadow_y_start =
// timeline_rect.bottom() + ui.visuals().widgets.noninteractive.bg_stroke.width;
// This looks great but only if there are still time markes.
// This looks great but only if there are still time markers.
// When they move to the right (or have a cut) one expects the shadow to go all the way up.
// But that's quite complicated so let's have the shadow all the way
let shadow_y_start = *full_y_range.start();
Expand Down
4 changes: 2 additions & 2 deletions crates/re_viewer/src/ui/time_panel/time_ranges_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,13 @@ impl TimeRangesUi {
value
}

// Make sure playback time doesn't get stuck between non-continuos regions:
// Make sure playback time doesn't get stuck between non-continuous regions:
pub fn snap_time_control(&self, ctx: &mut ViewerContext<'_>) {
if ctx.rec_cfg.time_ctrl.play_state() != PlayState::Playing {
return;
}

// Make sure time doesn't get stuck between non-continuos regions:
// Make sure time doesn't get stuck between non-continuous regions:
if let Some(time) = ctx.rec_cfg.time_ctrl.time() {
let time = self.snap_time_to_segments(time);
ctx.rec_cfg.time_ctrl.set_time(time);
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/view_spatial/eye.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ impl OrbitEye {
let new_radius = self.orbit_radius / factor;

// Don't let radius go too small or too big because this might cause infinity/nan in some calculations.
// Max value is choosen with some generous margin of an observed crash due to infinity.
// Max value is chosen with some generous margin of an observed crash due to infinity.
if f32::MIN_POSITIVE < new_radius && new_radius < 1.0e17 {
self.orbit_radius = new_radius;
}
Expand Down
6 changes: 3 additions & 3 deletions crates/re_viewer/src/ui/view_spatial/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,11 @@ pub fn create_labels(
.anchor_rect(egui::Rect::from_min_size(text_anchor_pos, galley.size()));
let bg_rect = text_rect.expand2(egui::vec2(4.0, 2.0));

let hightlight = highlights
let highlight = highlights
.entity_highlight(label.labeled_instance.entity_path_hash)
.index_highlight(label.labeled_instance.instance_key);
let fill_color = match hightlight.hover {
crate::misc::HoverHighlight::None => match hightlight.selection {
let fill_color = match highlight.hover {
crate::misc::HoverHighlight::None => match highlight.selection {
SelectionHighlight::None => parent_ui.style().visuals.widgets.inactive.bg_fill,
SelectionHighlight::SiblingSelection => {
parent_ui.style().visuals.widgets.active.bg_fill
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/view_time_series/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ impl SceneTimeSeries {
let prev_point = *prev_line.points.last().unwrap();
self.lines.push(prev_line);

// If the previous point was continous and the current point is continuous
// If the previous point was continuous and the current point is continuous
// too, then we want the 2 segments to appear continuous even though they
// are actually split from a data standpoint.
let cur_continuous = matches!(kind, PlotSeriesKind::Continuous);
Expand Down
2 changes: 1 addition & 1 deletion crates/rerun/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ async fn run_impl(
let server_options = re_sdk_comms::ServerOptions {
max_latency_sec: parse_max_latency(args.drop_at_latency.as_ref()),

// `rerun.spawn()` doesn't ned to log that a connection has been made
// `rerun.spawn()` doesn't need to log that a connection has been made
quiet: call_source.is_python(),
};
re_sdk_comms::serve(args.port, server_options)?
Expand Down
Loading

0 comments on commit f5d0a63

Please sign in to comment.