Rubocop in Docker for Atom
Follow the following steps in order to get rubocop running in Atom using Docker:
- Install Docker
- Install Atom
- Install the
- Open the
linter-rubocopsettings and in 'Additional Arguments' put
Create the following file
#!/bin/bash # Remove invalid arguments send by linter-rubocop CMD_ARGS="" for arg in $@ do # -s stands for --stdin which prevent rubocop from working [[ "$arg" == "-s" ]] && continue CMD_ARGS="$CMD_ARGS $arg" done docker run --rm -v /home:/home/ --workdir / zedtux/docker-rubocop:0.34.2 $CMD_ARGS
- Make it executable:
chmod +x /usr/local/bin/rubocop
Now, in Atom, open a Ruby file and let the magic happening.
Note: First time you'll run it, it will pull the image from the Internet which
could takes some time depending on your Internet connection
Note 2: You can find all the available tags here.
The goal is to not install things on your machine, so how to upgrade rubocop without Ruby installed on your machine ?
$ docker run --rm \ -v `pwd`:/app \ -w /app \ ruby \ sh -c 'gem install bundler && bundle update'
This command will mount your current folder in a
ruby container, set the working directory (flag
-w) to that folder in the container and finally execute (
sh -c) the installation of Bundler and then run the command
Gemfile.lock is updated, you can commit it and build a new image of docker-rubocop.
About this fork
This repository is a fork of the BBC News specific config for Rubocop.
Please have a look at their repository for more information.