From 23ac9a9533a4f4dc6ff6746866e48536de536138 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 21 May 2025 10:52:50 -0400 Subject: [PATCH] Add formatting and linting checks to CI --- .github/workflows/ci.yml | 6 ++++++ bench/dirty-vs-full.sh | 0 cli-bin/src/cli/watch.rs | 2 +- cli-bin/tests/test.md | 2 +- docs/adr/DP-001_schema_v1.1.md | 2 +- docs/marlin_demo.md | 2 +- docs/vision.md | 2 +- libmarlin/src/backup.rs | 2 +- libmarlin/src/db/migrations/0001_initial_schema.sql | 2 +- libmarlin/src/error.rs | 2 +- libmarlin/src/lib.rs | 2 +- libmarlin/src/watcher.rs | 9 +++++---- libmarlin/src/watcher_tests.rs | 2 +- 13 files changed, 21 insertions(+), 14 deletions(-) mode change 100644 => 100755 bench/dirty-vs-full.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c12911..fabf027 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,12 @@ jobs: sudo apt-get update sudo apt-get install -y hyperfine jq bc # For benchmarks within run_all_tests.sh + - name: Check formatting + run: cargo fmt -- --check + + - name: Lint with Clippy + run: cargo clippy -- -D warnings + - name: Ensure run_all_tests.sh is executable run: chmod +x ./run_all_tests.sh diff --git a/bench/dirty-vs-full.sh b/bench/dirty-vs-full.sh old mode 100644 new mode 100755 diff --git a/cli-bin/src/cli/watch.rs b/cli-bin/src/cli/watch.rs index a1e8314..338f6b5 100644 --- a/cli-bin/src/cli/watch.rs +++ b/cli-bin/src/cli/watch.rs @@ -114,4 +114,4 @@ pub fn run(cmd: &WatchCmd, _conn: &mut Connection, _format: super::Format) -> Re Ok(()) } } -} \ No newline at end of file +} diff --git a/cli-bin/tests/test.md b/cli-bin/tests/test.md index 437b7e8..87488c5 100644 --- a/cli-bin/tests/test.md +++ b/cli-bin/tests/test.md @@ -75,4 +75,4 @@ to see test coverage run: ```bash cargo tarpaulin --out Html -``` \ No newline at end of file +``` diff --git a/docs/adr/DP-001_schema_v1.1.md b/docs/adr/DP-001_schema_v1.1.md index c7c6e19..37a46cf 100644 --- a/docs/adr/DP-001_schema_v1.1.md +++ b/docs/adr/DP-001_schema_v1.1.md @@ -190,4 +190,4 @@ $ marlin view exec tasks --- -*End of DP-001* \ No newline at end of file +*End of DP-001* diff --git a/docs/marlin_demo.md b/docs/marlin_demo.md index c46d524..0a85d0f 100644 --- a/docs/marlin_demo.md +++ b/docs/marlin_demo.md @@ -182,4 +182,4 @@ marlin view exec tasks Happy organising! -``` \ No newline at end of file +``` diff --git a/docs/vision.md b/docs/vision.md index a1165ff..15de40f 100644 --- a/docs/vision.md +++ b/docs/vision.md @@ -183,4 +183,4 @@ Benchmarks run nightly; regressions block merge. * **Buffer** +10 % (3 weeks) for holidays & unknowns → **33 weeks** (\~8 months). * **Rough budget** (3 FTE avg × 33 wks × \$150 k/yr) ≈ **\$285 k** payroll + \$15 k ops / tooling. ---- \ No newline at end of file +--- diff --git a/libmarlin/src/backup.rs b/libmarlin/src/backup.rs index ce5228b..3fce5ab 100644 --- a/libmarlin/src/backup.rs +++ b/libmarlin/src/backup.rs @@ -496,4 +496,4 @@ mod tests { assert_eq!(info.id, "backup_badformat.db"); assert_eq!(info.timestamp, expected_ts); } -} \ No newline at end of file +} diff --git a/libmarlin/src/db/migrations/0001_initial_schema.sql b/libmarlin/src/db/migrations/0001_initial_schema.sql index 251a616..b3b3dd8 100644 --- a/libmarlin/src/db/migrations/0001_initial_schema.sql +++ b/libmarlin/src/db/migrations/0001_initial_schema.sql @@ -188,4 +188,4 @@ CREATE INDEX IF NOT EXISTS idx_files_path ON files(path); CREATE INDEX IF NOT EXISTS idx_files_hash ON files(hash); CREATE INDEX IF NOT EXISTS idx_tags_name_parent ON tags(name, parent_id); CREATE INDEX IF NOT EXISTS idx_file_tags_tag_id ON file_tags(tag_id); -CREATE INDEX IF NOT EXISTS idx_attr_file_key ON attributes(file_id, key); \ No newline at end of file +CREATE INDEX IF NOT EXISTS idx_attr_file_key ON attributes(file_id, key); diff --git a/libmarlin/src/error.rs b/libmarlin/src/error.rs index 8aa672a..50f3ece 100644 --- a/libmarlin/src/error.rs +++ b/libmarlin/src/error.rs @@ -154,4 +154,4 @@ mod tests { // Verify the source exists assert!(db_err_no_msg.source().is_some()); } -} \ No newline at end of file +} diff --git a/libmarlin/src/lib.rs b/libmarlin/src/lib.rs index 89d0e0a..7bd52c3 100644 --- a/libmarlin/src/lib.rs +++ b/libmarlin/src/lib.rs @@ -204,4 +204,4 @@ impl Marlin { Ok(owned_w) // Return the owned FileWatcher } -} \ No newline at end of file +} diff --git a/libmarlin/src/watcher.rs b/libmarlin/src/watcher.rs index 68e92a7..797c93c 100644 --- a/libmarlin/src/watcher.rs +++ b/libmarlin/src/watcher.rs @@ -16,6 +16,7 @@ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::{Arc, Mutex}; use std::thread::{self, JoinHandle}; use std::time::{Duration, Instant}; +use tracing::info; /// Configuration for the file watcher #[derive(Debug, Clone)] @@ -430,7 +431,7 @@ impl FileWatcher { if let Some(db_mutex) = &*db_guard_option { if let Ok(mut _db_instance_guard) = db_mutex.lock() { for event_item in &evts_to_process { - println!( + info!( "Processing event (DB available): {:?} for path {:?}", event_item.kind, event_item.path ); @@ -440,7 +441,7 @@ impl FileWatcher { } } else { for event_item in &evts_to_process { - println!( + info!( "Processing event (no DB): {:?} for path {:?}", event_item.kind, event_item.path ); @@ -454,7 +455,7 @@ impl FileWatcher { let final_evts = debouncer.flush(); events_processed_clone.fetch_add(final_evts.len(), Ordering::SeqCst); for processed_event in final_evts { - println!( + info!( "Processing final event: {:?} for path {:?}", processed_event.kind, processed_event.path ); @@ -710,4 +711,4 @@ mod file_watcher_state_tests { assert!(watcher.stop().is_err()); assert!(watcher.status().is_err()); } -} \ No newline at end of file +} diff --git a/libmarlin/src/watcher_tests.rs b/libmarlin/src/watcher_tests.rs index 2d126c2..edd6271 100644 --- a/libmarlin/src/watcher_tests.rs +++ b/libmarlin/src/watcher_tests.rs @@ -109,4 +109,4 @@ mod tests { assert!(backups_actual_dir.join(&kept_info.id).exists(), "Kept backup file {} should exist", kept_info.id); } } -} \ No newline at end of file +}