Skip to content

Commit

Permalink
add cnes-scan + update tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Topin2001 committed Jul 12, 2024
1 parent dd1e35b commit 8993140
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
40 changes: 19 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This image is based on a LTS version of SonarQube
FROM lequal/sonarqube:3.2.2
FROM lequal/sonarqube:3.2.5

LABEL maintainer="CATLab"

Expand All @@ -11,35 +11,29 @@ ENV HOME=/home/sonarqube \
USER root

# Download software
ADD https://github.com/cnescatlab/i-CodeCNES/releases/download/4.1.2/icode-4.1.2.zip \
https://github.com/danmar/cppcheck/archive/refs/tags/2.13.0.tar.gz \
ADD https://github.com/cnescatlab/i-CodeCNES/releases/download/5.0.0/icode-5.0.0.zip \
https://github.com/danmar/cppcheck/archive/refs/tags/2.14.2.tar.gz \
https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006.zip \
https://github.com/cnescatlab/sonar-cnes-scan-plugin/releases/download/2.0.0/sonar-cnes-scan-plugin-2.0.jar \
/tmp/

# Add CNES pylintrc A_B, C, D
COPY pylintrc.d/ /opt/python/

## ====================== INSTALL DEPENDENCIES ===============================

ENV PATH /usr/local/bin:${PATH}
ENV PATH=/usr/local/bin:${PATH}

RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
gpg=2.2.27-* \
dirmngr=2.2.27-* \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9 \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 605C66F00D6C9793 \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update -y \
&& apt-get install -y \
unzip=6.0-* \
python3=3.10.4-* \
python3-minimal=3.10.4-* \
libpython3-stdlib=3.10.4-* \
python3-distutils=3.10.4-* \
python3-lib2to3=3.10.4-* \
python3=3.10.6-* \
python3-pip=22.0.2* \
curl=7.81.0-* \
shellcheck=0.8.0-* \
Expand All @@ -53,37 +47,41 @@ RUN apt-get update -y \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /home/sonarqube \
## Install i-Code CNES
&& unzip /tmp/icode-4.1.2.zip -d /tmp \
&& unzip /tmp/icode-5.0.0.zip -d /tmp \
&& chmod +x /tmp/icode/icode \
&& mv /tmp/icode/* /usr/bin \
&& rm -r /tmp/icode \
&& rm /tmp/icode-4.1.2.zip \
&& rm /tmp/icode-5.0.0.zip \
## Install Sonar Scanner
&& unzip /tmp/sonar-scanner-cli-5.0.1.3006.zip -d /opt/ \
&& mv /opt/sonar-scanner-5.0.1.3006 /opt/sonar-scanner \
&& rm -rf /tmp/sonar-scanner-cli-5.0.1.3006.zip
&& rm -rf /tmp/sonar-scanner-cli-5.0.1.3006.zip \
## Install Cnes Scan Plugin
&& mv /tmp/sonar-cnes-scan-plugin-2.0.jar /opt/sonarqube/extensions/plugins/ \
&& chown sonarqube:sonarqube /opt/sonarqube/extensions/plugins/sonar-cnes-scan-plugin-2.0.jar


## Python, Pylint & CNES Pylint setup
RUN pip install --no-cache-dir \
setuptools-scm==8.0.4 \
setuptools-scm==8.1.0 \
pytest-runner==6.0.1 \
wrapt==1.16.0 \
six==1.16.0 \
lazy-object-proxy==1.10.0 \
mccabe==0.7.0 \
isort==5.13.2 \
typed-ast==1.5.5 \
astroid==3.1.0 \
pylint==3.1.0 \
astroid==3.2.3 \
pylint==3.2.5 \
pylint_sonarjson_catlab==2.0.0 \
cnes-pylint-extension==7.0.0

## C and C++ tools installation
RUN cd /tmp \
&& tar -zxvf 2.13.0.tar.gz \
&& make -C cppcheck-2.13.0/ install MATCHCOMPILER="yes" FILESDIR="/usr/share/cppcheck" HAVE_RULES="yes" CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function -Wno-deprecated-declarations" \
&& tar -zxvf 2.14.2.tar.gz \
&& make -C cppcheck-2.14.2/ install MATCHCOMPILER="yes" FILESDIR="/usr/share/cppcheck" HAVE_RULES="yes" CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function -Wno-deprecated-declarations" \
&& cd .. \
&& rm -rf ./2.13.0.tar.gz ./cppcheck-2.13.0/ \
&& rm -rf ./2.14.2.tar.gz ./cppcheck-2.14.2/ \
&& chown sonarqube:sonarqube -R /opt \
&& chown sonarqube:sonarqube -R /home \
&& apt-get autoremove -y \
Expand Down
2 changes: 1 addition & 1 deletion tests/c_cpp/reference-cppcheck-results.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<results version="2">
<cppcheck version="2.13.0"/>
<cppcheck version="2.14.2"/>
<errors>
<error id="arrayIndexOutOfBounds" severity="error" msg="Array &apos;a[10]&apos; accessed at index 10, which is out of bounds." verbose="Array &apos;a[10]&apos; accessed at index 10, which is out of bounds." cwe="788" file0="tests/c_cpp/cppcheck/main.c">
<location file="tests/c_cpp/cppcheck/main.c" line="7" column="6" info="Array index out of bounds"/>
Expand Down

0 comments on commit 8993140

Please sign in to comment.