Skip to main content

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.

Support

If this tool made you laugh (or cry), consider supporting:

Ko-fi

Buy Me A Coffee

License

MIT - Roast freely.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

roast_my_code-1.0.1.tar.gz (75.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

roast_my_code-1.0.1-py3-none-any.whl (86.1 kB view details)

Uploaded Python 3

File details

Details for the file roast_my_code-1.0.1.tar.gz.

File metadata

  • Download URL: roast_my_code-1.0.1.tar.gz
  • Upload date:
  • Size: 75.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for roast_my_code-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2e5ae3a032535c527557e0946ad2019c53b3d5c707de2059e6902bc5c240bcd9
MD5 1f21827fa3e31772fcbae7e3272ebf87
BLAKE2b-256 66420a70ec0c608c772258e9674a5f83accab3368940ef63d5cafb86702d8a39

See more details on using hashes here.

File details

Details for the file roast_my_code-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: roast_my_code-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 86.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for roast_my_code-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe97aa44fa40bc45d3fc543e84662afff41fbd51958398444d6587ce1b67c532
MD5 a074916cc74a250972de353de5372ca0
BLAKE2b-256 cbf35e8d4bdd7e8fb1078fb83b36d64919a7a2da8704031a548bd7603455bc40

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page