Skip to content

Instantly share code, notes, and snippets.

@kseki
Last active January 20, 2022 10:38
Show Gist options
  • Save kseki/811a9c4bd9f7a1c6bcec00691007bcc9 to your computer and use it in GitHub Desktop.
Save kseki/811a9c4bd9f7a1c6bcec00691007bcc9 to your computer and use it in GitHub Desktop.
Setting up "Rubocop" to run on "Docker compose" using "ALE"
# .local.vimrc
let g:ale_ruby_rubocop_executable = 'bin/rubocop'
let g:ale_filename_mappings = {
\ 'rubocop': [
\ ['/Users/kseki/rails-project', '/opt'],
\ ],
\}
# bin/rubocop
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
chdir APP_ROOT do
rubocop_command = "bundle exec rubocop #{ARGV.join(' ')}"
system("docker-compose exec -T app #{rubocop_command}'")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment