{"id":13500082,"url":"https://github.com/fohte/rubocop-daemon","last_synced_at":"2025-03-29T05:32:56.223Z","repository":{"id":40775696,"uuid":"127655542","full_name":"fohte/rubocop-daemon","owner":"fohte","description":"Makes RuboCop faster","archived":false,"fork":false,"pushed_at":"2023-12-28T15:33:52.000Z","size":73,"stargazers_count":227,"open_issues_count":20,"forks_count":26,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-23T21:11:36.129Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/fohte.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2018-04-01T17:35:47.000Z","updated_at":"2025-03-06T12:37:27.000Z","dependencies_parsed_at":"2024-01-13T20:56:57.805Z","dependency_job_id":"55bc5040-afdf-4b73-921c-77e03a5a0029","html_url":"https://github.com/fohte/rubocop-daemon","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fohte%2Frubocop-daemon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fohte%2Frubocop-daemon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fohte%2Frubocop-daemon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fohte%2Frubocop-daemon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fohte","download_url":"https://codeload.github.com/fohte/rubocop-daemon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246145012,"owners_count":20730494,"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":[],"created_at":"2024-07-31T22:00:50.992Z","updated_at":"2025-03-29T05:32:51.819Z","avatar_url":"https://github.com/fohte.png","language":"Ruby","funding_links":[],"categories":["Developer Tools","Ruby"],"sub_categories":["Ruby"],"readme":"# rubocop-daemon\n\n[![Gem](https://img.shields.io/gem/v/rubocop-daemon.svg)](https://rubygems.org/gems/rubocop-daemon)\n\n`rubocop-daemon` makes RuboCop faster.\n\n## Installation\n\nInstall `rubocop-daemon` via rubygems.org:\n\n```sh\ngem install rubocop-daemon\n```\n\nor if you install RuboCop using bundler, put this in your `Gemfile`:\n\n```ruby\ngem 'rubocop-daemon', require: false\n```\n\n## Usage\n\nTo start the server, just run:\n\n```sh\nrubocop-daemon start\n```\n\nThen you can execute RuboCop fast:\n\n```sh\nrubocop-daemon exec\n```\n\nAnd you can pass files:\n\n```sh\nrubocop-daemon exec foo.rb bar.rb\n```\n\nIf you want to pass arguments to RuboCop, you should separate arguments by `--`:\n\n```sh\nrubocop-daemon exec -- --auto-correct\n```\n\n## Commands\n\nYou can control the server like this:\n\n```\nrubocop-daemon \u003ccommand\u003e\n```\n\nAvailable commands:\n\n- `start`: start the server\n- `stop`: stop the server\n- `status`: print out whether the server is currently running\n- `restart`: restart the server\n- `exec [file1, file2, ...] [-- [rubocop-options]]`: invoke `rubocop` with the given `rubocop-options`\n\n## More speed\n\n`rubocop-daemon-wrapper` is a bash script that talks to the `rubocop-daemon` server via `netcat`. This provides much lower latency than the `rubocop-daemon` Ruby script.\n\nYou will need to manually download and install the bash script:\n\n\u003e (Unfortunately [this cannot be done automatically with `rubygems`](https://github.com/rubygems/rubygems/issues/88).)\n\n```\ncurl https://raw.githubusercontent.com/fohte/rubocop-daemon/master/bin/rubocop-daemon-wrapper -o /tmp/rubocop-daemon-wrapper\nsudo mkdir -p /usr/local/bin/rubocop-daemon-wrapper\nsudo mv /tmp/rubocop-daemon-wrapper /usr/local/bin/rubocop-daemon-wrapper/rubocop\nsudo chmod +x /usr/local/bin/rubocop-daemon-wrapper/rubocop\n```\n\nAdd `/usr/local/bin/rubocop-daemon-wrapper` to the beginning of your `PATH`:\n\n```bash\n# ~/.bashrc\nexport PATH=\"/usr/local/bin/rubocop-daemon-wrapper:$PATH\"\n```\n\nNow the `rubocop` wrapper command will always be used by default.\n\n`rubocop-daemon-wrapper` will automatically start the daemon server if it is not already running. So the first call will be about the same as `rubocop`, but the second call will be much faster.\n\n### Use with Bundler\n\nIf you install `rubocop-daemon` with bundler, you should set `RUBOCOP_DAEMON_USE_BUNDLER` environment variable:\n\n```console\n$ export RUBOCOP_DAEMON_USE_BUNDLER=true\n```\n\nNow `rubocop-daemon-wrapper` will call the `rubocop-daemon` command with `bundle exec`.\n\n### Use with VS Code\n\nUnfortunately, the [vscode-ruby extension doesn't really allow you to customize the `rubocop` path or binary](https://github.com/rubyide/vscode-ruby/issues/413). (You can change the linter path, but not the formatter.)\n\nIn the meantime, you could just override the `rubocop` binary with a symlink to `rubocop-daemon-wrapper`:\n\n```bash\n# Find your rubocop path\n$ which rubocop\n\u003cHOME\u003e/.rvm/gems/ruby-x.y.z/bin/rubocop\n\n# Override rubocop with a symlink to rubocop-daemon-wrapper\n$ ln -fs /usr/local/bin/rubocop-daemon-wrapper $HOME/.rvm/gems/ruby-x.y.z/bin/rubocop\n```\n\nOr, if you use rbenv:\n\n```bash\n# which rubocop is rbenv running?\n$ rbenv which rubocop\n\u003cHOME\u003e/.rbenv/versions/x.y.z/bin/rubocop\n\n# Override rubocop with a symlink to rubocop-daemon-wrapper\n$ ln -fs /usr/local/bin/rubocop-daemon-wrapper $HOME/.rbenv/versions/x.y.z/bin/rubocop\n```\n\nNow VS Code will use the `rubocop-daemon-wrapper` script, and `formatOnSave` should be much faster (~150ms instead of 3-5 seconds).\n\n### Use with Neovim/Vim8 and ALE\n\n[ALE](https://github.com/w0rp/ale) setting example:\n\n```vim\n\" Use `rubocop-daemon-wrapper` instead of `rubocop`\nlet g:ale_ruby_rubocop_executable = 'rubocop-daemon-wrapper'\n```\n\nAuto-correct on save setting example:\n\n```vim\n\" optional: Set fixer(not only linter).\nlet g:ale_fixers = {\n\\   'ruby': ['rubocop'],\n\\}\n\n\" optional: Auto-correct on save.\nlet g:ale_fix_on_save = 1\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/fohte/rubocop-daemon.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffohte%2Frubocop-daemon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffohte%2Frubocop-daemon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffohte%2Frubocop-daemon/lists"}