garbage-code-hunter 0.1.2

A humorous Rust code quality detector that roasts your garbage code
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
# ๐Ÿ—‘๏ธ Garbage Code Hunter

[![Rust](https://img.shields.io/badge/rust-1.70+-orange.svg)](https://www.rust-lang.org)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Crates.io](https://img.shields.io/crates/v/garbage-code-hunter.svg)](https://crates.io/crates/garbage-code-hunter)
[![Tests](https://img.shields.io/badge/tests-71%20passing-brightgreen.svg)]()

A humorous Rust code quality detector that roasts your garbage code with style! ๐Ÿ”ฅ

*The most sarcastic Rust static analysis assistant you'll ever meet* ๐ŸŽญ   Make coding more interesting, and have fun ๐Ÿ˜.

```
Inspiration from https://github.com/Done-0/fuck-u-code.git
```

Unlike traditional linters that give you dry, boring warnings, Garbage Code Hunter delivers **sarcastic, witty, and brutally honest** feedback about your code quality. It's like having a sassy code reviewer who isn't afraid to hurt your feelings (in a good way).

## โœจ Features

- ๐ŸŽญ **Humorous Code Analysis**: Get roasted with style while learning better coding practices
- ๐Ÿ—ฃ๏ธ **Sarcastic Commentary**: Witty and educational feedback that makes code review fun
- ๐ŸŒ **Multi-language Support**: Available in English and Chinese (more languages coming soon!)
- ๐ŸŽฏ **Smart Detection**: Identifies common code smells and anti-patterns
- ๐ŸŽฒ **Randomized Roasts**: Different witty comments every time you run it
- ๐Ÿ“Š **Professional Reports**: Generate detailed analysis reports in multiple formats
- ๐Ÿ”ง **Highly Configurable**: Customize output, filtering, and analysis depth
- ๐Ÿ“ **Markdown Export**: Perfect for documentation and CI/CD integration
- ๐Ÿš€ **Fast & Lightweight**: Built with Rust for maximum performance

### ๐Ÿ†• **Enhanced Features**

- ๐ŸŽ“ **Educational Mode**: Detailed explanations with code examples and best practices
- ๐Ÿ† **Hall of Shame**: Project statistics and worst files ranking
- ๐Ÿ’ก **Smart Suggestions**: Targeted improvement recommendations based on detected issues
- ๐Ÿ“ˆ **Advanced Scoring**: Comprehensive quality metrics with category breakdown
- ๐ŸŽจ **Beautiful UI**: Card-style layouts with progress bars and visual indicators
- ๐Ÿ” **File Structure Analysis**: Detects overly long files, import chaos, and deep module nesting

## ๐ŸŽฏ Detection Features

### ๐Ÿ“ **Naming Convention Checks**

- **Terrible Naming**: Detects meaningless variable names
- **Single Letter Variables**: Finds overused single-letter variables
- **Meaningless Naming**: Identifies placeholder names like `foo`, `bar`, `data`, `temp`
- **Hungarian Notation**: Detects outdated naming like `strName`, `intCount`
- **Abbreviation Abuse**: Finds confusing abbreviations like `mgr`, `ctrl`, `usr`, `pwd`

### ๐Ÿ”ง **Code Complexity Analysis**

- **Deep Nesting**: Detects nesting deeper than 3 levels
- **Long Functions**: Finds functions with too many lines
- **God Functions**: Identifies overly complex functions doing too much

### ๐Ÿฆ€ **Rust-Specific Issues**

- **Unwrap Abuse**: Detects unsafe unwrap() usage
- **Unnecessary Clone**: Finds avoidable clone() calls
- **String Abuse**: Identifies places where `&str` should be used instead of `String`
- **Vec Abuse**: Detects unnecessary Vec allocations
- **Iterator Abuse**: Finds traditional loops that could use iterator chains
- **Match Abuse**: Identifies complex matches that could be simplified with `if let`

### ๐Ÿ’ฉ **Code Smell Detection**

- **Magic Numbers**: Detects hardcoded numeric constants
- **Commented Code**: Finds large blocks of commented-out code
- **Dead Code**: Identifies unreachable code

### ๐ŸŽ“ **Student Code Patterns**

- **Printf Debugging**: Detects leftover debugging print statements
- **Panic Abuse**: Finds casual panic! usage
- **TODO Comments**: Counts excessive TODO/FIXME comments

### ๐Ÿ”„ **Other Detections**

- **Code Duplication**: Finds repeated code blocks
- **Macro Abuse**: Detects excessive macro usage
- **Advanced Rust Patterns**: Complex closures, lifetime abuse, etc.

### ๐Ÿ—๏ธ **File Structure Analysis**

- **File Length**: Detects overly long files (>1000 lines)
- **Import Chaos**: Identifies unordered and duplicate imports
- **Module Nesting**: Detects overly deep module hierarchies
- **Project Organization**: Analyzes overall code structure quality

## ๐Ÿ“Š Detection Rules Statistics

Our tool currently includes **20+ detection rules** covering the following categories:

| Category                     | Rules Count | Description                           |
| ---------------------------- | ----------- | ------------------------------------- |
| **Naming Conventions** | 5           | Various naming issues detection       |
| **Code Complexity**    | 3           | Code structure complexity analysis    |
| **Rust-Specific**      | 6           | Rust language-specific issue patterns |
| **Code Smells**        | 4           | General code quality problems         |
| **Student Code**       | 3           | Common beginner code patterns         |
| **File Structure**     | 3           | File organization and import analysis |
| **Others**             | 5+          | Code duplication, macro abuse, etc.   |

**Total: 25+ rules** actively detecting garbage code patterns in your Rust projects! ๐Ÿ—‘๏ธ

## ๐ŸŽฏ Scoring System

Garbage Code Hunter includes a comprehensive **scientific scoring system** that evaluates your Rust code quality on a scale of **0-100**, where:

- **Lower scores = Better code quality** ๐Ÿ†
- **Higher scores = More problematic code** ๐Ÿ’€

### ๐Ÿ“Š Score Ranges & Quality Levels

| Score Range | Quality Level | Emoji | Description                                           |
| ----------- | ------------- | ----- | ----------------------------------------------------- |
| 0-20        | Excellent     | ๐Ÿ†    | Outstanding code quality with minimal issues          |
| 21-40       | Good          | ๐Ÿ‘    | Good code quality with minor improvements needed      |
| 41-60       | Average       | ๐Ÿ˜    | Average code quality with room for improvement        |
| 61-80       | Poor          | ๐Ÿ˜Ÿ    | Poor code quality, refactoring recommended            |
| 81-100      | Terrible      | ๐Ÿ’€    | Critical code quality issues, rewrite urgently needed |

### ๐Ÿงฎ Scoring Algorithm

The scoring system uses a **multi-factor algorithm** that considers:

#### 1. **Base Score Calculation**

Each detected issue contributes to the base score using:

```
Issue Score = Rule Weight ร— Severity Weight
```

#### 2. **Rule Weights** (Impact Factor)

Different types of issues have different weights based on their impact:

| Category                    | Rule                  | Weight | Rationale                        |
| --------------------------- | --------------------- | ------ | -------------------------------- |
| **Safety Critical**   | `unsafe-abuse`      | 5.0    | Memory safety violations         |
| **FFI Critical**      | `ffi-abuse`         | 4.5    | Foreign function interface risks |
| **Runtime Critical**  | `unwrap-abuse`      | 4.0    | Potential panic sources          |
| **Architecture**      | `lifetime-abuse`    | 3.5    | Complex lifetime management      |
| **Async/Concurrency** | `async-abuse`       | 3.5    | Async pattern misuse             |
| **Complexity**        | `deep-nesting`      | 3.0    | Code maintainability             |
| **Performance**       | `unnecessary-clone` | 2.0    | Runtime efficiency               |
| **Readability**       | `terrible-naming`   | 2.0    | Code comprehension               |

#### 3. **Severity Weights**

Issues are classified by severity with corresponding multipliers:

- **Nuclear** (๐Ÿ’ฅ): 10.0ร— - Critical issues that can cause crashes or security vulnerabilities
- **Spicy** (๐ŸŒถ๏ธ): 5.0ร— - Serious issues affecting maintainability or performance
- **Mild** (๐Ÿ˜): 2.0ร— - Minor issues with style or best practices

#### 4. **Density Penalties**

Additional penalties based on issue concentration:

- **Issue Density**: Problems per 1000 lines of code

  - \>50 issues/1000 lines: +25 penalty
  - \>30 issues/1000 lines: +15 penalty
  - \>20 issues/1000 lines: +10 penalty
  - \>10 issues/1000 lines: +5 penalty
- **File Complexity**: Average issues per file

  - \>20 issues/file: +15 penalty
  - \>10 issues/file: +10 penalty
  - \>5 issues/file: +5 penalty

#### 5. **Severity Distribution Penalties**

Extra penalties for problematic patterns:

- **Nuclear Issues**: First nuclear issue +20, each additional +5
- **Spicy Issues**: After 5 spicy issues, each additional +2
- **Mild Issues**: After 20 mild issues, each additional +0.5

### ๐Ÿ“ˆ Metrics Included

The scoring system provides detailed metrics:

- **Total Score**: Overall code quality score (0-100)
- **Category Scores**: Breakdown by issue categories
- **Issue Density**: Problems per 1000 lines of code
- **Severity Distribution**: Count of nuclear/spicy/mild issues
- **File Count**: Number of analyzed Rust files
- **Total Lines**: Total lines of code analyzed

### ๐ŸŽฏ Interpretation Guide

**For Excellent Code (0-20):**

- Minimal issues detected
- Strong adherence to Rust best practices
- Good architecture and safety patterns

**For Good Code (21-40):**

- Few minor issues
- Generally well-structured
- Minor optimizations possible

**For Average Code (41-60):**

- Moderate number of issues
- Some refactoring beneficial
- Focus on complexity reduction

**For Poor Code (61-80):**

- Significant issues present
- Refactoring strongly recommended
- Address safety and complexity concerns

**For Terrible Code (81-100):**

- Critical issues requiring immediate attention
- Consider rewriting problematic sections
- Focus on safety, correctness, and maintainability

### ๐Ÿ”ฌ Scientific Approach

The scoring system is designed to be:

- **Objective**: Based on measurable code metrics
- **Weighted**: Critical issues have higher impact
- **Contextual**: Considers code size and complexity
- **Actionable**: Provides specific improvement areas
- **Consistent**: Reproducible results across runs

## ๐ŸŽช What It Detects

### Naming Disasters

- Terrible variable names (`data`, `temp`, `info`, `obj`)
- Single-letter variables (except common loop counters)
- Generic meaningless identifiers

### Code Structure Issues

- Deep nesting (Russian doll syndrome)
- Overly long functions
- Complex conditional logic

### Rust-Specific Anti-patterns

- `unwrap()` abuse (panic bombs ๐Ÿ’ฃ)
- Unnecessary `clone()` calls (memory waste)
- Poor error handling patterns

## ๐Ÿš€ Installation

### From Source

```bash
git clone https://github.com/yourusername/garbage-code-hunter.git
cd garbage-code-hunter
make install
```

### Using Cargo

```bash
cargo install garbage-code-hunter
```

## ๐Ÿ“– Usage

### Basic Usage

```bash
# Analyze current directory
cargo run

# Analyze specific file or directory
cargo run -- src/main.rs
cargo run -- src/

# Use make targets for convenience
make run ARGS="src/ --verbose"
make demo
```

### Language Options

```bash
# Chinese output (default)
garbage-code-hunter --lang zh-CN src/

# English output
garbage-code-hunter --lang en-US src/
```

### Advanced Options

```bash
# Verbose analysis with top 3 problematic files
garbage-code-hunter --verbose --top 3 --issues 5 src/

# Only show summary
garbage-code-hunter --summary src/

# Generate Markdown report
garbage-code-hunter --markdown src/ > code-quality-report.md

# Exclude files/directories
garbage-code-hunter --exclude "test_*" --exclude "target/*" src/

# Show only serious issues
garbage-code-hunter --harsh src/
```

### ๐Ÿ†• Enhanced Analysis Features

```bash
# Educational mode - provides detailed explanations and improvement suggestions for each issue type
cargo run -- src/ --educational

# Hall of Shame - shows statistics of worst files and most common issues  
cargo run -- src/ --hall-of-shame

# Smart suggestions - generates targeted improvement recommendations based on actual issues
cargo run -- src/ --suggestions

# Combine features for comprehensive analysis report
cargo run -- src/ --hall-of-shame --suggestions --educational

# Example: Complete project analysis with all enhanced features
cargo run -- . --hall-of-shame --suggestions --lang en

# Quick analysis with suggestions only
cargo run -- src/ --suggestions --lang zh-CN
```

#### ๐ŸŽ“ Educational Mode (`--educational`)

Provides detailed explanations for each detected issue:

- **Why it's problematic**: Clear explanation of the issue
- **How to fix**: Step-by-step improvement guide
- **Code examples**: Before/after code snippets
- **Best practices**: Links to Rust documentation and guidelines

#### ๐Ÿ† Hall of Shame (`--hall-of-shame`)

Shows comprehensive project statistics:

- **Worst files ranking**: Files with most issues
- **Issue frequency analysis**: Most common problem patterns
- **Project metrics**: Garbage density, file count, total issues
- **Category breakdown**: Issues grouped by type

#### ๐Ÿ’ก Smart Suggestions (`--suggestions`)

Generates intelligent, data-driven recommendations:

- **Targeted advice**: Based on your actual code issues
- **Priority ranking**: Most critical improvements first
- **Actionable steps**: Specific, implementable suggestions
- **Progress tracking**: Measurable improvement goals

## ๐ŸŽจ Sample Output

### English Mode

```
๐Ÿ—‘๏ธ  Garbage Code Hunter ๐Ÿ—‘๏ธ
Preparing to roast your code...

๐Ÿ“Š Code Quality Report
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Found some areas for improvement:

๐Ÿ“ˆ Issue Statistics:
   8 ๐Ÿ”ฅ Nuclear Issues (fix immediately)
   202 ๐ŸŒถ๏ธ  Spicy Issues (should fix)
   210 ๐Ÿ˜ Mild Issues (can ignore)
   420 ๐Ÿ“ Total

๐Ÿ† Code Quality Score
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   ๐Ÿ“Š Score: 63.0/100 ๐Ÿ˜ž
   ๐ŸŽฏ Level: Poor
   ๐Ÿ“ Lines of Code: 512
   ๐Ÿ“ Files: 2
   ๐Ÿ” Issue Density: 82 issues/1k lines

   ๐ŸŽญ Issue Distribution:
      ๐Ÿ’ฅ Nuclear: 8
      ๐ŸŒถ๏ธ  Spicy: 202
      ๐Ÿ˜ Mild: 210

๐Ÿ† Files with Most Issues
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   1. func.rs (231 issues)
   2. ultimate_garbage_code_example.rs (189 issues)

๐Ÿ“ ultimate_garbage_code_example.rs
  ๐Ÿ“ฆ Nesting depth issues: 11 (depth 4-14)
  โš ๏ธ panic abuse: 1
  ๐Ÿ”„ Code duplication issues: 5 (multiple blocks)
  โš ๏ธ god function: 1
  โš ๏ธ magic number: 16

๐Ÿ“ func.rs
  ๐Ÿ“ฆ Nesting depth issues: 20 (depth 4-9)
  ๐Ÿ”„ Code duplication issues: 9 (10 instances)
  ๐Ÿท๏ธ Variable naming issues: 22 (temp, temp, data, data, data, ...)
  โš ๏ธ println debugging: 1
  ๐Ÿท๏ธ Variable naming issues: 128 (a, b, c, d, e, ...)


๐Ÿ† Code Quality Report
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
โ•ญโ”€ ๐Ÿ“Š Overall Score โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                                                      โ”‚
โ”‚  Score: 63.0/100  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’  (๐Ÿ˜ž Poor)โ”‚
โ”‚                                                      โ”‚
โ”‚  Files analyzed: 2    Total issues: 420                           โ”‚
โ”‚                                                      โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ“‹ Category Scores
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   โš  ๐Ÿท๏ธ Naming [ 90] โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’โ–’ Terrible, urgent fixes needed
       ๐Ÿ’ฌ Variable names harder to decode than alien language ๐Ÿ‘ฝ
   โš  ๐Ÿงฉ Complexity [ 90] โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’โ–’ Terrible, urgent fixes needed
       ๐Ÿ’ฌ More nesting levels than Russian dolls ๐Ÿช†
   โš  ๐Ÿ”„ Duplication [ 90] โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’โ–’ Terrible, urgent fixes needed
       ๐Ÿ’ฌ This duplication level deserves a Guinness World Record ๐Ÿ†
   โœ“โœ“ ๐Ÿฆ€ Rust Basics [  0] โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ Excellent, keep it up
   โœ“โœ“ โšก Advanced Rust [  0] โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ Excellent, keep it up
   โš  ๐Ÿš€ Rust Features [ 90] โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’โ–’ Terrible, urgent fixes needed
       ๐Ÿ’ฌ Rust community would shed tears seeing this code ๐Ÿฆ€
   โœ“โœ“ ๐Ÿ—๏ธ Code Structure [  0] โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ Excellent, keep it up


๐Ÿ“ Scoring Scale (higher score = worse code)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   ๐Ÿ’€ 81-100: Terrible, rewrite needed    ๐Ÿ”ฅ 61-80: Poor, refactoring recommended
   โš ๏ธ  41-60: Average, needs improvement   โœ… 21-40: Good, room for improvement
   ๐ŸŒŸ 0-20: Excellent, keep it up

Keep working to make your code better! ๐Ÿš€
```

### Chinese Mode

```
๐Ÿ—‘๏ธ  ๅžƒๅœพไปฃ็ ็ŒŽไบบ ๐Ÿ—‘๏ธ
ๆญฃๅœจๅ‡†ๅค‡ๅๆงฝไฝ ็š„ไปฃ็ ...

๐Ÿ“Š ๅžƒๅœพไปฃ็ ๆฃ€ๆต‹ๆŠฅๅ‘Š
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
ๅ‘็Žฐไบ†ไธ€ไบ›้œ€่ฆๆ”น่ฟ›็š„ๅœฐๆ–น๏ผš

๐Ÿ“ˆ ้—ฎ้ข˜็ปŸ่ฎก:
   8 ๐Ÿ”ฅ ๆ ธๅผน็บง้—ฎ้ข˜ (้œ€่ฆ็ซ‹ๅณไฟฎๅค)
   202 ๐ŸŒถ๏ธ  ่พฃ็œผ็›้—ฎ้ข˜ (ๅปบ่ฎฎไฟฎๅค)
   210 ๐Ÿ˜ ่ฝปๅพฎ้—ฎ้ข˜ (ๅฏไปฅๅฟฝ็•ฅ)
   420 ๐Ÿ“ ๆ€ป่ฎก

๐Ÿ† ไปฃ็ ่ดจ้‡่ฏ„ๅˆ†
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   ๐Ÿ“Š ๆ€ปๅˆ†: 63.0/100 ๐Ÿ˜ž
   ๐ŸŽฏ ็ญ‰็บง: ่พƒๅทฎ
   ๐Ÿ“ ไปฃ็ ่กŒๆ•ฐ: 512
   ๐Ÿ“ ๆ–‡ไปถๆ•ฐ้‡: 2
   ๐Ÿ” ้—ฎ้ข˜ๅฏ†ๅบฆ: 82 ้—ฎ้ข˜/ๅƒ่กŒ

   ๐ŸŽญ ้—ฎ้ข˜ๅˆ†ๅธƒ:
      ๐Ÿ’ฅ ๆ ธๅผน็บง: 8
      ๐ŸŒถ๏ธ  ไธฅ้‡: 202
      ๐Ÿ˜ ่ฝปๅพฎ: 210

๐Ÿ† ้—ฎ้ข˜ๆœ€ๅคš็š„ๆ–‡ไปถ
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   1. func.rs (231 issues)
   2. ultimate_garbage_code_example.rs (189 issues)

๐Ÿ“ func.rs
  ๐Ÿ“ฆ ๅตŒๅฅ—ๆทฑๅบฆ้—ฎ้ข˜: 20 (ๆทฑๅบฆๅตŒๅฅ—)
  ๐Ÿ”„ ไปฃ็ ้‡ๅค้—ฎ้ข˜: 9 (6 instances)
  ๐Ÿท๏ธ ๅ˜้‡ๅ‘ฝๅ้—ฎ้ข˜: 22 (temp, temp, data, data, data, ...)
  โš ๏ธ println ่ฐƒ่ฏ•: 1
  ๐Ÿท๏ธ ๅ˜้‡ๅ‘ฝๅ้—ฎ้ข˜: 128 (a, b, c, d, e, ...)

๐Ÿ“ ultimate_garbage_code_example.rs
  ๐Ÿ“ฆ ๅตŒๅฅ—ๆทฑๅบฆ้—ฎ้ข˜: 11 (ๆทฑๅบฆๅตŒๅฅ—)
  โš ๏ธ panic ๆปฅ็”จ: 1
  ๐Ÿ”„ ไปฃ็ ้‡ๅค้—ฎ้ข˜: 5 (ๅคšไธชไปฃ็ ๅ—)
  โš ๏ธ ไธŠๅธๅ‡ฝๆ•ฐ: 1
  โš ๏ธ ้ญ”ๆณ•ๆ•ฐๅญ—: 16


๐Ÿ† ไปฃ็ ่ดจ้‡ๆŠฅๅ‘Š
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
โ•ญโ”€ ๐Ÿ“Š ๆ€ปไฝ“่ฏ„ๅˆ† โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                                                      โ”‚
โ”‚  ๆ€ปๅˆ†: 63.0/100  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’  (๐Ÿ˜ž ่พƒๅทฎ)โ”‚
โ”‚                                                      โ”‚
โ”‚  ๅˆ†ๆžๆ–‡ไปถ: 2 ไธช    ้—ฎ้ข˜ๆ€ปๆ•ฐ: 420 ไธช                              โ”‚
โ”‚                                                      โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ“‹ ๅˆ†็ฑป่ฏ„ๅˆ†่ฏฆๆƒ…
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   โš  ๐Ÿท๏ธ ๅ‘ฝๅ่ง„่Œƒ [ 90ๅˆ†] โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’โ–’ ็ณŸ็ณ•๏ผŒๆ€ฅ้œ€ไฟฎๅค
       ๐Ÿ’ฌ ๅ˜้‡ๅ็š„ๅˆ›ๆ„็จ‹ๅบฆ่ถ…่ถŠไบ†ๆˆ‘็š„็†่งฃ ๐Ÿš€
   โš  ๐Ÿงฉ ๅคๆ‚ๅบฆ [ 90ๅˆ†] โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’โ–’ ็ณŸ็ณ•๏ผŒๆ€ฅ้œ€ไฟฎๅค
       ๐Ÿ’ฌ ๅ‡ฝๆ•ฐ้•ฟๅบฆๅทฒ็ป็ช็ ดๅคฉ้™… ๐Ÿš€
   โš  ๐Ÿ”„ ไปฃ็ ้‡ๅค [ 90ๅˆ†] โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’โ–’ ็ณŸ็ณ•๏ผŒๆ€ฅ้œ€ไฟฎๅค
       ๐Ÿ’ฌ ๅปบ่ฎฎๆ”นๅไธบcopy-paste.rs ๐Ÿ“‹
   โœ“โœ“ ๐Ÿฆ€ RustๅŸบ็ก€ [  0ๅˆ†] โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ ไผ˜็ง€๏ผŒ็ปง็ปญไฟๆŒ
   โœ“โœ“ โšก ้ซ˜็บง็‰นๆ€ง [  0ๅˆ†] โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ ไผ˜็ง€๏ผŒ็ปง็ปญไฟๆŒ
   โš  ๐Ÿš€ RustๅŠŸ่ƒฝ [ 90ๅˆ†] โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’โ–’ ็ณŸ็ณ•๏ผŒๆ€ฅ้œ€ไฟฎๅค
       ๐Ÿ’ฌ ๅปบ่ฎฎ้‡ๆ–ฐๅญฆไน  Rust ๆœ€ไฝณๅฎž่ทต ๐ŸŽ“
   โœ“โœ“ ๐Ÿ—๏ธ ไปฃ็ ็ป“ๆž„ [  0ๅˆ†] โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’โ–’ ไผ˜็ง€๏ผŒ็ปง็ปญไฟๆŒ


๐Ÿ“ ่ฏ„ๅˆ†ๆ ‡ๅ‡† (ๅˆ†ๆ•ฐ่ถŠ้ซ˜ไปฃ็ ่ถŠ็ƒ‚)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
   ๐Ÿ’€ 81-100ๅˆ†: ็ณŸ็ณ•๏ผŒๆ€ฅ้œ€้‡ๅ†™    ๐Ÿ”ฅ 61-80ๅˆ†: ่พƒๅทฎ๏ผŒๅปบ่ฎฎ้‡ๆž„
   โš ๏ธ  41-60ๅˆ†: ไธ€่ˆฌ๏ผŒ้œ€่ฆๆ”น่ฟ›    โœ… 21-40ๅˆ†: ่‰ฏๅฅฝ๏ผŒ่ฟ˜ๆœ‰ๆๅ‡็ฉบ้—ด
   ๐ŸŒŸ 0-20ๅˆ†: ไผ˜็ง€๏ผŒ็ปง็ปญไฟๆŒ

็ปง็ปญๅŠชๅŠ›๏ผŒ่ฎฉไปฃ็ ๅ˜ๅพ—ๆ›ดๅฅฝ๏ผ๐Ÿš€

```

## ๐Ÿ› ๏ธ Command Line Options

| Option                | Short          | Description                                    |
| --------------------- | -------------- | ---------------------------------------------- |
| `--help`            | `-h`         | Show help message                              |
| `--verbose`         | `-v`         | Show detailed analysis report                  |
| `--top N`           | `-t N`       | Show top N files with most issues (default: 5) |
| `--issues N`        | `-i N`       | Show N issues per file (default: 5)            |
| `--summary`         | `-s`         | Only show summary conclusion                   |
| `--markdown`        | `-m`         | Output Markdown format report                  |
| `--lang LANG`       | `-l LANG`    | Output language (zh-CN, en-US)                 |
| `--exclude PATTERN` | `-e PATTERN` | Exclude file/directory patterns                |
| `--harsh`           |                | Show only the worst offenders                  |
| `--suggestions`     |                | Show suggestion for optimizing code            |
| `--educational`     |                | Show educational advice for each issue type    |
| `--hall-of-shame`   |                | Show hall of shame (worst files and patterns)  |

## ๐Ÿ”ง Development

### Prerequisites

- Rust 1.70 or later
- Cargo

### Building

```bash
# Debug build
make build

# Release build
make release

# Run tests
make test

# Format code
make fmt

# Run linter
make clippy
```

### Running Demo

```bash
make demo
```

This creates a sample file with intentionally bad code and runs the analyzer on it.

## ๐ŸŽฏ Examples

### CI/CD Integration

```yaml
# GitHub Actions example
- name: Code Quality Check
  run: |
    cargo install garbage-code-hunter
    garbage-code-hunter --markdown --lang en-US src/ > quality-report.md
    # Upload report as artifact or comment on PR
```

### Pre-commit Hook

```bash
#!/bin/bash
# .git/hooks/pre-commit
garbage-code-hunter --harsh --summary src/
if [ $? -ne 0 ]; then
    echo "Code quality issues detected. Please fix before committing."
    exit 1
fi
```

## ๐Ÿค Contributing

We welcome contributions! Here's how you can help:

1. **Add New Rules**: Implement additional code smell detection
2. **Language Support**: Add translations for more languages
3. **Improve Messages**: Make the roasts even funnier (but still helpful)
4. **Documentation**: Help improve docs and examples
5. **Bug Reports**: Found a bug? Let us know!

### Adding New Detection Rules

1. Create a new rule in `src/rules/`
2. Implement the `Rule` trait
3. Add humorous messages in `src/i18n.rs`
4. Add tests
5. Submit a PR!

## ๐Ÿ“ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ™ Acknowledgments

- Inspired by the need for more entertaining code reviews
- Built with โค๏ธ and a lot of โ˜•
- Thanks to all the developers who write garbage code (we've all been there!)

## ๐Ÿ”— Links

- [Documentation]https://docs.rs/garbage-code-hunter
- [Crates.io]https://crates.io/crates/garbage-code-hunter
- [GitHub Repository]https://github.com/TimWood0x10/garbage-code-hunter
- [Issue Tracker]https://github.com/TimWood0x10/garbage-code-hunter/issues

---

**Remember**: The goal isn't to shame developers, but to make code quality improvement fun and memorable. Happy coding! ๐Ÿš€