1use std::collections::HashMap;
2
3pub struct I18n {
4 pub lang: String,
5 messages: HashMap<String, HashMap<String, String>>,
6}
7
8impl I18n {
9 pub fn new(lang: &str) -> Self {
10 let normalized_lang = match lang.to_lowercase().replace("_", "-").as_str() {
12 "en" | "en-us" | "english" => "en-US",
13 "zh" | "zh-cn" | "chinese" => "zh-CN",
14 _ => lang,
15 };
16
17 let mut messages = HashMap::new();
18
19 let mut zh_cn = HashMap::new();
21 zh_cn.insert("title".to_string(), "🗑️ 垃圾代码猎人 🗑️".to_string());
22 zh_cn.insert(
23 "preparing".to_string(),
24 "正在准备吐槽你的代码...".to_string(),
25 );
26 zh_cn.insert(
27 "report_title".to_string(),
28 "📊 垃圾代码检测报告".to_string(),
29 );
30 zh_cn.insert(
31 "found_issues".to_string(),
32 "发现了一些需要改进的地方:".to_string(),
33 );
34 zh_cn.insert("statistics".to_string(), "📈 问题统计:".to_string());
35 zh_cn.insert(
36 "nuclear_issues".to_string(),
37 "🔥 核弹级问题 (需要立即修复)".to_string(),
38 );
39 zh_cn.insert(
40 "spicy_issues".to_string(),
41 "🌶️ 辣眼睛问题 (建议修复)".to_string(),
42 );
43 zh_cn.insert(
44 "mild_issues".to_string(),
45 "😐 轻微问题 (可以忽略)".to_string(),
46 );
47 zh_cn.insert("total".to_string(), "📝 总计".to_string());
48 zh_cn.insert("summary".to_string(), "📋 总结".to_string());
49 zh_cn.insert("suggestions".to_string(), "💡 改进建议".to_string());
50 zh_cn.insert(
51 "clean_code".to_string(),
52 "🎉 哇!你的代码居然没有明显的垃圾!".to_string(),
53 );
54 zh_cn.insert(
55 "clean_code_warning".to_string(),
56 "但是别高兴太早,也许你的逻辑有问题我还没检测到 😏".to_string(),
57 );
58 zh_cn.insert(
59 "keep_improving".to_string(),
60 "继续努力,让代码变得更好!🚀".to_string(),
61 );
62 zh_cn.insert("top_files".to_string(), "🏆 问题最多的文件".to_string());
63 zh_cn.insert("detailed_analysis".to_string(), "🔍 详细分析".to_string());
64
65 let mut en_us = HashMap::new();
67 en_us.insert(
68 "title".to_string(),
69 "🗑️ Garbage Code Hunter 🗑️".to_string(),
70 );
71 en_us.insert(
72 "preparing".to_string(),
73 "Preparing to roast your code...".to_string(),
74 );
75 en_us.insert(
76 "report_title".to_string(),
77 "📊 Code Quality Report".to_string(),
78 );
79 en_us.insert(
80 "found_issues".to_string(),
81 "Found some areas for improvement:".to_string(),
82 );
83 en_us.insert("statistics".to_string(), "📈 Issue Statistics:".to_string());
84 en_us.insert(
85 "nuclear_issues".to_string(),
86 "🔥 Nuclear Issues (fix immediately)".to_string(),
87 );
88 en_us.insert(
89 "spicy_issues".to_string(),
90 "🌶️ Spicy Issues (should fix)".to_string(),
91 );
92 en_us.insert(
93 "mild_issues".to_string(),
94 "😐 Mild Issues (can ignore)".to_string(),
95 );
96 en_us.insert("total".to_string(), "📝 Total".to_string());
97 en_us.insert("summary".to_string(), "📋 Summary".to_string());
98 en_us.insert("suggestions".to_string(), "💡 Suggestions".to_string());
99 en_us.insert(
100 "clean_code".to_string(),
101 "🎉 Wow! Your code doesn't have obvious garbage!".to_string(),
102 );
103 en_us.insert(
104 "clean_code_warning".to_string(),
105 "But don't celebrate too early, maybe there are logic issues I haven't detected 😏"
106 .to_string(),
107 );
108 en_us.insert(
109 "keep_improving".to_string(),
110 "Keep working hard to make your code better! 🚀".to_string(),
111 );
112 en_us.insert(
113 "top_files".to_string(),
114 "🏆 Files with Most Issues".to_string(),
115 );
116 en_us.insert(
117 "detailed_analysis".to_string(),
118 "🔍 Detailed Analysis".to_string(),
119 );
120
121 messages.insert("zh-CN".to_string(), zh_cn);
122 messages.insert("en-US".to_string(), en_us);
123
124 Self {
125 lang: normalized_lang.to_string(),
126 messages,
127 }
128 }
129
130 pub fn get(&self, key: &str) -> String {
131 self.messages
132 .get(&self.lang)
133 .and_then(|lang_map| lang_map.get(key))
134 .cloned()
135 .unwrap_or_else(|| {
136 self.messages
138 .get("en-US")
139 .and_then(|lang_map| lang_map.get(key))
140 .cloned()
141 .unwrap_or_else(|| format!("Missing translation: {key}"))
142 })
143 }
144
145 pub fn get_roast_messages(&self, rule_name: &str) -> Vec<String> {
146 match (self.lang.as_str(), rule_name) {
147 ("zh-CN", "terrible-naming") => vec![
148 "这个变量名比我的编程技能还要抽象,而我连 Hello World 都写不对".to_string(),
149 "这个名字告诉我你已经放弃治疗了,建议直接转行卖煎饼果子".to_string(),
150 "用这个做变量名?你是想让维护代码的人哭着辞职吗?".to_string(),
151 "恭喜你发明了最没有意义的变量名,可以申请专利了".to_string(),
152 "这变量名就像'无名氏'一样毫无特色,连我奶奶都能起个更好的名字".to_string(),
153 "看到这个变量名,我的智商都下降了,现在只能数到3了".to_string(),
154 "这变量名的创意程度约等于给孩子起名叫'小明'".to_string(),
155 "你这变量名让我想起了我的前任——毫无意义且令人困惑".to_string(),
156 "这个变量名的描述性约等于'东西'这个词的精确度".to_string(),
157 "恭喜!你成功地让变量名比注释还要难懂".to_string(),
158 ],
159 ("zh-CN", "single-letter-variable") => vec![
160 "单字母变量?你是在写数学公式还是在考验我的猜谜能力?".to_string(),
161 "这是变量名还是你键盘只剩一个键能用了?".to_string(),
162 "用单字母做变量名,建议你去买本《变量命名从入门到放弃》".to_string(),
163 "单字母变量:让代码比古埃及象形文字还难懂的神器".to_string(),
164 "这个变量名短得像我对你代码技能的期望一样".to_string(),
165 "单字母变量名?你这是在玩猜字谜游戏吗?".to_string(),
166 "恭喜你用一个字母成功地表达了无穷的困惑".to_string(),
167 "这变量名的信息量约等于一个句号".to_string(),
168 "你这是在节约字符还是在为难后来的维护者?".to_string(),
169 ],
170 ("zh-CN", "deep-nesting") => vec![
171 "这嵌套层数比俄罗斯套娃还要深,你是在挑战人类的理解极限吗?".to_string(),
172 "嵌套这么深,是想挖到地心还是想让读代码的人迷路?".to_string(),
173 "这代码嵌套得像洋葱一样,剥一层哭一次".to_string(),
174 "嵌套层数超标!建议重构,或者直接删了重写".to_string(),
175 "这嵌套深度已经可以申请吉尼斯世界纪录了,类别:最令人绝望的代码".to_string(),
176 "这代码比盗梦空间还要复杂,至少电影还有字幕".to_string(),
177 "你这嵌套层数让我想起了我的人际关系——复杂且令人困惑".to_string(),
178 "这嵌套深度足够埋葬我对编程的热情了".to_string(),
179 "恭喜你成功地把简单问题复杂化,这是一门艺术".to_string(),
180 "这代码的嵌套层数比我的焦虑层数还要多".to_string(),
181 ],
182 ("zh-CN", "long-function") => vec![
183 "这个函数比我的简历还要长,而我的简历已经长到HR看了想哭!".to_string(),
184 "函数长度建议拆分成几个小函数,或者直接删了重新做人".to_string(),
185 "这么长的函数?你是想让人一口气读完然后当场去世吗?".to_string(),
186 "这个函数比我对前任的怨念还要长".to_string(),
187 "这函数长得像《战争与和平》一样,但至少托尔斯泰会分章节".to_string(),
188 "这个函数需要一个GPS才能导航到结尾".to_string(),
189 "你这函数长度已经超越了我的注意力极限".to_string(),
190 "这函数比我妈的唠叨还要长,至少我妈会换个话题".to_string(),
191 "恭喜你写出了一个需要分期付款才能读完的函数".to_string(),
192 "这函数的长度让我怀疑你是按行数计工资的".to_string(),
193 ],
194 ("zh-CN", "unwrap-abuse") => vec![
195 "又一个 unwrap()!你是想让程序在生产环境里爆炸给老板看烟花吗?".to_string(),
196 "unwrap() 大师!错误处理是什么?能吃吗?还是说你觉得错误不会发生?".to_string(),
197 "看到这个 unwrap(),我仿佛听到了运维工程师的哭声".to_string(),
198 "unwrap() 使用者,恭喜你获得了'半夜被电话吵醒专业户'称号".to_string(),
199 "这个 unwrap() 就像俄罗斯轮盘赌,总有一发是实弹".to_string(),
200 "unwrap():让程序员体验心脏病发作的最佳工具".to_string(),
201 "你这 unwrap() 用得比我吃泡面还频繁,至少泡面不会让程序崩溃".to_string(),
202 "unwrap() 狂魔!你是不是觉得 panic 很好玩?".to_string(),
203 "这么多 unwrap(),你确定不是在写自毁程序?".to_string(),
204 "unwrap() 使用过度,建议改名为 'panic_generator.rs'".to_string(),
205 ],
206 ("zh-CN", "unnecessary-clone") => vec![
207 "clone() 狂魔!你是想把内存用完还是想让电脑罢工?".to_string(),
208 "这么多 clone(),你确定不是从 Java 转过来的?".to_string(),
209 "clone() 使用过度!Rust 的借用检查器已经哭晕在厕所".to_string(),
210 "又见 clone()!建议你重新学习 Rust,或者改学 Python".to_string(),
211 "这些 clone() 让我想起了复印机店的老板——疯狂复制一切".to_string(),
212 "clone() 滥用:让内存管理专家失业的最佳方式".to_string(),
213 "你这 clone() 用得比我换袜子还频繁".to_string(),
214 "恭喜你成功地把零拷贝变成了无限拷贝".to_string(),
215 "这么多 clone(),你是不是觉得内存是免费的?".to_string(),
216 "clone() 大师!你已经掌握了如何让程序跑得像蜗牛一样慢".to_string(),
217 ],
218 ("zh-CN", "complex-closure") => vec![
219 "闭包套闭包?你这是在写俄罗斯套娃还是在考验读者的智商?".to_string(),
220 "嵌套闭包比我的人际关系还复杂".to_string(),
221 "这闭包嵌套得像洋葱一样,剥一层哭一次".to_string(),
222 "闭包嵌套过深,建议拆分成独立函数".to_string(),
223 "这个闭包的参数比我的借口还多".to_string(),
224 "闭包参数过多,你确定不是在写函数?".to_string(),
225 ],
226 ("zh-CN", "lifetime-abuse") => vec![
227 "生命周期标注比我的生命还复杂".to_string(),
228 "这么多生命周期,你是在写哲学论文吗?".to_string(),
229 "生命周期滥用,建议重新设计数据结构".to_string(),
230 "生命周期多到让人怀疑人生".to_string(),
231 ],
232 ("zh-CN", "trait-complexity") => vec![
233 "这个 trait 的方法比我的借口还多".to_string(),
234 "trait 方法过多,违反了单一职责原则".to_string(),
235 "这个 trait 比瑞士军刀还要全能".to_string(),
236 "trait 臃肿,建议拆分成多个小 trait".to_string(),
237 "泛型参数比我的密码还复杂".to_string(),
238 "这么多泛型,你是在写数学公式吗?".to_string(),
239 ],
240 ("zh-CN", "generic-abuse") => vec![
241 "泛型参数比我的购物清单还长".to_string(),
242 "这么多泛型,编译器都要哭了".to_string(),
243 "泛型滥用,建议重新设计架构".to_string(),
244 "泛型多到让人怀疑这还是 Rust 吗".to_string(),
245 "泛型参数的命名创意约等于零".to_string(),
246 "泛型名字比我的耐心还短".to_string(),
247 ],
248 ("zh-CN", "channel-abuse") => vec![
249 "Channel 用得比我发微信还频繁,你确定不是在写聊天软件?".to_string(),
250 "这么多 Channel,你是想开通讯公司吗?".to_string(),
251 "Channel 滥用!你的程序比电话交换机还复杂".to_string(),
252 "Channel 数量超标,建议重新设计架构".to_string(),
253 "这么多 Channel,我怀疑你在写分布式系统".to_string(),
254 ],
255 ("zh-CN", "async-abuse") => vec![
256 "Async 函数比我的异步人生还要复杂".to_string(),
257 "这么多 async,你确定不是在写 JavaScript?".to_string(),
258 "Async 滥用!建议学习一下同步编程的美好".to_string(),
259 "异步函数过多,小心把自己绕晕了".to_string(),
260 "Await 用得比我等外卖还频繁".to_string(),
261 "这么多 await,你的程序是在等什么?世界末日吗?".to_string(),
262 ],
263 ("zh-CN", "dyn-trait-abuse") => vec![
264 "Dyn trait 用得比我换工作还频繁".to_string(),
265 "这么多动态分发,性能都跑到哪里去了?".to_string(),
266 "Dyn trait 滥用,你确定不是在写 Python?".to_string(),
267 "动态 trait 过多,编译器优化都哭了".to_string(),
268 "这么多 dyn,你的程序比变色龙还善变".to_string(),
269 ],
270 ("zh-CN", "unsafe-abuse") => vec![
271 "Unsafe 代码!你这是在玩火还是在挑战 Rust 的底线?".to_string(),
272 "又见 unsafe!安全性是什么?能吃吗?".to_string(),
273 "Unsafe 使用者,恭喜你获得了'内存安全破坏者'称号".to_string(),
274 "这个 unsafe 让我想起了 C 语言的恐怖回忆".to_string(),
275 "Unsafe 代码:让 Rust 程序员夜不能寐的存在".to_string(),
276 ],
277 ("zh-CN", "ffi-abuse") => vec![
278 "FFI 滥用!你这是在和多少种语言谈恋爱?".to_string(),
279 "外部接口比我的社交关系还复杂!".to_string(),
280 "这么多 FFI,Rust 的安全性都要哭了".to_string(),
281 "C 语言接口过多,你确定这还是 Rust 项目?".to_string(),
282 "FFI 代码让我想起了指针地狱的恐怖".to_string(),
283 ],
284 ("zh-CN", "macro-abuse") => vec![
285 "宏定义比我的借口还多".to_string(),
286 "这么多宏,你确定不是在写 C 语言?".to_string(),
287 "宏滥用!编译时间都被你搞长了".to_string(),
288 "宏过多,调试的时候准备哭吧".to_string(),
289 "这么多宏,IDE 都要罢工了".to_string(),
290 ],
291 ("zh-CN", "module-complexity") => vec![
292 "模块嵌套比俄罗斯套娃还深".to_string(),
293 "这模块结构比我的家族关系还复杂".to_string(),
294 "模块嵌套过深,建议重新组织代码结构".to_string(),
295 "这么深的模块,找个函数比找宝藏还难".to_string(),
296 ],
297 ("zh-CN", "pattern-matching-abuse") => vec![
298 "模式匹配比我的感情生活还复杂".to_string(),
299 "这么多模式,你是在写解谜游戏吗?".to_string(),
300 "模式过多,建议简化逻辑".to_string(),
301 "复杂的模式让代码可读性直线下降".to_string(),
302 "Match 分支比我的人生选择还多".to_string(),
303 "这么多 match 分支,你确定不是在写状态机?".to_string(),
304 ],
305 ("zh-CN", "reference-abuse") => vec![
306 "引用比我的社交关系还复杂".to_string(),
307 "这么多引用,你确定不是在写指针迷宫?".to_string(),
308 "引用过多,小心借用检查器罢工".to_string(),
309 "引用数量超标,建议重新设计数据结构".to_string(),
310 ],
311 ("zh-CN", "box-abuse") => vec![
312 "Box 用得比快递还频繁".to_string(),
313 "这么多 Box,你是在开仓库吗?".to_string(),
314 "Box 过多,堆内存都要爆炸了".to_string(),
315 "Box 滥用,建议考虑栈分配".to_string(),
316 "这么多 Box,内存分配器都累了".to_string(),
317 ],
318 ("zh-CN", "slice-abuse") => vec![
319 "切片比我切菜还频繁".to_string(),
320 "这么多切片,你是在开水果店吗?".to_string(),
321 "切片过多,数组都被你切碎了".to_string(),
322 "Slice 滥用,建议使用 Vec".to_string(),
323 ],
324 ("zh-CN", "code-duplication") => vec![
325 "检测到重复代码!你是复制粘贴大师吗?".to_string(),
326 "这些重复代码比双胞胎还像".to_string(),
327 "DRY原则哭了,你的代码湿得像雨季".to_string(),
328 "重复代码这么多,建议改名为copy-paste.rs".to_string(),
329 ],
330 ("zh-CN", "cyclomatic-complexity") => vec![
331 "圈复杂度爆表!这代码比迷宫还复杂".to_string(),
332 "复杂度这么高,连AI都看不懂".to_string(),
333 "这函数的复杂度已经超越人类理解范围".to_string(),
334 "建议拆分函数,或者直接重写".to_string(),
335 ],
336 ("en-US", "terrible-naming") => vec![
338 "This variable name is more abstract than my programming skills, and I can't even write Hello World correctly".to_string(),
339 "This name tells me you've given up on life and should probably sell hotdogs instead".to_string(),
340 "Using this as a variable name? Are you trying to make code maintainers cry and quit their jobs?".to_string(),
341 "Congratulations on inventing the most meaningless variable name, you should patent this level of confusion".to_string(),
342 "This variable name is as generic as 'John Doe', even my grandmother could come up with something better".to_string(),
343 "Seeing this variable name, my IQ just dropped to single digits".to_string(),
344 "This variable name has the creativity level of naming a kid 'Child'".to_string(),
345 "Your variable name reminds me of my ex - meaningless and confusing".to_string(),
346 "This variable name's descriptiveness is equivalent to calling everything 'stuff'".to_string(),
347 "Congrats! You've successfully made variable names harder to understand than comments".to_string(),
348 ],
349 ("en-US", "single-letter-variable") => vec![
350 "Single letter variable? Are you writing math formulas or testing my psychic abilities?".to_string(),
351 "Is this a variable name or did your keyboard only have one working key?".to_string(),
352 "Using single letters for variables, I suggest buying 'Variable Naming for Dummies'".to_string(),
353 "Single letter variables: making code harder to read than ancient hieroglyphics".to_string(),
354 "This variable name is as short as my expectations for your coding skills".to_string(),
355 "Single letter variable name? Are we playing charades now?".to_string(),
356 "Congrats on expressing infinite confusion with just one letter".to_string(),
357 "This variable name has the information content of a period".to_string(),
358 "Are you saving characters or just torturing future maintainers?".to_string(),
359 ],
360 ("en-US", "deep-nesting") => vec![
361 "This nesting is deeper than Russian dolls, are you challenging the limits of human comprehension?".to_string(),
362 "Nesting this deep, are you trying to dig to Earth's core or just make code readers get lost?".to_string(),
363 "This code is nested like an onion, peel one layer, cry once".to_string(),
364 "Nesting level exceeded! Suggest refactoring, or just delete and start over".to_string(),
365 "This nesting depth could apply for a Guinness World Record in 'Most Despair-Inducing Code'".to_string(),
366 "This code is more complex than Inception, at least the movie had subtitles".to_string(),
367 "Your nesting levels remind me of my relationships - complex and confusing".to_string(),
368 "This nesting depth is enough to bury my passion for programming".to_string(),
369 "Congrats on successfully complicating simple problems, it's an art form".to_string(),
370 "This code has more nesting levels than my anxiety layers".to_string(),
371 ],
372 ("en-US", "long-function") => vec![
373 "This function is longer than my resume, and my resume already makes HR cry!".to_string(),
374 "Function length suggests splitting into smaller functions, or just delete and start a new career".to_string(),
375 "Such a long function? Are you trying to make people read it in one breath and die on the spot?".to_string(),
376 "This function is longer than my grudges against my ex".to_string(),
377 "This function is as long as 'War and Peace', but at least Tolstoy used chapters".to_string(),
378 "This function needs a GPS to navigate to the end".to_string(),
379 "Your function length has exceeded my attention span limits".to_string(),
380 "This function is longer than my mom's nagging, at least she changes topics".to_string(),
381 "Congrats on writing a function that requires installment payments to read completely".to_string(),
382 "This function's length makes me suspect you're paid by lines of code".to_string(),
383 ],
384 ("en-US", "unwrap-abuse") => vec![
385 "Another unwrap()! Are you trying to make the program explode in production like fireworks for your boss?".to_string(),
386 "unwrap() master! What is error handling? Can you eat it? Or do you think errors just don't happen?".to_string(),
387 "Seeing this unwrap(), I can almost hear the DevOps engineers crying".to_string(),
388 "unwrap() user, congratulations on earning the 'Midnight Phone Call Specialist' title".to_string(),
389 "This unwrap() is like Russian roulette, eventually you'll hit the real bullet".to_string(),
390 "unwrap(): the best tool for experiencing heart attacks as a programmer".to_string(),
391 "You use unwrap() more than I eat instant noodles, at least noodles don't crash programs".to_string(),
392 "unwrap() maniac! Do you think panic is fun?".to_string(),
393 "So many unwrap()s, are you sure you're not writing a self-destruct program?".to_string(),
394 "unwrap() overuse detected, suggest renaming to 'panic_generator.rs'".to_string(),
395 ],
396 ("en-US", "unnecessary-clone") => vec![
397 "clone() maniac! Are you trying to exhaust all memory or make the computer go on strike?".to_string(),
398 "So many clone()s, are you sure you didn't just migrate from Java?".to_string(),
399 "clone() overuse! Rust's borrow checker has fainted in the bathroom".to_string(),
400 "Another clone()! Suggest relearning Rust, or maybe switch to Python".to_string(),
401 "These clone()s remind me of a copy shop owner - frantically copying everything".to_string(),
402 "clone() abuse: the best way to make memory management experts unemployed".to_string(),
403 "You use clone() more frequently than I change socks".to_string(),
404 "Congrats on successfully turning zero-copy into infinite-copy".to_string(),
405 "So many clone()s, do you think memory is free?".to_string(),
406 "clone() master! You've mastered how to make programs run as slow as snails".to_string(),
407 ],
408 ("en-US", "complex-closure") => vec![
409 "Nested closures? Are you writing Russian dolls or testing readers' IQ?".to_string(),
410 "Nested closures are more complex than my relationships".to_string(),
411 "This closure nesting is like an onion, peel one layer, cry once".to_string(),
412 "Closure nesting too deep, suggest splitting into separate functions".to_string(),
413 "This closure has more parameters than my excuses".to_string(),
414 "Too many closure parameters, are you sure you're not writing a function?".to_string(),
415 ],
416 ("en-US", "lifetime-abuse") => vec![
417 "Lifetime annotations are more complex than my actual life".to_string(),
418 "So many lifetimes, are you writing a philosophy paper?".to_string(),
419 "Lifetime abuse, suggest redesigning data structures".to_string(),
420 "So many lifetimes it makes me question existence".to_string(),
421 ],
422 ("en-US", "trait-complexity") => vec![
423 "This trait has more methods than my excuses".to_string(),
424 "Too many trait methods, violates single responsibility principle".to_string(),
425 "This trait is more versatile than a Swiss Army knife".to_string(),
426 "Bloated trait, suggest splitting into multiple smaller traits".to_string(),
427 "Generic parameters more complex than my passwords".to_string(),
428 "So many generics, are you writing mathematical formulas?".to_string(),
429 ],
430 ("en-US", "generic-abuse") => vec![
431 "Generic parameters longer than my shopping list".to_string(),
432 "So many generics, even the compiler is crying".to_string(),
433 "Generic abuse, suggest redesigning architecture".to_string(),
434 "So many generics, makes me wonder if this is still Rust".to_string(),
435 "Generic parameter naming creativity equals zero".to_string(),
436 "Generic name shorter than my patience".to_string(),
437 ],
438 ("en-US", "channel-abuse") => vec![
439 "Using channels more frequently than I text, are you writing a chat app?".to_string(),
440 "So many channels, are you starting a telecom company?".to_string(),
441 "Channel abuse! Your program is more complex than a phone exchange".to_string(),
442 "Channel count exceeded, suggest redesigning architecture".to_string(),
443 "So many channels, I suspect you're writing a distributed system".to_string(),
444 ],
445 ("en-US", "async-abuse") => vec![
446 "Async functions more complex than my asynchronous life".to_string(),
447 "So many async, are you sure you're not writing JavaScript?".to_string(),
448 "Async abuse! Suggest learning the beauty of synchronous programming".to_string(),
449 "Too many async functions, careful not to confuse yourself".to_string(),
450 "Using await more frequently than I wait for food delivery".to_string(),
451 "So many awaits, what is your program waiting for? The apocalypse?".to_string(),
452 ],
453 ("en-US", "dyn-trait-abuse") => vec![
454 "Using dyn traits more frequently than I change jobs".to_string(),
455 "So much dynamic dispatch, where did the performance go?".to_string(),
456 "Dyn trait abuse, are you sure you're not writing Python?".to_string(),
457 "Too many dynamic traits, even compiler optimizations are crying".to_string(),
458 "So many dyns, your program is more changeable than a chameleon".to_string(),
459 ],
460 ("en-US", "unsafe-abuse") => vec![
461 "Unsafe code! Are you playing with fire or challenging Rust's bottom line?".to_string(),
462 "Another unsafe! What is safety? Can you eat it?".to_string(),
463 "Unsafe user, congratulations on earning the 'Memory Safety Destroyer' title".to_string(),
464 "This unsafe reminds me of the horrifying memories of C language".to_string(),
465 "Unsafe code: the existence that keeps Rust programmers awake at night".to_string(),
466 ],
467 ("en-US", "ffi-abuse") => vec![
468 "FFI abuse! How many languages are you dating?".to_string(),
469 "External interfaces are more complex than my social relationships!".to_string(),
470 "So much FFI, Rust's safety is crying".to_string(),
471 "Too many C interfaces, are you sure this is still a Rust project?".to_string(),
472 "FFI code reminds me of the horror of pointer hell".to_string(),
473 ],
474 ("en-US", "macro-abuse") => vec![
475 "More macro definitions than my excuses".to_string(),
476 "So many macros, are you sure you're not writing C?".to_string(),
477 "Macro abuse! You've made compile time longer".to_string(),
478 "Too many macros, prepare to cry when debugging".to_string(),
479 "So many macros, even the IDE wants to quit".to_string(),
480 ],
481 ("en-US", "module-complexity") => vec![
482 "Module nesting deeper than Russian dolls".to_string(),
483 "This module structure is more complex than my family relationships".to_string(),
484 "Module nesting too deep, suggest reorganizing code structure".to_string(),
485 "Such deep modules, finding a function is harder than finding treasure".to_string(),
486 ],
487 ("en-US", "pattern-matching-abuse") => vec![
488 "Pattern matching more complex than my love life".to_string(),
489 "So many patterns, are you writing a puzzle game?".to_string(),
490 "Too many patterns, suggest simplifying logic".to_string(),
491 "Complex patterns make code readability plummet".to_string(),
492 "More match branches than my life choices".to_string(),
493 "So many match branches, are you sure you're not writing a state machine?".to_string(),
494 ],
495 ("en-US", "reference-abuse") => vec![
496 "References more complex than my social relationships".to_string(),
497 "So many references, are you sure you're not writing a pointer maze?".to_string(),
498 "Too many references, careful the borrow checker might strike".to_string(),
499 "Reference count exceeded, suggest redesigning data structures".to_string(),
500 ],
501 ("en-US", "box-abuse") => vec![
502 "Using Box more frequently than courier services".to_string(),
503 "So many Boxes, are you opening a warehouse?".to_string(),
504 "Too many Boxes, heap memory is about to explode".to_string(),
505 "Box abuse, suggest considering stack allocation".to_string(),
506 "So many Boxes, even the memory allocator is tired".to_string(),
507 ],
508 ("en-US", "slice-abuse") => vec![
509 "Slicing more frequently than I chop vegetables".to_string(),
510 "So many slices, are you opening a fruit shop?".to_string(),
511 "Too many slices, you've chopped the arrays to pieces".to_string(),
512 "Slice abuse, suggest using Vec instead".to_string(),
513 ],
514 ("en-US", "code-duplication") => vec![
515 "Copy-paste ninja detected! 🥷 Your code has more duplicates than a hall of mirrors".to_string(),
516 "DRY principle is crying in the corner while your code is drowning in repetition".to_string(),
517 "This much duplication suggests you should rename your file to 'ctrl-c-ctrl-v.rs'".to_string(),
518 "Duplicate code alert! Even my copy machine is jealous of your efficiency".to_string(),
519 "Your code has more clones than a sci-fi movie, time for some refactoring!".to_string(),
520 ],
521 _ => vec!["Unknown issue detected".to_string()],
522 }
523 }
524
525 pub fn get_suggestions(&self, _rule_names: &[String]) -> Vec<String> {
526 vec![]
529 }
530}