Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 3323090

Browse files
author
FreeSynergy
committed
feat: add deny macros, clippy fixes, tests, and package.toml to all apps
- All lib.rs / main.rs: #![deny(clippy::all, clippy::pedantic, warnings)] - Clippy fixes: wildcard arms → explicit variants (bots, managers), match_same_arms, Map::default(), unused_async allow, redundant clone removed - Tests: fs-bots (9), fs-lenses (6), fs-tasks (9) - package.toml for every app crate
1 parent facd075 commit 3323090

37 files changed

Lines changed: 1324 additions & 103 deletions

Cargo.lock

Lines changed: 853 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/fs-ai/package.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "fs-ai"
3+
version = "0.1.0"
4+
type = "program"
5+
description = "FreeSynergy AI assistant — local LLM chat and model management"
6+
7+
[capabilities]
8+
provides = ["ai.assistant.ui"]
9+
requires = ["llm.provider"]

crates/fs-ai/src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#![deny(clippy::all, clippy::pedantic, warnings)]
2+
#![allow(clippy::must_use_candidate)]
3+
#![allow(clippy::missing_errors_doc)]
4+
#![allow(clippy::doc_markdown)]
5+
#![allow(clippy::ignored_unit_patterns)]
6+
#![allow(clippy::needless_pass_by_value)]
7+
#![allow(clippy::return_self_not_must_use)]
8+
#![allow(clippy::struct_excessive_bools)]
19
pub mod app;
210

311
pub use app::AiManagerApp;
@@ -11,7 +19,7 @@ const I18N_SNIPPETS: &[(&str, &str)] = &[
1119
pub struct I18nPlugin;
1220

1321
impl fs_i18n::SnippetPlugin for I18nPlugin {
14-
fn name(&self) -> &str {
22+
fn name(&self) -> &'static str {
1523
"fs-ai"
1624
}
1725
fn snippets(&self) -> &[(&str, &str)] {

crates/fs-bots/package.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "fs-bots"
3+
version = "0.1.0"
4+
type = "program"
5+
description = "FreeSynergy bot manager — configure bots and connect them to messengers"
6+
7+
[capabilities]
8+
provides = ["bots.ui"]
9+
requires = ["channel.adapter"]

crates/fs-bots/src/accounts_view.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn AccountsView() -> Element {
6565
onclick: move |_| {
6666
form_platform.set(Platform::Telegram);
6767
form_label.set(String::new());
68-
form_creds.set(vec!["".to_string(); Platform::Telegram.credential_fields().len()]);
68+
form_creds.set(vec![String::new(); Platform::Telegram.credential_fields().len()]);
6969
show_form.set(true);
7070
},
7171
"+ Add Account"
@@ -99,7 +99,7 @@ pub fn AccountsView() -> Element {
9999
let p = Platform::from_protocol_str(&e.value());
100100
let field_count = p.credential_fields().len();
101101
form_platform.set(p);
102-
form_creds.set(vec!["".to_string(); field_count]);
102+
form_creds.set(vec![String::new(); field_count]);
103103
},
104104
for p in Platform::all() {
105105
option {

crates/fs-bots/src/bot_strategy.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ impl BotStrategy for BroadcastStrategy {
5656
}
5757
Ok(())
5858
}
59-
_ => Err("Action not supported by BroadcastStrategy".into()),
59+
BotAction::ResolveApproval { .. } => {
60+
Err("Action not supported by BroadcastStrategy".into())
61+
}
6062
}
6163
}
6264
}
@@ -83,7 +85,9 @@ impl BotStrategy for GatekeeperStrategy {
8385
bot.resolve_approval(&id, approval_action);
8486
Ok(())
8587
}
86-
_ => Err("Action not supported by GatekeeperStrategy".into()),
88+
BotAction::SendBroadcast { .. } => {
89+
Err("Action not supported by GatekeeperStrategy".into())
90+
}
8791
}
8892
}
8993
}
@@ -109,7 +113,7 @@ impl BotKind {
109113
match self {
110114
Self::Broadcast => Box::new(BroadcastStrategy),
111115
Self::Gatekeeper => Box::new(GatekeeperStrategy),
112-
_ => Box::new(DefaultStrategy),
116+
Self::Monitor | Self::Digest | Self::UserBot => Box::new(DefaultStrategy),
113117
}
114118
}
115119
}

crates/fs-bots/src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#![deny(clippy::all, clippy::pedantic, warnings)]
2+
#![allow(clippy::must_use_candidate)]
3+
#![allow(clippy::missing_errors_doc)]
4+
#![allow(clippy::doc_markdown)]
5+
#![allow(clippy::ignored_unit_patterns)]
6+
#![allow(clippy::needless_pass_by_value)]
7+
#![allow(clippy::return_self_not_must_use)]
8+
#![allow(clippy::struct_excessive_bools)]
19
pub mod app;
210
pub mod bot_strategy;
311
pub mod components;
@@ -21,7 +29,7 @@ const I18N_SNIPPETS: &[(&str, &str)] = &[
2129
pub struct I18nPlugin;
2230

2331
impl fs_i18n::SnippetPlugin for I18nPlugin {
24-
fn name(&self) -> &str {
32+
fn name(&self) -> &'static str {
2533
"fs-bots"
2634
}
2735
fn snippets(&self) -> &[(&str, &str)] {

crates/fs-bots/tests/bot_test.rs

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
use fs_bots::{
2+
bot_strategy::BotAction,
3+
model::{ApprovalAction, BotKind, ChannelTarget, MessagingBot, Platform},
4+
};
5+
6+
fn make_bot(kind: BotKind) -> MessagingBot {
7+
MessagingBot {
8+
id: "test".into(),
9+
name: "Test Bot".into(),
10+
kind,
11+
enabled: true,
12+
targets: vec![],
13+
recent_broadcasts: vec![],
14+
pending_approvals: vec![],
15+
}
16+
}
17+
18+
fn enabled_target() -> ChannelTarget {
19+
ChannelTarget {
20+
platform: "telegram".into(),
21+
name: "@test".into(),
22+
id: "t1".into(),
23+
enabled: true,
24+
}
25+
}
26+
27+
#[test]
28+
fn bot_kind_label_broadcast() {
29+
assert_eq!(BotKind::Broadcast.label(), "Broadcast");
30+
}
31+
32+
#[test]
33+
fn bot_kind_label_gatekeeper() {
34+
assert_eq!(BotKind::Gatekeeper.label(), "Gatekeeper");
35+
}
36+
37+
#[test]
38+
fn bot_kind_label_monitor() {
39+
assert_eq!(BotKind::Monitor.label(), "Monitor");
40+
}
41+
42+
#[test]
43+
fn platform_all_has_seven_entries() {
44+
assert_eq!(Platform::all().len(), 7);
45+
}
46+
47+
#[test]
48+
fn platform_telegram_label() {
49+
assert_eq!(Platform::Telegram.label(), "Telegram");
50+
}
51+
52+
#[test]
53+
fn platform_matrix_label() {
54+
assert_eq!(Platform::Matrix.label(), "Matrix");
55+
}
56+
57+
#[test]
58+
fn platform_credential_fields_telegram_nonempty() {
59+
assert!(!Platform::Telegram.credential_fields().is_empty());
60+
}
61+
62+
#[test]
63+
fn broadcast_strategy_rejects_resolve_approval() {
64+
let mut bot = make_bot(BotKind::Broadcast);
65+
let strategy = BotKind::Broadcast.strategy();
66+
let result = strategy.apply(
67+
&mut bot,
68+
BotAction::ResolveApproval {
69+
id: "x".into(),
70+
action: ApprovalAction::Allow,
71+
},
72+
);
73+
assert!(result.is_err());
74+
}
75+
76+
#[test]
77+
fn gatekeeper_strategy_rejects_send_broadcast() {
78+
let mut bot = make_bot(BotKind::Gatekeeper);
79+
bot.targets.push(enabled_target());
80+
let strategy = BotKind::Gatekeeper.strategy();
81+
let result = strategy.apply(
82+
&mut bot,
83+
BotAction::SendBroadcast {
84+
message: "hello".into(),
85+
target_count: 1,
86+
},
87+
);
88+
assert!(result.is_err());
89+
}

crates/fs-builder/package.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "fs-builder"
3+
version = "0.1.0"
4+
type = "program"
5+
description = "FreeSynergy builder — analyze, validate, build, and publish packages"
6+
7+
[capabilities]
8+
provides = ["builder.ui", "builder.pipeline"]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "fs-container-app"
3+
version = "0.1.0"
4+
type = "program"
5+
description = "FreeSynergy container manager — install, start, stop, and inspect containers"
6+
7+
[capabilities]
8+
provides = ["container.ui"]
9+
requires = ["container.engine"]

0 commit comments

Comments
 (0)