I try to install Codeclimate via docker by reading the Codeclimate readme docs.
In order to test Codeclimate locally. I made a new folder and put hello.php
and .codeclimate.yml
.
The following is my hello.php
<?php
echo("Hello");
The following is my .codeclimate.yml
version: "2"
checks:
argument-count:
enabled: true
complex-logic:
enabled: true
file-lines:
enabled: true
method-complexity:
enabled: true
method-count:
enabled: true
method-lines:
enabled: true
nested-control-flow:
enabled: true
return-statements:
enabled: true
similar-code:
enabled: true
identical-code:
enabled: true
And I run the codecliate like the following via my terminal
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 \
codeclimate/codeclimate analyze
It shows like Starting analysis
and after waiting for a long time. I got a timeout error.
Is something wrong with my configuration?
The command you are running is pulling docker images named codeclimate/codeclimate-structure
and codeclimate/codeclimate-duplication
, if you go here you'll notice they weighs ~2gb compressed, so taking a long time for the command to run is understandable.
You can expdite the command by pulling the image in advance by running docker pull codeclimate/codeclimate-structure
& docker pull codeclimate/codeclimate-duplication
.
I found out this is the case by adding the debug env var to the docker run command (-e CODECLIMATE_DEBUG=1
), this can often come in handy when CLI tools behave abnormally.
Another thing code climate support and can help you in situations like this is setting higher timeout thresholds - -e CONTAINER_TIMEOUT_SECONDS=1800
.
All of this info is present in the readme you've linked to in your question. Hope this solves your problem.