Added pre-commit and pre-push hooks with the help of cargo-husky. This also means that I need to temporarily allow specific bits of dead code until I implement support for at least one more Servarr

This commit is contained in:
2023-08-08 10:50:05 -06:00
parent 74502f5462
commit d5117fda39
8 changed files with 59 additions and 4 deletions
+11
View File
@@ -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
+11
View File
@@ -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
+1
View File
@@ -1,3 +1,4 @@
/target
/.idea/
Cargo.lock
/.scannerwork/
+16 -1
View File
@@ -3,6 +3,11 @@ name = "managarr"
version = "0.1.11"
authors = ["Alex Clarke <alex.j.tusa@gmail.com>"]
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"
[[bin]]
bench = false
path = "src/main.rs"
name = "managarr"
[profile.release]
lto = true
codegen-units = 1
+3 -2
View File
@@ -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
+3 -1
View File
@@ -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();
+10
View File
@@ -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 = "⠀⠀⠀⠀⢀⣠⣠⣤⣄⣄⠀⠀⠀⠀⠀
⠀⠀⢠⠚⢫⣷⣷⣷⣷⣯⠟⠒⡄⠀⠀
⠀⢰⣗⣤⣜⢿⣿⢿⣿⢟⣥⣤⡻⡄⠀
+4
View File
@@ -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<ActiveRadarrBlock>),
@@ -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]