Last active
January 20, 2022 10:38
-
-
Save kseki/811a9c4bd9f7a1c6bcec00691007bcc9 to your computer and use it in GitHub Desktop.
Setting up "Rubocop" to run on "Docker compose" using "ALE"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .local.vimrc | |
let g:ale_ruby_rubocop_executable = 'bin/rubocop' | |
let g:ale_filename_mappings = { | |
\ 'rubocop': [ | |
\ ['/Users/kseki/rails-project', '/opt'], | |
\ ], | |
\} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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