-
Notifications
You must be signed in to change notification settings - Fork 8
Initial Setup #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5be5208
31d8817
1169cae
a1b9c7d
0b3049f
f7fc16d
e00635e
5271f4f
84e69f4
8083a3b
debba63
6c262c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
FROM java:8-jre | ||
FROM groovy:jre8-alpine | ||
|
||
MAINTAINER Sivakumar Kailasam | ||
MAINTAINER "Code Climate <[email protected]>" | ||
|
||
RUN cd /tmp && \ | ||
wget http://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.6.zip && \ | ||
unzip apache-groovy-binary-2.4.6.zip && \ | ||
mv groovy-2.4.6 /groovy && \ | ||
rm apache-groovy-binary-2.4.6.zip | ||
USER root | ||
|
||
ENV GROOVY_HOME /groovy | ||
ENV PATH $GROOVY_HOME/bin/:$PATH | ||
RUN apk update && \ | ||
apk add ca-certificates wget curl jq && \ | ||
update-ca-certificates | ||
|
||
RUN groupadd app -g 9000 && useradd -g 9000 -u 9000 -r -s /bin/false app | ||
RUN adduser -u 9000 -D app | ||
|
||
COPY ./bin /usr/src/app/bin | ||
RUN /usr/src/app/bin/install-pmd.sh | ||
|
||
VOLUME /code | ||
WORKDIR /code | ||
COPY . /usr/src/app | ||
RUN chown -R app:app /usr/src/app | ||
|
||
USER app | ||
|
||
CMD ["/usr/src/app/pmd.groovy", "--codeFolder=/code","--configFile=/config.json"] | ||
CMD ["/usr/src/app/pmd.groovy", "--codeFolder=/code", "--configFile=/config.json"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.PHONY: image test | ||
|
||
IMAGE_NAME ?= codeclimate/codeclimate-pmd | ||
|
||
image: | ||
docker build --rm -t $(IMAGE_NAME) . | ||
|
||
test: image | ||
docker run --rm $(IMAGE_NAME) sh -c "echo Nothing to do yet!" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
## codeclimate-pmd | ||
# Code Climate PMD Engine | ||
|
||
`codeclimate-pmd` is a Code Climate engine that wraps the [PMD](https://pmd.github.io) static analysis tool. You can run it on your command line using the Code Climate CLI, or on our hosted analysis platform. | ||
|
||
### Installation | ||
|
||
1. If you haven't already, [install the Code Climate CLI](https://github.com/codeclimate/codeclimate). | ||
2. Run `codeclimate engines:enable pmd`. This command both installs the engine and enables it in your `.codeclimate.yml` file. | ||
3. You're ready to analyze! Browse into your project's folder and run `codeclimate analyze`. | ||
4. To add you custom PMD rules, open `.codeclimate.yml` and add a `config` entry pointing to your `ruleset.xml` file: | ||
```yml | ||
engines: | ||
pmd: | ||
enabled: true | ||
config: ruleset.xml | ||
``` | ||
|
||
### Need help? | ||
|
||
For help with PMD, [check out their documentation](https://pmd.github.io/). | ||
|
||
If you're running into a Code Climate issue, first check out [our PMD engine docs][cc-docs-pmd] and look over this project's [GitHub Issues](https://github.com/codeclimate/codeclimate-rubocop/issues), | ||
as your question may have already been covered. If not, [go ahead and open a support ticket with us](https://codeclimate.com/help). | ||
|
||
[cc-docs-pmd]: https://docs.codeclimate.com/docs/pmd |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
LIB_DIR=/usr/src/app/lib | ||
|
||
download_latest_pmd() { | ||
curl -s https://api.github.com/repos/pmd/pmd/releases/latest | \ | ||
jq -c '.assets[] | select(.name | contains("bin")) | .browser_download_url' | \ | ||
xargs wget -O pmd.zip | ||
} | ||
|
||
install_pmd() { | ||
download_latest_pmd | ||
unzip pmd.zip | ||
mv ${LIB_DIR}/pmd-bin*/* ${LIB_DIR}/pmd | ||
} | ||
|
||
cleanup() { | ||
rmdir ${LIB_DIR}/pmd-bin* | ||
rm pmd.zip | ||
} | ||
|
||
mkdir -p ${LIB_DIR}/pmd | ||
cd ${LIB_DIR} | ||
|
||
install_pmd | ||
cleanup | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
machine: | ||
services: | ||
- docker | ||
|
||
dependencies: | ||
override: | ||
- > | ||
docker run | ||
--env CIRCLE_BRANCH | ||
--env CIRCLE_PROJECT_REPONAME | ||
--env CIRCLE_TOKEN | ||
--env GCR_JSON_KEY | ||
--volume /var/run/docker.sock:/var/run/docker.sock | ||
codeclimate/patrick pull || true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gordondiggs Will was suggesting skip |
||
- make image | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refresh? |
||
|
||
test: | ||
override: | ||
- make test | ||
|
||
deployment: | ||
registry: | ||
branch: /master|channel\/[\w-]+/ | ||
owner: codeclimate | ||
commands: | ||
- > | ||
docker run | ||
--env CIRCLE_BUILD_NUM | ||
--env CIRCLE_PROJECT_REPONAME | ||
--env GCR_JSON_KEY | ||
--volume /var/run/docker.sock:/var/run/docker.sock | ||
codeclimate/patrick push gcr | ||
|
||
notify: | ||
webhooks: | ||
- url: https://cc-slack-proxy.herokuapp.com/circle |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all seems like it's begging to be a
Makefile
WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gordondiggs Don't think so. It is only meant to run building the image. I could have all this in the
Dockerfile
itself but looks ugly.