rubocop-daemon
rubocop-daemon copied to clipboard
Add --allow-external-access flag
We're using rubocop-daemon
inside a Docker container to avoid having to install all dependencies locally. This works pretty well with the slightly modified version of the bash wrapper with just one exception - by default rubocop-daemon
binds itself to 127.0.0.1
which is only accessible on the same machine and does not work when the port is exposed from Docker to the host.
This PR adds optional --allow-external-access
flag that binds the TCP socket to 0.0.0.0
making it accessible from the outside.
The speed difference is pretty significant:
➜ h2 git:(master) ✗ time bin/rubocop-daemon-wrapper app/models/profile.rb
Inspecting 1 file
.
1 file inspected, no offenses detected
bin/rubocop-daemon-wrapper app/models/profile.rb 0.01s user 0.03s system 26% cpu 0.146 total
➜ h2 git:(master) ✗ time docker exec -it e09cfd863588 bin/rubocop-daemon-wrapper app/models/profile.rb
Inspecting 1 file
.
1 file inspected, no offenses detected
docker exec -it e09cfd863588 bin/rubocop-daemon-wrapper app/models/profile.rb 0.11s user 0.06s system 43% cpu 0.401 total
I didn't notice that there's #26 that does the same thing in a slightly different fashion and it has been sitting there since December. @fohte is this project still maintained or should we fork it? :)