Skip to content

Commit 9e922db

Browse files
DavidLiedleclaude
andcommitted
chore: Code quality improvements and CI setup for v1.0.1
- Remove unused imports from test modules (7 files) - Replace unwrap() with documented expect() in production code - Add CI workflow with check, test, fmt, clippy, docs, and MSRV jobs - Add CI/crates.io/docs.rs/license/MSRV badges to README - Complete Cargo.toml metadata (rust-version, homepage, documentation, readme, exclude) - Bump version to 1.0.1 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 93f8334 commit 9e922db

15 files changed

Lines changed: 106 additions & 34 deletions

File tree

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUST_BACKTRACE: 1
12+
13+
jobs:
14+
check:
15+
name: Check
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: dtolnay/rust-toolchain@stable
20+
- uses: Swatinem/rust-cache@v2
21+
- run: cargo check --all-features
22+
23+
test:
24+
name: Test
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
matrix:
28+
os: [ubuntu-latest, macos-latest]
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: dtolnay/rust-toolchain@stable
32+
- uses: Swatinem/rust-cache@v2
33+
- name: Run tests
34+
run: cargo test --all-features
35+
36+
fmt:
37+
name: Rustfmt
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
- uses: dtolnay/rust-toolchain@stable
42+
with:
43+
components: rustfmt
44+
- run: cargo fmt --all -- --check
45+
46+
clippy:
47+
name: Clippy
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v4
51+
- uses: dtolnay/rust-toolchain@stable
52+
with:
53+
components: clippy
54+
- uses: Swatinem/rust-cache@v2
55+
- run: cargo clippy --all-features -- -D warnings
56+
57+
docs:
58+
name: Docs
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v4
62+
- uses: dtolnay/rust-toolchain@stable
63+
- uses: Swatinem/rust-cache@v2
64+
- run: cargo doc --no-deps --all-features
65+
env:
66+
RUSTDOCFLAGS: -D warnings
67+
68+
msrv:
69+
name: MSRV (1.70)
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v4
73+
- uses: dtolnay/rust-toolchain@1.70
74+
- uses: Swatinem/rust-cache@v2
75+
- run: cargo check

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
[package]
22
name = "ferrix"
3-
version = "1.0.0"
3+
version = "1.0.1"
44
edition = "2021"
5+
rust-version = "1.70"
56
authors = ["David Liedle", "Claude <noreply@anthropic.com>"]
67
description = "A modern terminal multiplexer built with Rust, inspired by tmux and GNU Screen"
78
license = "MIT OR Apache-2.0"
89
repository = "https://github.com/davidliedle/Ferrix"
10+
homepage = "https://github.com/davidliedle/Ferrix"
11+
documentation = "https://docs.rs/ferrix"
12+
readme = "README.md"
913
keywords = ["terminal", "multiplexer", "tmux", "screen", "tui"]
1014
categories = ["command-line-utilities"]
15+
exclude = [".github/", "docs/internal/", "*.md", "!README.md"]
1116

1217
[dependencies]
1318
# Async runtime

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
╚═══════════════════════════════════════════╝
1616
```
1717

18+
[![CI](https://github.com/davidliedle/Ferrix/actions/workflows/ci.yml/badge.svg)](https://github.com/davidliedle/Ferrix/actions/workflows/ci.yml)
19+
[![Crates.io](https://img.shields.io/crates/v/ferrix.svg)](https://crates.io/crates/ferrix)
20+
[![Documentation](https://docs.rs/ferrix/badge.svg)](https://docs.rs/ferrix)
21+
[![License](https://img.shields.io/crates/l/ferrix.svg)](https://github.com/davidliedle/Ferrix#license)
22+
[![MSRV](https://img.shields.io/badge/MSRV-1.70-blue.svg)](https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html)
23+
1824
**A modern take on terminal multiplexing inspired by [GNU Screen and Tmux](https://github.com/cloudstreet-dev/GNU-Screen-vs-Tmux)**
1925

2026
</div>

src/crash/analysis.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ impl CrashAnalyzer {
108108
.into_iter()
109109
.filter(|(_, reports)| reports.len() > 1) // Only patterns with multiple occurrences
110110
.map(|(location, reports)| {
111-
let first_seen = reports.iter().map(|r| r.metadata.timestamp).min().unwrap();
112-
let last_seen = reports.iter().map(|r| r.metadata.timestamp).max().unwrap();
111+
let first_seen = reports.iter().map(|r| r.metadata.timestamp).min().expect("filtered for len > 1");
112+
let last_seen = reports.iter().map(|r| r.metadata.timestamp).max().expect("filtered for len > 1");
113113

114114
CrashPattern {
115115
id: format!("location-{}", md5::compute(location.as_bytes()).0.iter().take(8).map(|b| format!("{:02x}", b)).collect::<String>()),
@@ -137,8 +137,8 @@ impl CrashAnalyzer {
137137
.into_iter()
138138
.filter(|(_, reports)| reports.len() > 1)
139139
.map(|(message, reports)| {
140-
let first_seen = reports.iter().map(|r| r.metadata.timestamp).min().unwrap();
141-
let last_seen = reports.iter().map(|r| r.metadata.timestamp).max().unwrap();
140+
let first_seen = reports.iter().map(|r| r.metadata.timestamp).min().expect("filtered for len > 1");
141+
let last_seen = reports.iter().map(|r| r.metadata.timestamp).max().expect("filtered for len > 1");
142142

143143
CrashPattern {
144144
id: format!("message-{}", md5::compute(message.as_bytes()).0.iter().take(8).map(|b| format!("{:02x}", b)).collect::<String>()),
@@ -170,8 +170,8 @@ impl CrashAnalyzer {
170170
.collect();
171171

172172
if memory_crashes.len() > 1 {
173-
let first_seen = memory_crashes.iter().map(|r| r.metadata.timestamp).min().unwrap();
174-
let last_seen = memory_crashes.iter().map(|r| r.metadata.timestamp).max().unwrap();
173+
let first_seen = memory_crashes.iter().map(|r| r.metadata.timestamp).min().expect("len > 1 checked");
174+
let last_seen = memory_crashes.iter().map(|r| r.metadata.timestamp).max().expect("len > 1 checked");
175175

176176
vec![CrashPattern {
177177
id: "memory-related".to_string(),
@@ -204,8 +204,8 @@ impl CrashAnalyzer {
204204
.collect();
205205

206206
if pty_crashes.len() > 1 {
207-
let first_seen = pty_crashes.iter().map(|r| r.metadata.timestamp).min().unwrap();
208-
let last_seen = pty_crashes.iter().map(|r| r.metadata.timestamp).max().unwrap();
207+
let first_seen = pty_crashes.iter().map(|r| r.metadata.timestamp).min().expect("len > 1 checked");
208+
let last_seen = pty_crashes.iter().map(|r| r.metadata.timestamp).max().expect("len > 1 checked");
209209

210210
vec![CrashPattern {
211211
id: "pty-related".to_string(),
@@ -238,8 +238,8 @@ impl CrashAnalyzer {
238238
.collect();
239239

240240
if protocol_crashes.len() > 1 {
241-
let first_seen = protocol_crashes.iter().map(|r| r.metadata.timestamp).min().unwrap();
242-
let last_seen = protocol_crashes.iter().map(|r| r.metadata.timestamp).max().unwrap();
241+
let first_seen = protocol_crashes.iter().map(|r| r.metadata.timestamp).min().expect("len > 1 checked");
242+
let last_seen = protocol_crashes.iter().map(|r| r.metadata.timestamp).max().expect("len > 1 checked");
243243

244244
vec![CrashPattern {
245245
id: "protocol-related".to_string(),

src/handlers/activity.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ pub async fn handle_set(
5353

5454
#[cfg(test)]
5555
mod tests {
56-
use super::*;
57-
5856
#[test]
5957
fn test_activity_handlers_exist() {
6058
// Verify all handlers compile

src/handlers/autosave.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ pub async fn handle_status(socket_path: PathBuf, session: Option<String>) -> Res
104104

105105
#[cfg(test)]
106106
mod tests {
107-
use super::*;
108-
109107
#[test]
110108
fn test_autosave_handlers_exist() {
111109
// Verify all handlers compile

src/handlers/misc.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ pub async fn handle_send_keys(socket_path: PathBuf, target: String, keys: Vec<St
4747

4848
#[cfg(test)]
4949
mod tests {
50-
use super::*;
51-
5250
#[test]
5351
fn test_misc_handlers_exist() {
5452
// Verify all handlers compile

src/handlers/pane.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@ pub async fn handle_resize(socket_path: PathBuf, direction: String, amount: u16)
199199

200200
#[cfg(test)]
201201
mod tests {
202-
use super::*;
203-
204202
#[test]
205203
fn test_pane_handlers_exist() {
206204
// Verify all handlers compile

src/handlers/session_state.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ pub async fn handle_set_lock(socket_path: PathBuf, locked: bool) -> Result<()> {
4444

4545
#[cfg(test)]
4646
mod tests {
47-
use super::*;
48-
4947
#[test]
5048
fn test_session_state_handlers_exist() {
5149
// Verify all handlers compile

src/handlers/snapshot.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ pub fn handle_import(archive: String) -> Result<()> {
139139

140140
#[cfg(test)]
141141
mod tests {
142-
use super::*;
143-
144142
#[test]
145143
fn test_snapshot_handlers_exist() {
146144
// Verify all handlers compile

0 commit comments

Comments
 (0)