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.
Support
If this tool made you laugh (or cry), consider supporting:
License
MIT - Roast freely.
Metadata
Release files for roast-my-code 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| roast_my_code-1.0.1.tar.gz | 75.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| roast_my_code-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 161.6 kB
Release files / roast_my_code-1.0.1.tar.gz
| Download URL | roast_my_code-1.0.1.tar.gz |
|---|---|
| Size | 75.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e5ae3a032535c527557e0946ad2019c53b3d5c707de2059e6902bc5c240bcd9
|
|
BLAKE2b-256 checksum How to use checksums |
66420a70ec0c608c772258e9674a5f83accab3368940ef63d5cafb86702d8a39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / roast_my_code-1.0.1-py3-none-any.whl
| Download URL | roast_my_code-1.0.1-py3-none-any.whl |
|---|---|
| Size | 86.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe97aa44fa40bc45d3fc543e84662afff41fbd51958398444d6587ce1b67c532
|
|
BLAKE2b-256 checksum How to use checksums |
cbf35e8d4bdd7e8fb1078fb83b36d64919a7a2da8704031a548bd7603455bc40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|