diff --git a/.cargo-husky/hooks/pre-commit b/.cargo-husky/hooks/pre-commit new file mode 100755 index 0000000..d2634be --- /dev/null +++ b/.cargo-husky/hooks/pre-commit @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +echo "Running pre-commit hook:" + +echo "Executing: cargo fmt" +cargo fmt + +echo "Executing: cargo clippy --all-targets --workspace -- -D warnings" +find . | grep "\.\/src\/.*\.rs$" | xargs touch ; cargo clippy --all-targets --workspace -- -D warnings diff --git a/.cargo-husky/hooks/pre-push b/.cargo-husky/hooks/pre-push new file mode 100755 index 0000000..3193021 --- /dev/null +++ b/.cargo-husky/hooks/pre-push @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +echo "Running pre-push hook:" + +echo "Executing: cargo clippy --all-targets --workspace -- -D warnings" +find . | grep "\.\/src\/.*\.rs$" | xargs touch ; cargo clippy --all-targets --workspace -- -D warnings + +echo "Executing: cargo test" +cargo test \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5421811..f4169ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target /.idea/ Cargo.lock +/.scannerwork/ diff --git a/Cargo.toml b/Cargo.toml index 546bd80..1031e38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,11 @@ name = "managarr" version = "0.1.11" authors = ["Alex Clarke "] description = "A TUI for managing *arr servers" +keywords = ["managarr", "tui-rs", "dashboard", "servarr"] +documentation = "https://github.com/Dark-Alex-17/managarr" +repository = "https://github.com/Dark-Alex-17/managarr" +homepage = "https://github.com/Dark-Alex-17/managarr" +readme = "README.md" edition = "2021" [dependencies] @@ -27,6 +32,16 @@ tui = "0.19.0" urlencoding = "2.1.2" [dev-dependencies] +cargo-husky = { version = "1.5.0", default_features = false, features = ["user-hooks"] } +mockito = "1.0.0" pretty_assertions = "1.3.0" rstest = "0.17.0" -mockito = "1.0.0" \ No newline at end of file + +[[bin]] +bench = false +path = "src/main.rs" +name = "managarr" + +[profile.release] +lto = true +codegen-units = 1 \ No newline at end of file diff --git a/Makefile b/Makefile index 45d93f7..9548bf3 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ default: run .PHONY: test test-cov build run lint lint-fix fmt analyze sonar release delete-tag + test: @cargo test @@ -10,8 +11,8 @@ test: test-cov: @cargo tarpaulin -build: - @make test && cargo build --release +build: test + @cargo build --release run: @CARGO_INCREMENTAL=1 cargo fmt && make lint && cargo run diff --git a/src/app/mod.rs b/src/app/mod.rs index 5fa50ba..70576cd 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -12,7 +12,7 @@ use crate::models::{HorizontallyScrollableText, Route, TabRoute, TabState}; use crate::network::NetworkEvent; pub(crate) mod key_binding; -pub mod radarr; +pub(crate) mod radarr; const DEFAULT_ROUTE: Route = Route::Radarr(ActiveRadarrBlock::Movies, None); @@ -58,6 +58,8 @@ impl App { self.tick_count = 0; } + // Allowing this code for now since we'll eventually be implementing additional Servarr support and we'll need it then + #[allow(dead_code)] pub fn reset(&mut self) { self.reset_tick_count(); self.error = HorizontallyScrollableText::default(); diff --git a/src/logos.rs b/src/logos.rs index 73e0fcf..d7ae5db 100644 --- a/src/logos.rs +++ b/src/logos.rs @@ -6,6 +6,8 @@ pub const RADARR_LOGO: &str = "⠀⣠⣶⢶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⢿⡇⠀⠀⣀⣤⣶⡿⠛⠉⠀⠀⠀⠀ ⠀⠀⠰⠶⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀ "; +// Allowing this code for now since we'll eventually be implementing additional Servarr support and we'll need it then +#[allow(dead_code)] pub const SONARR_LOGO: &str = "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⢀⣄⠙⠻⠟⠋⣤⠀⠀⠀⠀⠀⠀⠀ @@ -14,6 +16,8 @@ pub const SONARR_LOGO: &str = "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ "; +// Allowing this code for now since we'll eventually be implementing additional Servarr support and we'll need it then +#[allow(dead_code)] pub const BAZARR_LOGO: &str = "⠀⠀⠀⠀⠀⠀⠀⣀⠠⠄⠠⠄⣀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⡠⢊⣀⣀⣀⣀⣀⣀⡑⢄⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠐⢸⣿⣿⣿⣿⣿⣿⣿⣿⡇⠂⠀⠀⠀⠀ @@ -22,6 +26,8 @@ pub const BAZARR_LOGO: &str = "⠀⠀⠀⠀⠀⠀⠀⣀⠠⠄⠠⠄⣀⠀⠀⠀ ⠀⠀⠀⠀⠀⠑⢌⠉⠉⠉⠉⠉⠉⡠⠊⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠉⠒⠂⠐⠒⠉⠀⠀⠀⠀⠀⠀⠀ "; +// Allowing this code for now since we'll eventually be implementing additional Servarr support and we'll need it then +#[allow(dead_code)] pub const READARR_LOGO: &str = "⠀⠀⠀⠀⠀⣀⣠⣤⣄⣀⠀⠀⠀⠀⠀ ⠀⠀⢀⡴⠛⠉⠀⠀⠀⠉⠛⢦⡀⠀⠀ ⠀⢠⣯⣄⣀⣐⠻⣿⠟⣂⣀⣠⣽⡄⠀ @@ -31,6 +37,8 @@ pub const READARR_LOGO: &str = "⠀⠀⠀⠀⠀⣀⣠⣤⣄⣀⠀⠀⠀⠀⠀ ⠀⠀⠈⠳⣬⣙⠻⠿⠟⣋⣥⠞⠁⠀⠀ ⠀⠀⠀⠀⠀⠉⠙⠛⠋⠉⠀⠀⠀⠀⠀ "; +// Allowing this code for now since we'll eventually be implementing additional Servarr support and we'll need it then +#[allow(dead_code)] pub const LIDARR_LOGO: &str = "⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀ ⠀⢠⣾⠟⠋⠀⠀⢀⣀⠀⠙⠻⣷⡄⠀ ⢠⣿⠋⠀⣴⠃⠀⢸⣿⣿⣦⡀⠙⣿⡄ @@ -40,6 +48,8 @@ pub const LIDARR_LOGO: &str = "⠀⠀⠀⣠⣴⣶⡿⠻⣿⣶⣦⣄⠀⠀⠀ ⠀⠘⢿⣦⣄⠀⠉⠁⠀⠀⣠⣴⡿⠃⠀ ⠀⠀⠀⠉⠻⠿⢿⡆⡾⠿⠟⠉⠀⠀⠀ "; +// Allowing this code for now since we'll eventually be implementing additional Servarr support and we'll need it then +#[allow(dead_code)] pub const PROWLARR_LOGO: &str = "⠀⠀⠀⠀⢀⣠⣠⣤⣄⣄⠀⠀⠀⠀⠀ ⠀⠀⢠⠚⢫⣷⣷⣷⣷⣯⠟⠒⡄⠀⠀ ⠀⢰⣗⣤⣜⢿⣿⢿⣿⢟⣥⣤⡻⡄⠀ diff --git a/src/models/mod.rs b/src/models/mod.rs index 6ac72c0..3973f21 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -8,6 +8,8 @@ use crate::app::radarr::ActiveRadarrBlock; pub mod radarr_models; +// Allowing dead code for now since we'll eventually be implementing additional Servarr support and we'll need it then +#[allow(dead_code)] #[derive(Clone, Copy, PartialEq, Eq, Debug)] pub enum Route { Radarr(ActiveRadarrBlock, Option), @@ -238,6 +240,8 @@ impl TabState { TabState { tabs, index: 0 } } + // Allowing this code for now since we'll eventually be implementing additional Servarr support and we'll need it then + #[allow(dead_code)] pub fn set_index(&mut self, index: usize) -> &TabRoute { self.index = index; &self.tabs[self.index]