{"id":30682367,"url":"https://github.com/evilmartians/callback_hell","last_synced_at":"2025-11-11T18:16:34.315Z","repository":{"id":311931975,"uuid":"1045524218","full_name":"evilmartians/callback_hell","owner":"evilmartians","description":"Callback Hell is a Ruby gem that analyzes your Ruby on Rails application models and provides actionable insights on callbacks and validations. Use it to identify models that might benefit from refactoring, spot callback pollution from gems and associations, and keep your models clean and maintainable.","archived":false,"fork":false,"pushed_at":"2025-08-27T20:33:57.000Z","size":144,"stargazers_count":29,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-27T23:32:26.184Z","etag":null,"topics":["callbacks","profiling","refactoring","ruby","ruby-gem","ruby-on-rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evilmartians.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-27T10:04:01.000Z","updated_at":"2025-08-27T23:29:13.000Z","dependencies_parsed_at":"2025-08-27T23:32:38.244Z","dependency_job_id":"7e0de6e3-30c4-466d-8192-db0a170a2ba4","html_url":"https://github.com/evilmartians/callback_hell","commit_stats":null,"previous_names":["evilmartians/callback_hell"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/evilmartians/callback_hell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilmartians%2Fcallback_hell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilmartians%2Fcallback_hell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilmartians%2Fcallback_hell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilmartians%2Fcallback_hell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evilmartians","download_url":"https://codeload.github.com/evilmartians/callback_hell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilmartians%2Fcallback_hell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272864572,"owners_count":25006042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["callbacks","profiling","refactoring","ruby","ruby-gem","ruby-on-rails"],"created_at":"2025-09-01T18:06:10.774Z","updated_at":"2025-11-11T18:16:34.271Z","avatar_url":"https://github.com/evilmartians.png","language":"Ruby","readme":"[![Gem Version](https://badge.fury.io/rb/callback_hell.svg)](https://rubygems.org/gems/callback_hell) [![Build](https://github.com/evilmartians/callback_hell/workflows/Build/badge.svg)](https://github.com/evilmartians/callback_hell/actions)\n\n# Callback Hell\n\n\u003e You live in it.\n\nCallback Hell is a Ruby gem that analyzes your Ruby on Rails application models and provides actionable insights on callbacks and validations. Use it to identify models that might benefit from refactoring, spot callback pollution from gems and associations, and keep your models clean and maintainable.\n\n\u003ca href=\"https://evilmartians.com/?utm_source=callback_hell\"\u003e\n\u003cimg src=\"https://evilmartians.com/badges/sponsored-by-evil-martians.svg\" alt=\"Sponsored by Evil Martians\" width=\"236\" height=\"54\"\u003e\n\u003c/a\u003e\n\n## Why bother?\n\nAs Rails applications grow, callbacks can quickly spiral out of control. Callback Hell helps you:\n\n- **Visualize callback complexity** across your entire application\n- **Identify callback hotspots** that need refactoring attention\n- **Track callback origins**: distinguish your code from Rails internals and gem callbacks\n- **Spot inheritance issues** and understand callback propagation\n- **Audit conditional callbacks** that might be hiding bugs\n\n## Quick start\n\nAdd to your Rails application's `Gemfile`:\n\n```ruby\ngem \"callback_hell\", group: :development\n```\n\nAnd then:\n\n```bash\nbundle install\n```\n\n### Basic usage\n\nGenerate a complete analysis report (callbacks _and_ validations):\n\n```bash\nbin/rails ch\n```\n\nSample output:\n\n\u003cimg src=\"https://raw.githubusercontent.com/evilmartians/callback_hell/refs/heads/main/assets/report.png\" width=\"758\" height=\"767\" alt=\"Callback Hell sample output\"\u003e\n\nOr run specific reports:\n\n```bash\n# Just callbacks\nbin/rails ch:callbacks\n\n# Just validations\nbin/rails ch:validations\n```\n\n### Requirements\n\nWe support Ruby 3.0+ and Rails 7.0+.\n\n## Usage\n\n**Note:** you can use either `rake` or `bin/rails` as you wish.\n\n### Command line options\n\nAll rake tasks support the following options:\n\n#### Output formats\n\n```bash\n# Table format (default)\nbin/rails ch:callbacks format=table\n\n# Line format: detailed per-callback breakdown\nbin/rails ch:callbacks format=line\n\n# GitHub Actions format for CI/CD\nbin/rails ch:callbacks format=github\n```\n\n#### Model filtering\n\n```bash\n# Analyze specific model by class name\nbin/rails ch model=User\n\n# Or by file path\nbin/rails ch model=admin/user\n\n# Works with namespaced models too\nbin/rails ch model=Admin::User\n```\n\n#### Sorting\n\n```bash\n# Sort by callback count (default)\nbin/rails ch sort=total\n\n# Sort alphabetically\nbin/rails ch sort=name\n```\n\n#### Analysis modes\n\n```bash\n# Default mode: your callbacks only\nbin/rails ch mode=default\n\n# Full mode: includes Rails internals and associations\nbin/rails ch mode=full\n```\n\n#### Custom model paths\n\n```bash\n# Include models from engines or non-standard locations\nbin/rails ch path=engines/admin/app/models,lib/models\n```\n\n### Understanding the output\n\n#### Callback origins\n\n- **Own**: Callbacks defined in your application code\n- **Rails**: Built-in Rails framework callbacks\n- **Gems**: Callbacks from external gems\n- **Inherited**: Callbacks inherited from parent classes or modules\n\n#### Special Categories\n\n- **Conditional**: Callbacks with `:if` or `:unless` conditions\n- **Associations**: Auto-generated by Rails associations (`has_many`, `belongs_to`, etc.)\n- **Attributes**: Generated by Rails attribute features (encryption, normalization, etc.)\n\n### Integration with CI/CD\n\nYou can try the GitHub Actions format to integrate with your CI pipeline:\n\n```yaml\n# .github/workflows/callback_analysis.yml\nname: Callback Analysis\non: [push, pull_request]\n\njobs:\n  analyze:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - uses: ruby/setup-ruby@v1\n        with:\n          bundler-cache: true\n      - name: Analyze callbacks\n        run: bin/rails ch format=github\n```\n\n## Credits and acknowledgements\n\nCallback Hell is supposed to be a spiritual successor of the [arca](https://github.com/jonmagic/arca) gem by [Jonathan Hoyt](https://github.com/jonmagic).\n\nThe entire idea and a detailed specification for the gem were done by [Vladimir Dementyev](https://github.com/palkan) who initially offered it as a Ruby developer candidate take-home task for [Evil Martians](https://evilmartians.com/?utm_source=callback_hell).\n\nShout-out to [Adam Doppelt](https://github.com/gurgeous) for [table_tennis](https://github.com/gurgeous/table_tennis) that we use for formatting tables.\n\n## Contributing\n\nBug reports and pull requests are welcome at [https://github.com/evilmartians/callback_hell](https://github.com/evilmartians/callback_hell).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilmartians%2Fcallback_hell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevilmartians%2Fcallback_hell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilmartians%2Fcallback_hell/lists"}