Class: CodeclimateDiff::CodeclimateWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/codeclimate_diff/codeclimate_wrapper.rb

Instance Method Summary collapse

Instance Method Details

#pull_latest_imageObject



22
23
24
25
# File 'lib/codeclimate_diff/codeclimate_wrapper.rb', line 22

def pull_latest_image
  puts "Downloading latest codeclimate docker image..."
  `docker pull codeclimate/codeclimate`
end

#run_codeclimate(filename = "") ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/codeclimate_diff/codeclimate_wrapper.rb', line 9

def run_codeclimate(filename = "")
  docker_platform = CodeclimateDiff.configuration["docker_platform"] || "linux/amd64"

  `docker run \
    --interactive --tty --rm \
    --env CODECLIMATE_CODE="$PWD" \
    --volume "$PWD":/code \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --volume /tmp/cc:/tmp/cc \
    --platform #{docker_platform} \
    codeclimate/codeclimate analyze -f json #{filename}`
end