Skip to content

Commit

Permalink
chore: add cspell checking and make pass (#244)
Browse files Browse the repository at this point in the history
* chore: add cspell checking and make pass

* chore(shorebird_code_push): minor improvements to example (#242)

* chore(shorebird_code_push): v2.0.2 (#243)

* chore: fix cspell

---------

Co-authored-by: Felix Angelov <[email protected]>
  • Loading branch information
eseidel and felangel authored Nov 20, 2024
1 parent 7b12411 commit 6298d37
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 27 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ jobs:
name: ✅ Semantic Pull Request
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1

cspell:
name: 🔤 Check Spelling
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/spell_check.yml@v1
with:
config: cspell.config.yaml

changes:
runs-on: ubuntu-latest

Expand Down
67 changes: 65 additions & 2 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,70 @@
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
version: '0.2'
ignorePaths: ['build', '**/*.g.dart']
ignorePaths:
- target
- build
- '**/*.g.dart'
# Flutter platform directories with per-platform build files
- windows
- macos
- linux
- ios
- android
words:
- subosito
- aarch
- androideabi
- apks
- armeabi
- armv7
- autogen
- bidiff
- bipatch
- bootable
- buildroot
- bundletool
- carryforward
- cbindgen
- cdylib
- classpath
- comde
- compatch
- Condvar
- datadir
- declspec
- Decompressor
- dllexport
- dlopen
- endtemplate
- eseidel
- ffigen
- gclient
- hdpi
- ifdef
- libapp
- libc
- libflutter
- libupdater
- logcat
- mockall
- mocktail
- oslog
- pubspec
- repr
- reqwest
- rollouts
- rustls
- rustup
- serde
- shorebirdtech
- sigstore
- staticlib
- subosito
- unbootable
- Verdana
- vmcode
- withf
- xlink
- zstandard
- zstd
- xcodeproj
- pbxproj
2 changes: 1 addition & 1 deletion library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ This state machine tracks the process of checking for new patches. It is managed
by the code in `updater.rs` and does not have any on-disk state. It has the
following states:

1. Ready - Ready to check for udpates.
1. Ready - Ready to check for updates.
2. Send queued events (e.g., report that a patch succeeded or failed to boot)
a. Move to checking once events, if any, have been reported.
3. Checking for new patches - A PatchCheckRequest is issued but not completed.
Expand Down
1 change: 1 addition & 0 deletions library/src/android.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// cspell:ignore rpkDZSLBRv2jWcc1gQpwdg
use anyhow::Context;
use std::fs;
use std::io::{Cursor, Read};
Expand Down
14 changes: 7 additions & 7 deletions library/src/c_api/c_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ struct CFile {
}

#[derive(Clone, Debug)]
pub struct CFileProvder {
pub struct CFileProvider {
pub file_callbacks: FileCallbacks,
}

impl ExternalFileProvider for CFileProvder {
impl ExternalFileProvider for CFileProvider {
fn open(&self) -> anyhow::Result<Box<dyn ReadSeek>> {
let handle = (self.file_callbacks.open)();
if handle.is_null() {
Expand Down Expand Up @@ -139,7 +139,7 @@ mod test {
fn test_open() {
reset_tests();

let file_provider = CFileProvder {
let file_provider = CFileProvider {
file_callbacks: FileCallbacks::new(),
};
let handle = file_provider.open().unwrap();
Expand All @@ -158,7 +158,7 @@ mod test {
OPEN_RET = std::ptr::null_mut();
}

let file_provider = CFileProvder {
let file_provider = CFileProvider {
file_callbacks: FileCallbacks::new(),
};
let result = file_provider.open();
Expand All @@ -170,7 +170,7 @@ mod test {
fn test_read() {
reset_tests();

let file_provider = CFileProvder {
let file_provider = CFileProvider {
file_callbacks: FileCallbacks::new(),
};
let mut handle = file_provider.open().unwrap();
Expand All @@ -187,7 +187,7 @@ mod test {
fn test_seek() {
reset_tests();

let file_provider = CFileProvder {
let file_provider = CFileProvider {
file_callbacks: FileCallbacks::new(),
};
let mut handle = file_provider.open().unwrap();
Expand Down Expand Up @@ -233,7 +233,7 @@ mod test {
fn test_seek_err() {
reset_tests();

let file_provider = CFileProvder {
let file_provider = CFileProvider {
file_callbacks: FileCallbacks::new(),
};
let mut handle = file_provider.open().unwrap();
Expand Down
4 changes: 2 additions & 2 deletions library/src/c_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::path::PathBuf;

use crate::{updater, UpdateStatus};

use self::c_file::CFileProvder;
use self::c_file::CFileProvider;

mod c_file;

Expand Down Expand Up @@ -162,7 +162,7 @@ pub extern "C" fn shorebird_init(
log_on_error(
|| {
let config = app_config_from_c(c_params)?;
let file_provider = Box::new(CFileProvder {
let file_provider = Box::new(CFileProvider {
file_callbacks: c_file_callbacks,
});
let yaml_string = to_rust(c_yaml)?;
Expand Down
2 changes: 1 addition & 1 deletion library/src/cache/disk_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ mod test {
}

#[test]
fn read_errs_if_file_doesnt_exist() {
fn read_errs_if_file_does_not_exist() {
assert!(super::read::<TestStruct, _>(&Path::new("nonexistent.json")).is_err());
}

Expand Down
13 changes: 7 additions & 6 deletions library/src/cache/patch_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,14 @@ struct PatchesState {

/// Abstracts the storage of patches on disk.
///
/// The impementation of this (PatchManager) should only be responsible for translating what is on
/// disk into a form that is useful for the updater and vice versa. Some business logic has crept in
/// in the form of validation, and we should consider moving that into a separate module.
/// The implementation of this (PatchManager) should only be responsible for
/// translating what is on disk into a form that is useful for the updater and
/// vice versa. Some business logic has crept in in the form of validation, and
/// we should consider moving that into a separate module.
#[cfg_attr(test, automock)]
pub trait ManagePatches {
/// Copies the patch file at file_path to the manager's directory structure sets
/// this patch as the next patch to boot.
/// Copies the patch file at file_path to the manager's directory structure
/// sets this patch as the next patch to boot.
///
/// The explicit lifetime is required for automock to work with Options.
/// See https://github.com/asomers/mockall/issues/61.
Expand Down Expand Up @@ -952,7 +953,7 @@ mod fall_back_tests {
manager.record_boot_start_for_patch(1)?;
manager.record_boot_success()?;
let patch_1_path = manager.patch_artifact_path(1);
std::fs::write(patch_1_path, "junkjunkjunk")?;
std::fs::write(patch_1_path, "junk junk junk")?;

// Download and fall back from patch 2
manager.add_patch_for_test(&temp_dir, 2)?;
Expand Down
1 change: 1 addition & 0 deletions library/src/cache/signing.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// cspell:ignore pubin PKCS outform
use anyhow::{bail, Context, Result};
use base64::Engine;
use std::path::Path;
Expand Down
2 changes: 1 addition & 1 deletion library/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ mod tests {
let result = super::report_event_default(
// Make the request to an incorrectly formatted URL, which will
// trigger the same error as a lack of internet connection.
&patches_events_url("asdfasdf"),
&patches_events_url("does_not_exist"),
super::CreatePatchEventRequest {
event: PatchEvent {
app_id: "app_id".to_string(),
Expand Down
11 changes: 5 additions & 6 deletions library/src/updater_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ fn updater_lock() -> &'static std::sync::Mutex<UpdaterLockState> {

// Note: it is not OK to ever ask for the Updater lock *while* holding the
// UpdateConfig lock because the updater thread *will* block on getting the
// UpdateConfig lock while holding the Updater lock. Allowing the inverse
// could cause a deadlock. We could add a check for that here by doing a
// tryLock on the UpdateConfig lock and erroring out if we can't get it, but
// that would probably have false postives since it is OK for some other call to
// be holding the UpdateConfig lock while another thread asks for the Updater
// lock.
// UpdateConfig lock while holding the Updater lock. Allowing the inverse could
// cause a deadlock. We could add a check for that here by doing a tryLock on
// the UpdateConfig lock and erroring out if we can't get it, but that would
// probably have false positives since it is OK for some other call to be
// holding the UpdateConfig lock while another thread asks for the Updater lock.
pub fn with_updater_thread_lock<F, R>(f: F) -> anyhow::Result<R>
where
F: FnOnce(&UpdaterLockState) -> anyhow::Result<R>,
Expand Down
2 changes: 1 addition & 1 deletion shorebird_code_push/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 2.0.2

- fix: unbreak web platform
- fix: un-break web platform
- chore: minor improvements to example

# 2.0.1
Expand Down

0 comments on commit 6298d37

Please sign in to comment.