Skip to content

Commit

Permalink
add p3c pmd check
Browse files Browse the repository at this point in the history
  • Loading branch information
never112 authored and CarlJi committed Nov 21, 2024
1 parent c7ba043 commit 2f60503
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
44 changes: 44 additions & 0 deletions config/.image/p3c-pmd-2.1.1.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# go lint tool dependencies `go list` `gofmt`
FROM golang:1.23.2-alpine3.20
#FROM aslan-spock-register.qiniu.io/golang:1.23.2-alpine3.20
ENV GOPROXY https://goproxy.cn,direct
ENV TimeZone=Asia/Shanghai
# if you want to install other tools, please add them here.
# Do not install unnecessary tools to reduce image size.
RUN set -eux \
apk update && \
apk --no-cache add ca-certificates git openssh yarn libpcap-dev curl openjdk11 bash build-base maven
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk
ENV PATH=$PATH:$JAVA_HOME/bin

#RUN update-alternatives --list java

RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin v1.61.0

RUN mkdir source

WORKDIR /source

RUN git clone https://github.com/alibaba/p3c.git

WORKDIR /source/p3c/p3c-pmd

RUN mvn clean kotlin:compile package


WORKDIR /



# SSH config
RUN mkdir -p /root/.ssh && chown -R root /root/.ssh/ && chgrp -R root /root/.ssh/ \
&& git config --global url."[email protected]:".insteadOf https://github.com/ \
&& git config --global url."git://".insteadOf https://
COPY deploy/config /root/.ssh/config
COPY deploy/github-known-hosts /github_known_hosts

# set go proxy and private repo
RUN go env -w GOPROXY=https://goproxy.cn,direct \
&& go env -w GOPRIVATE=github.com/qbox,qiniu.com

EXPOSE 8888
12 changes: 12 additions & 0 deletions config/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,15 @@ customLinters:
kubernetesAsRunner:
namespace: "reviewbot"
image: "aslan-spock-register.qiniu.io/reviewbot/base:go1.22.3-pylint3.3.1"
p3cpmd:
languages: [ ".java" ]
command:
- "/bin/sh"
- "-c"
- "--"
args:
- |
java -cp /source/p3c/p3c-pmd/target/p3c-pmd-2.1.1-jar-with-dependencies.jar net.sourceforge.pmd.PMD -f emacs -R rulesets/java/ali-comment.xml,rulesets/java/ali-concurrent.xml,rulesets/java/ali-constant.xml,rulesets/java/ali-exception.xml,rulesets/java/ali-flowcontrol.xml,rulesets/java/ali-naming.xml,rulesets/java/ali-oop.xml,rulesets/java/ali-orm.xml,rulesets/java/ali-other.xml,rulesets/java/ali-set.xml -d ./
kubernetesAsRunner:
namespace: "reviewbot"
image: "aslan-spock-register.qiniu.io/reviewbot/base:go1.22.3-java11-p3cpmd2.1.1"

0 comments on commit 2f60503

Please sign in to comment.