A brutally honest code reviewer that roasts your code with love
Project description
roast-my-code
A brutally honest code reviewer that roasts your code with love.
Because sometimes your code needs tough love. And by tough love, we mean merciless roasting.
Installation
pip install roast-my-code
Usage
Basic roasting
# Roast current directory
roast .
# Roast a specific file
roast myfile.py
# Roast a specific directory
roast src/
Severity levels
# Gentle mode - for sensitive souls
roast --gentle .
# Normal mode (default)
roast .
# Savage mode - no mercy
roast --savage .
Output formats
# Regular output with colors
roast .
# JSON output for CI/CD
roast --json .
# No colors
roast --no-color .
# Skip ASCII art
roast --quiet .
What it detects and roasts
Variable Naming
- Single-letter variables (
x = 5) - Generic names (
data,stuff,thing) - Shadowed builtins (
list = []) - Temp variables that aren't temporary
Functions
- Functions over 50 lines
- Functions with 6+ parameters
- Missing docstrings
- Deeply nested code (4+ levels)
Comments
- Obvious comments (
# increment i) - Stale TODOs from years ago
- Commented-out code
- Passive-aggressive comments
Security
- SQL injection patterns
- Command injection risks
- Hardcoded passwords
- eval/exec with user input
Code Smells
- God classes (20+ methods)
- Star imports (
from x import *) - Bare except clauses
- Mutable default arguments
Style
- Lines over 100 characters
- Trailing whitespace
- No type hints
Example output
____ _ __ __ ____ _
| _ \ ___ __ _ ___| |_ | \/ |_ _ / ___|___ __| | ___
| |_) / _ \ / _` / __| __| | |\/| | | | | | | / _ \ / _` |/ _ \
| _ < (_) | (_| \__ \ |_ | | | | |_| | | |__| (_) | (_| | __/
|_| \_\___/ \__,_|___/\__| |_| |_|\__, | \____\___/ \__,_|\___|
|___/
Roasting directory: src/...
src/utils.py
------------
Line 5: 'x'? What is this, algebra class? We're programming here.
Line 23: This function is 87 lines long. That's not a function, that's a novel.
Line 45: from module import * - congratulations, you've imported everything and understood nothing
src/main.py
-----------
Line 12: except: pass? You're silently ignoring errors. Bold strategy.
Line 34: # TODO from 2019? That's not a todo, that's a fossil.
============================================================
ROAST SUMMARY
============================================================
Total roasts: 5
Files roasted: 2
By category:
variables: 1
functions: 1
imports: 1
exceptions: 1
comments: 1
Verdict: Not bad! Only a few roasts. You're doing better than most.
Python API
from roast_my_code import CodeAnalyzer, Roaster
# Analyze code
analyzer = CodeAnalyzer()
issues = analyzer.analyze_file('myfile.py')
issues = analyzer.analyze_directory('src/')
# Roast code
roaster = Roaster(severity='savage')
roasts = roaster.roast_file('myfile.py')
roaster.print_roasts(roasts)
# Get summary
summary = roaster.get_summary(roasts)
print(f"Total roasts: {summary['total']}")
print(f"Verdict: {summary['verdict']}")
Exit codes
0- No issues or minor issues (<10 roasts)1- Notable issues (10-29 roasts)2- Significant issues (30+ roasts)
Use in CI:
roast --json . || echo "Code needs work!"
Contributing roasts
Have a good roast? The roast library lives in roast_my_code/roasts/. Each category has its own file with hundreds of roasts.
License
MIT - Roast freely.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file roast_my_code-1.0.0.tar.gz.
File metadata
- Download URL: roast_my_code-1.0.0.tar.gz
- Upload date:
- Size: 75.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee714e7be09006d8b02fa98b64340900626e02e9543d6798e597c9c0d3559cb6
|
|
| MD5 |
00a1d57ee5c2951ab746426f90b2ab52
|
|
| BLAKE2b-256 |
321b1ef08820ccc47ecb3cd4e6226f7845914100828cfdbf490ec43f3ac5576a
|
File details
Details for the file roast_my_code-1.0.0-py3-none-any.whl.
File metadata
- Download URL: roast_my_code-1.0.0-py3-none-any.whl
- Upload date:
- Size: 86.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef4626ad438eff58b6b6b90ce58986b4de3cc7bd08487005025434f5f3f603df
|
|
| MD5 |
45bd52bb74af82fda62aea35f1cff00d
|
|
| BLAKE2b-256 |
e85c89fcbef3292a456e629fee61bbee4fd8514161bed1ee584c957f0fe7743d
|