SublimeLinter-rubocop icon indicating copy to clipboard operation
SublimeLinter-rubocop copied to clipboard

How to setup for docker and or vendor/bundle?

Open mhenrixon opened this issue 4 years ago • 3 comments

Has anyone successfully setup the rubocop linter for projects running exclusively inside docker? Currently, I'm having all gems installed inside vendor/bundle in the hopes of making them more accessible.

That said, all gems are installed inside a Linux docker container and might not be usable from outside docker (my host is a Mac beast).

Just curious if anyone has finally solved this issue. Would be nice to have integration with rubocop inside the docker container somehow.

mhenrixon avatar Apr 19 '21 06:04 mhenrixon

That said, all gems are installed inside a Linux docker container and might not be usable from outside docker

Correct. I don't believe you'll have direct access to these gems without using docker-compose or the like.

That being said, I've had decent success interacting with rubocop via docker-compose by first creating a shell executable file

touch docker-rubocop

#!/bin/bash
docker-compose run --rm web bundle exec rubocop $@

Then just specify the absolute path to the executable within your SublimeLinter settings file

    "rubocop": {
      "executable": "~/Development/project_folder/docker-rubocop"
    }

$@ will ferry commands that SublimeLinter-rubocop sends to the executable over to docker.

You'll need to change the service (mine is web above) that you are using for running rails server above appropriately.

joshmfrankel avatar Feb 10 '22 19:02 joshmfrankel

Shouldn't

   "executable": ["docker-compose", "run", "--rm", "web", "bundle", "exec", "rubocop"]

then also work, 🤔?

kaste avatar Feb 14 '22 20:02 kaste

Good point @kaste! Seems reasonable to assume it would. Can't remember why I didn't try that first 🤔

joshmfrankel avatar Jul 16 '24 17:07 joshmfrankel