{"id":28554972,"url":"https://github.com/patrick204nqh/class-metrix","last_synced_at":"2025-06-13T08:02:07.331Z","repository":{"id":297754452,"uuid":"997783646","full_name":"patrick204nqh/class-metrix","owner":"patrick204nqh","description":"Extracts and compares class behaviors (constants, class methods, and more) across multiple classes, generating clean markdown reports for analysis, documentation, and compliance auditing.","archived":false,"fork":false,"pushed_at":"2025-06-07T09:13:55.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-07T09:17:46.191Z","etag":null,"topics":["metrix","ruby"],"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/patrick204nqh.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-06-07T07:06:49.000Z","updated_at":"2025-06-07T09:13:27.000Z","dependencies_parsed_at":"2025-06-07T09:17:50.097Z","dependency_job_id":"aae55c58-029e-4a09-8f12-40decc7687c7","html_url":"https://github.com/patrick204nqh/class-metrix","commit_stats":null,"previous_names":["patrick204nqh/class-metrix"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick204nqh%2Fclass-metrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick204nqh%2Fclass-metrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick204nqh%2Fclass-metrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick204nqh%2Fclass-metrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrick204nqh","download_url":"https://codeload.github.com/patrick204nqh/class-metrix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick204nqh%2Fclass-metrix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":258810559,"owners_count":22761450,"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","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":["metrix","ruby"],"created_at":"2025-06-10T05:07:27.680Z","updated_at":"2025-06-11T06:02:17.692Z","avatar_url":"https://github.com/patrick204nqh.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ClassMetrix\n\n[![Gem Version](https://badge.fury.io/rb/class-metrix.svg)](https://badge.fury.io/rb/class-metrix)\n[![CI](https://github.com/patrick204nqh/class-metrix/actions/workflows/main.yml/badge.svg)](https://github.com/patrick204nqh/class-metrix/actions/workflows/main.yml)\n[![Documentation](https://img.shields.io/badge/docs-rubydoc.info-blue.svg)](https://rubydoc.info/gems/class-metrix)\n[![Code Coverage](https://qlty.sh/badges/df5bf564-68c2-4484-84bd-70f705e58f1b/test_coverage.svg)](https://qlty.sh/gh/patrick204nqh/projects/class-metrix)\n[![Maintainability](https://qlty.sh/badges/df5bf564-68c2-4484-84bd-70f705e58f1b/maintainability.svg)](https://qlty.sh/gh/patrick204nqh/projects/class-metrix)\n\n**ClassMetrix** is a Ruby gem that extracts and compares class behaviors (constants, class methods, and more) across multiple classes, generating clean markdown reports for analysis, documentation, and compliance auditing.\n\n\u003e **Why \"Metrix\"?** Short for \"metrics\" - measuring and analyzing class behaviors.\n\n## ✨ Features\n\n- **🔍 Multi-Type Extraction**: Constants, class methods, and more\n- **🏗️ Comprehensive by Default**: Includes inheritance and modules automatically\n- **🎯 Flexible Scanning**: Use `strict()` for class-only or `with_private()` for private members\n- **📊 Hash Expansion**: Expand hash values into readable sub-rows\n- **📝 Rich Reports**: Professional markdown and CSV output with full configuration\n- **🔒 Type Safe**: Full RBS type annotations with Steep type checking\n\n## 🚀 Quick Start\n\n### Installation\n\n```ruby\ngem 'class-metrix'\n```\n\n### Basic Usage\n\n```ruby\n# Extract constants from multiple classes (comprehensive by default)\nClassMetrix.extract(:constants)\n  .from([User, Admin, Guest])\n  .to_markdown\n\n# Class-only scanning (exclude inheritance \u0026 modules)\nClassMetrix.extract(:constants)\n  .from([User, Admin, Guest])\n  .strict\n  .to_markdown\n\n# Advanced example with multiple features\nClassMetrix.extract(:constants, :class_methods)\n  .from([DatabaseConfig, RedisConfig, S3Config])\n  .with_private\n  .filter(/config$/)\n  .expand_hashes\n  .handle_errors\n  .to_markdown(\"audit_report.md\",\n    title: \"Service Configuration Audit\",\n    show_missing_summary: true\n  )\n```\n\n## 📖 API Reference\n\n### Core Methods\n\n- **`.extract(types)`** - Extract constants, class_methods, or both\n- **`.from(classes)`** - Specify which classes to analyze\n- **`.strict`** - Class-only scanning (exclude inheritance \u0026 modules)\n- **`.with_private`** - Include private methods and constants\n- **`.filter(patterns)`** - Filter behaviors by regex patterns\n- **`.expand_hashes`** - Expand hash values into sub-rows\n- **`.handle_errors`** - Graceful error handling\n- **`.debug(level)`** - Enable debug logging (`:basic`, `:detailed`, `:verbose`)\n\n### Output Formats\n\n```ruby\n# Markdown output\n.to_markdown(\"report.md\", title: \"Custom Title\", footer_style: :detailed)\n\n# CSV output\n.to_csv(\"data.csv\", flatten_hashes: true, separator: \";\")\n```\n\n## 🎯 Common Use Cases\n\n### Configuration Audit\n\n```ruby\n# Compare configuration across microservices\nservices = [DatabaseService, RedisService, S3Service]\n\nClassMetrix.extract(:constants, :class_methods)\n  .from(services)\n  .filter(/CONFIG/, /timeout/)\n  .expand_hashes\n  .to_markdown(\"microservices_audit.md\")\n```\n\n### API Compatibility Check\n\n```ruby\n# Check API compatibility across versions\napis = [V1::UsersAPI, V2::UsersAPI, V3::UsersAPI]\n\nClassMetrix.extract(:class_methods)\n  .from(apis)\n  .filter(/^endpoint_/, /^validate_/)\n  .handle_errors\n  .to_markdown(\"api_compatibility.md\", show_missing_summary: true)\n```\n\n### Policy Comparison\n\n```ruby\n# Compare authorization policies\nClassMetrix.extract(:constants)\n  .from([UserPolicy, AdminPolicy, ModeratorPolicy])\n  .filter(/^PERMISSION_/, /^ROLE_/)\n  .to_markdown(\"policy_comparison.md\")\n```\n\n## 📚 Documentation\n\n- **[Examples](examples/)** - Comprehensive usage examples\n- **[Configuration Guide](docs/CONFIGURATION.md)** - Detailed configuration options\n- **[Architecture](docs/ARCHITECTURE.md)** - Technical architecture overview\n- **[Changelog](CHANGELOG.md)** - Version history and changes\n\n## 🧪 Development\n\n```bash\n# Clone and setup\ngit clone https://github.com/patrick204nqh/class-metrix.git\ncd class-metrix\nbundle install\n\n# Run tests and type checking\nbundle exec rspec\nbundle exec steep check\nbundle exec rubocop\n```\n\n## 📋 Requirements\n\n- **Ruby 3.1+** (Required for full RBS and Steep support)\n- **No runtime dependencies** (Pure Ruby implementation)\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -am 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis gem is available as open source under the terms of the [MIT License](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrick204nqh%2Fclass-metrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrick204nqh%2Fclass-metrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrick204nqh%2Fclass-metrix/lists"}