{"id":21824325,"url":"https://github.com/shopify/spoom","last_synced_at":"2025-05-14T12:11:24.541Z","repository":{"id":37439153,"uuid":"277845495","full_name":"Shopify/spoom","owner":"Shopify","description":"Useful tools for Sorbet enthusiasts","archived":false,"fork":false,"pushed_at":"2025-04-07T22:05:32.000Z","size":11803,"stargazers_count":233,"open_issues_count":6,"forks_count":22,"subscribers_count":256,"default_branch":"main","last_synced_at":"2025-04-11T05:09:12.256Z","etag":null,"topics":["coverage","lsp","sorbet","typing"],"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/Shopify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-07T14:53:11.000Z","updated_at":"2025-04-09T03:37:33.000Z","dependencies_parsed_at":"2023-02-13T03:45:57.273Z","dependency_job_id":"161307c6-e950-4c06-b696-538c1ae3419c","html_url":"https://github.com/Shopify/spoom","commit_stats":{"total_commits":916,"total_committers":39,"mean_commits":"23.487179487179485","dds":0.415938864628821,"last_synced_commit":"65f6c8ca7aaf3d4b4f8b961ec9a29702230a077a"},"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Fspoom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Fspoom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Fspoom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Fspoom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shopify","download_url":"https://codeload.github.com/Shopify/spoom/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345266,"owners_count":21088244,"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":["coverage","lsp","sorbet","typing"],"created_at":"2024-11-27T17:57:32.046Z","updated_at":"2025-04-11T05:09:19.089Z","avatar_url":"https://github.com/Shopify.png","language":"Ruby","readme":"# Spoom\n\nUseful tools for Sorbet enthusiasts.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'spoom'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install spoom\n\n## Usage\n\n`spoom` provides both a CLI and an API to interact with Sorbet.\n\n### Generate a typing coverage report\n\nSpoom can create a typing coverage report from Sorbet and Git data:\n\n![Coverage Report](docs/report.png)\n\nAfter installing the `spoom` gem, run the `timeline` command to collect the history data:\n\n```\n$ spoom srb coverage timeline --save\n```\n\nThen create the HTML page with `report`:\n\n```\n$ spoom srb coverage report\n```\n\nYour report will be generated under `spoom_report.html`.\n\nSee all the [Typing Coverage](#typing-coverage) CLI commands for more details.\n\n### Command Line Interface\n\n#### Errors sorting and filtering\n\nList all typechecking errors sorted by location:\n\n```\n$ spoom srb tc -s loc\n```\n\nList all typechecking errors sorted by error code first:\n\n```\n$ spoom srb tc -s code\n```\n\nList only typechecking errors from a specific error code:\n\n```\n$ spoom srb tc -c 7004\n```\n\nList only the first 10 typechecking errors\n\n```\n$ spoom srb tc -l 10\n```\n\nThese options can be combined:\n\n```\n$ spoom srb tc -s -c 7004 -l 10\n```\n\nRemove duplicated error lines:\n\n```\n$ spoom srb tc -u\n```\n\nFormat each error line:\n\n```\n$ spoom srb tc -f '%C - %F:%L: %M'\n```\n\nWhere:\n\n* `%C` is the error code\n* `%F` is the file the error is from\n* `%L` is the line the error is from\n* `%M` is the error message\n\nHide the `Errors: X` at the end of the list:\n\n```\n$ spoom srb tc --no-count\n```\n\nList only the errors coming from specific directories or files:\n\n```\n$ spoom srb tc file1.rb path1/ path2/\n```\n\n#### Typing coverage\n\nShow metrics about the project contents and the typing coverage:\n\n```\n$ spoom srb coverage\n```\n\nSave coverage data under `spoom_data/`:\n\n```\n$ spoom srb coverage --save\n```\n\nSave coverage data under a specific directory:\n\n```\n$ spoom srb coverage --save my_data/\n```\n\nShow typing coverage evolution based on the commits history:\n\n```\n$ spoom srb coverage timeline\n```\n\nShow typing coverage evolution based on the commits history between specific dates:\n\n```\n$ spoom srb coverage timeline --from YYYY-MM-DD --to YYYY-MM-DD\n```\n\nSave the typing coverage evolution as JSON under `spoom_data/`:\n\n```\n$ spoom srb coverage timeline --save\n```\n\nSave the typing coverage evolution as JSON in a specific directory:\n\n```\n$ spoom srb coverage timeline --save my_data/\n```\n\nRun `bundle install` for each commit of the timeline (may solve errors due to different Sorbet versions):\n\n```\n$ spoom srb coverage timeline --bundle-install\n```\n\nGenerate an HTML typing coverage report:\n\n```\n$ spoom srb coverage report\n```\n\nChange the colors used for strictnesses (useful for colorblind folks):\n\n```\n$ spoom srb coverage report \\\n  --color-true \"#648ffe\" \\\n  --color-false \"#fe6002\" \\\n  --color-ignore \"#feb000\" \\\n  --color-strict \"#795ef0\" \\\n  --color-strong \"#6444f1\"\n```\n\nOpen the HTML typing coverage report:\n\n```\n$ spoom srb coverage open\n```\n\n#### Change the sigil used in files\n\nBump the strictness from all files currently at `typed: false` to `typed: true` where it does not create typechecking errors:\n\n```\n$ spoom srb bump --from false --to true\n```\n\nBump the strictness from all files currently at `typed: false` to `typed: true` even if it creates typechecking errors:\n\n```\n$ spoom srb bump --from false --to true -f\n```\n\nBump the strictness from a list of files (one file by line):\n\n```\n$ spoom srb bump --from false --to true -o list.txt\n```\n\nCheck if files can be bumped without applying any change and show the list of files that can be bumped without errors.\nWill exit with a non-zero status if some files can be bumped without errors (useful to check for bumpable files on CI for example):\n\n```\n$ spoom srb bump --from false --to true --dry\n```\n\nBump files using a custom instance of Sorbet:\n\n```\n$ spoom srb bump --from false --to true --sorbet /path/to/sorbet/bin\n```\n\nCount the number of type-checking errors if all files were bumped to true:\n\n```\n$ spoom srb bump --count-errors --dry\n```\n\n#### Translate sigs between RBI and RBS\n\nTranslate all file sigs from RBI to RBS:\n\n```\n$ spoom srb sigs translate\n```\n\nTranslate one file's sigs from RBS to RBI:\n\n```\n$ spoom srb sigs translate --from rbs --to rbi /path/to/file.rb\n```\n\n#### Interact with Sorbet LSP mode\n\n**Experimental**\n\nFind all definitions for `Foo`:\n\n```\n$ spoom srb lsp find Foo\n```\n\nList all symbols in a file:\n\n```\n$ spoom srb lsp symbols \u003cfile.rb\u003e\n```\n\nList all definitions for a specific code location:\n\n```\n$ spoom srb lsp defs \u003cfile.rb\u003e \u003cline\u003e \u003ccolumn\u003e\n```\n\nList all references for a specific code location:\n\n```\n$ spoom srb lsp refs \u003cfile.rb\u003e \u003cline\u003e \u003ccolumn\u003e\n```\n\nShow hover information for a specific code location:\n\n```\n$ spoom srb lsp hover \u003cfile.rb\u003e \u003cline\u003e \u003ccolumn\u003e\n```\n\nShow signature information for a specific code location:\n\n```\n$ spoom srb lsp sig \u003cfile.rb\u003e \u003cline\u003e \u003ccolumn\u003e\n```\n\nShow type information for a specific code location:\n\n```\n$ spoom srb lsp sig \u003cfile.rb\u003e \u003cline\u003e \u003ccolumn\u003e\n```\n\n### API\n\n#### Parsing Sorbet config\n\nParses a Sorbet config file:\n\n```ruby\nconfig = Spoom::Sorbet::Config.parse_file(\"sorbet/config\")\nputs config.paths   # \".\"\n```\n\nParses a Sorbet config string:\n\n```ruby\nconfig = Spoom::Sorbet::Config.parse_string(\u003c\u003c~CONFIG)\n  a\n  --file=b\n  --ignore=c\nCONFIG\nputs config.paths   # \"a\", \"b\"\nputs config.ignore  # \"c\"\n```\n\nList all files typchecked by Sorbet:\n\n```ruby\nconfig = Spoom::Sorbet::Config.parse_file(\"sorbet/config\")\nputs Spoom::Sorbet.srb_files(config)\n```\n\n#### Parsing Sorbet metrics\n\nDisplay metrics collected during typechecking:\n\n```ruby\nputs Spoom::Sorbet.srb_metrics(capture_err: false)\n```\n\n#### Interacting with LSP\n\nCreate an LSP client:\n\n```rb\nclient = Spoom::LSP::Client.new(\n  Spoom::Sorbet::BIN_PATH,\n  \"--lsp\",\n  \"--enable-all-experimental-lsp-features\",\n  \"--disable-watchman\",\n)\nclient.open(\".\")\n```\n\nFind all the symbols matching a string:\n\n```rb\nputs client.symbols(\"Foo\")\n```\n\nFind all the symbols for a file:\n\n```rb\nputs client.document_symbols(\"file://path/to/my/file.rb\")\n```\n\n### Backtrace Filtering\n\nSpoom provides a backtrace filter for Minitest to remove the Sorbet frames from test failures, giving a more readable output. To enable it:\n\n```ruby\n# test/test_helper.rb\nrequire \"spoom/backtrace_filter/minitest\"\nMinitest.backtrace_filter = Spoom::BacktraceFilter::Minitest.new\n```\n\n### Dead code removal\n\nRun dead code detection in your project with:\n\n```\n$ spoom deadcode\n```\n\nThis will list all the methods and constants that do not appear to be used in your project.\n\nYou can remove them with Spoom:\n\n```\n$ spoom deadcode remove path/to/file.rb:42:18-47:23\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Don't forget to run `bin/sanity` before pushing your changes.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/Shopify/spoom. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Spoom project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Shopify/spoom/blob/main/CODE_OF_CONDUCT.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshopify%2Fspoom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshopify%2Fspoom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshopify%2Fspoom/lists"}