| Crates.io | garbage-code-hunter |
| lib.rs | garbage-code-hunter |
| version | 0.1.2 |
| created_at | 2025-07-26 02:40:33.354032+00 |
| updated_at | 2025-07-27 06:42:01.727918+00 |
| description | A humorous Rust code quality detector that roasts your garbage code |
| homepage | |
| repository | https://github.com/TimWood0x10/garbage-code-hunter |
| max_upload_size | |
| id | 1768670 |
| size | 484,545 |
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).
foo, bar, data, tempstrName, intCountmgr, ctrl, usr, pwd&str should be used instead of Stringif letOur 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! ๐๏ธ
Garbage Code Hunter includes a comprehensive scientific scoring system that evaluates your Rust code quality on a scale of 0-100, where:
| 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 |
The scoring system uses a multi-factor algorithm that considers:
Each detected issue contributes to the base score using:
Issue Score = Rule Weight ร Severity Weight
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 |
Issues are classified by severity with corresponding multipliers:
Additional penalties based on issue concentration:
Issue Density: Problems per 1000 lines of code
File Complexity: Average issues per file
Extra penalties for problematic patterns:
The scoring system provides detailed metrics:
For Excellent Code (0-20):
For Good Code (21-40):
For Average Code (41-60):
For Poor Code (61-80):
For Terrible Code (81-100):
The scoring system is designed to be:
data, temp, info, obj)unwrap() abuse (panic bombs ๐ฃ)clone() calls (memory waste)git clone https://github.com/yourusername/garbage-code-hunter.git
cd garbage-code-hunter
make install
cargo install garbage-code-hunter
# 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
# Chinese output (default)
garbage-code-hunter --lang zh-CN src/
# English output
garbage-code-hunter --lang en-US src/
# 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/
# 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)Provides detailed explanations for each detected issue:
--hall-of-shame)Shows comprehensive project statistics:
--suggestions)Generates intelligent, data-driven recommendations:
๐๏ธ 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! ๐
๐๏ธ ๅๅพไปฃ็ ็ไบบ ๐๏ธ
ๆญฃๅจๅๅคๅๆงฝไฝ ็ไปฃ็ ...
๐ ๅๅพไปฃ็ ๆฃๆตๆฅๅ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
ๅ็ฐไบไธไบ้่ฆๆน่ฟ็ๅฐๆน๏ผ
๐ ้ฎ้ข็ป่ฎก:
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ๅ: ไผ็ง๏ผ็ปง็ปญไฟๆ
็ปง็ปญๅชๅ๏ผ่ฎฉไปฃ็ ๅๅพๆดๅฅฝ๏ผ๐
| 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) |
# Debug build
make build
# Release build
make release
# Run tests
make test
# Format code
make fmt
# Run linter
make clippy
make demo
This creates a sample file with intentionally bad code and runs the analyzer on it.
# 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
#!/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
We welcome contributions! Here's how you can help:
src/rules/Rule traitsrc/i18n.rsThis project is licensed under the MIT License - see the LICENSE file for details.
Remember: The goal isn't to shame developers, but to make code quality improvement fun and memorable. Happy coding! ๐