# Garbage Code Hunter ๐๏ธ - VS Code Extension
A humorous Rust code quality detector that roasts your garbage code with style! This VS Code extension provides real-time analysis of your Rust code, highlighting potential issues with witty and educational feedback.
## โจ Features
- ๐ **Real-time Analysis**: Automatically analyze your Rust files on save
- ๐ญ **Humorous Feedback**: Get roasted with style while learning better coding practices
- ๐ **Visual Diagnostics**: Issues highlighted directly in your editor with inline messages
- ๐ **Multi-language Support**: Available in English and Chinese
- โก **ErrorLens-style Display**: Inline messages show issues right next to your code
- ๐ฏ **Contextual Actions**: Right-click to analyze specific files
- ๐ **Workspace Analysis**: Analyze your entire project at once
- ๐ค **LLM-Powered Roasts**: Generate creative roasts using local LLMs (Ollama/OpenAI-compatible)
- ๐ **Quality Score**: View code quality score with detailed category breakdown
- ๐ **Educational Mode**: Get explanations and fix suggestions for detected issues
- ๐ง **Highly Configurable**: Customize language, display options, and LLM settings
## ๐ Quick Start
### Prerequisites
1. Install the `garbage-code-hunter` CLI tool:
```bash
cargo install garbage-code-hunter
```
2. Make sure the CLI tool is available in your PATH:
```bash
garbage-code-hunter --version
```
### Installation
1. Install this extension from the VS Code marketplace
2. Open a Rust project
3. Save a `.rs` file to trigger automatic analysis
4. Watch the magic happen! ๐ญ
## ๐ Usage
### Automatic Analysis
- **On Save**: Files are automatically analyzed when you save them
- **Real-time Feedback**: Issues appear in the Problems panel and inline in your editor
- **Visual Indicators**: Different colors for different severity levels
### Manual Analysis
- **Current File**: Right-click โ "๐๏ธ Roast This File"
- **Entire Workspace**: Command Palette โ "๐ฅ Roast Entire Workspace"
- **Quality Score**: Command Palette โ "๐ Show Quality Score"
- **Educational Advice**: Command Palette โ "๐ Show Educational Advice"
- **Clear Results**: Command Palette โ "๐งน Clear All Roasts"
### Inline Messages (ErrorLens-style)
Issues are displayed inline next to your code with:
- ๐ด **Nuclear** issues (errors) - Red text
- ๐ **Spicy** issues (warnings) - Orange text
- ๐ต **Mild** issues (info) - Blue text
## โ๏ธ Configuration
Access settings via: File โ Preferences โ Settings โ Extensions โ Garbage Code Hunter
```json
{
// Enable/disable real-time analysis
"garbageHunter.enableRealTimeAnalysis": true,
// Language for roast messages
"garbageHunter.language": "en-US", // en-US, zh-CN, auto
// Show inline messages like ErrorLens
"garbageHunter.showInlineMessages": true,
// Maximum length of inline messages
"garbageHunter.maxInlineMessageLength": 100,
// File patterns to exclude from analysis
"garbageHunter.excludePatterns": [
"**/target/**",
"**/node_modules/**",
"**/.git/**"
],
// LLM-powered roasts (requires Ollama or OpenAI-compatible API)
"garbageHunter.llm.enabled": false,
"garbageHunter.llm.provider": "ollama",
"garbageHunter.llm.model": "gemma4:e2b",
"garbageHunter.llm.endpoint": "",
"garbageHunter.llm.apiKey": ""
}
```
## ๐ค LLM Integration
Enable LLM-powered roast generation for creative, context-aware feedback:
1. Install and start [Ollama](https://ollama.com):
```bash
ollama pull gemma4:e2b
```
2. Enable LLM in VS Code settings:
```json
{
"garbageHunter.llm.enabled": true,
"garbageHunter.llm.model": "gemma4:e2b"
}
```
3. Use `--markdown` mode in the CLI for best LLM roast display
**Supported providers:**
- Ollama (default: `http://localhost:11434`)
- Any OpenAI-compatible API (LM Studio, vLLM, etc.)
## ๐ฏ Detection Features
### ๐ Naming Issues
- Meaningless variable names (`foo`, `bar`, `data`, `temp`)
- Hungarian notation (`strName`, `intCount`)
- Excessive abbreviations (`mgr`, `ctrl`, `usr`)
### ๐ง Code Complexity
- Deep nesting (>5 levels)
- Long functions
- God functions doing too much
### ๐ฆ Rust-Specific Issues
- Unwrap abuse
- Unnecessary clones
- String vs &str misuse
### ๐ Student Code Patterns
- Printf debugging (`println!` everywhere)
- Panic abuse
- TODO comment overload
## ๐ง Commands
| `garbageHunter.analyzeFile` | ๐๏ธ Roast This File |
| `garbageHunter.analyzeWorkspace` | ๐ฅ Roast Entire Workspace |
| `garbageHunter.clearDiagnostics` | ๐งน Clear All Roasts |
| `garbageHunter.showScore` | ๐ Show Quality Score |
| `garbageHunter.showEducational` | ๐ Show Educational Advice |
## ๐ญ Example Roasts
```rust
// Your code:
let data = get_user_info();
// Garbage Hunter says:
๐๏ธ Variable name 'data' is more meaningless than my existence
```
```rust
// Your code:
user.unwrap().name.unwrap()
// Garbage Hunter says:
๐๏ธ This unwrap() chain is more dangerous than a toddler with scissors
```
### LLM-Generated Roasts (with Ollama)
```
๐๏ธ Nesting so deep, trying to dig to the Earth's core? That's not structure, that's a geological fault line.
๐๏ธ Variable 'value' - congrats on inventing the most meaningless identifier
๐๏ธ Copy-paste ninja detected! 23 identical lines found. You've duplicated logic instead of abstracting it.
```
## ๐ Known Issues
- Large workspaces may take some time to analyze
- Requires the CLI tool to be installed separately
- Analysis is currently limited to Rust files only
- LLM roasts require a running Ollama instance or OpenAI-compatible API
## ๐ Release Notes
### 0.2.0
- Added LLM-powered roast generation (Ollama / OpenAI-compatible)
- Added quality score display command
- Added educational advice command
- Updated all comments to English
- Updated license to Apache 2.0
- Updated dependencies to latest versions
### 0.1.0
- Initial release
- Real-time analysis on file save
- Inline message display (ErrorLens-style)
- Workspace analysis
- Configurable language and display options
- Problems panel integration
## ๐ License
Apache License 2.0 - see [LICENSE](https://github.com/TimWood0x10/garbage-code-hunter/blob/main/LICENSE) for details.
---
**Enjoy roasting your code!** ๐๏ธ๐ฅ
*Remember: We roast your code, not you. It's all about learning and having fun while writing better code!*