Commit 225e7f45 authored by Ramon Nou's avatar Ramon Nou
Browse files

Merge branch 'rnou/327-add-cppcheck' into 'master'

Resolve "Add cppcheck"

Closes #327

Closes #327

See merge request !214
parents c09736d8 e3f916bb
Loading
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ variables:
  LIBGKFS_LOG_OUTPUT:           "${CI_PROJECT_DIR}/logs/gkfs_client.log"
  GIT_SUBMODULE_STRATEGY:       recursive
  CCACHE_DIR:                   "$CI_PROJECT_DIR/ccache"
#  SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
#  GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task


# base image
@@ -394,6 +396,46 @@ coverage:
      - ${COVERAGE_PATH}
    expire_in: 2 weeks

cppcheck:
  stage: report
  image: gekkofs/cppcheck:0.9.4-dev
  needs: [ 'gkfs:allintegration', 'gkfs:unit']
  script:
    - cd ${CI_PROJECT_DIR}
    - rm -rf external gkfs
    - cppcheck --xml --enable=warning,style,performance --force ${CI_PROJECT_DIR} 2> cppcheck_out.xml 
    - cppcheck-codequality --input-file cppcheck_out.xml --output-file cppcheck.json
  #change paths
  after_script:
    - perl -pe 's|/builds/gitlab/hpc/gekkofs||g' cppcheck.json > cppcheck2.json
  artifacts:
    paths:
      - cppcheck_out.xml
    reports:
      codequality: cppcheck2.json
    expire_in: 2 weeks

sonar:
  stage: report
  image: 
      name: sonarsource/sonar-scanner-cli:11
      entrypoint: [""]
  needs: ['cppcheck']
  rules:
    - if: '$CI_MERGE_REQUEST_EVENT_TYPE == "detached"'
      when: never
    - if: '$CI_MERGE_REQUEST_ID != ""'
      when: manual
      allow_failure: true
  script: 
    - sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}"
  cache:
    policy: pull-push
    key: "sonar-cache-$CI_COMMIT_REF_SLUG"
    paths:
      - "${SONAR_USER_HOME}/cache"
      - sonar-scanner/
  

################################################################################
## Deployment of documentation and reports
+12 −1
Original line number Diff line number Diff line
@@ -5,7 +5,18 @@ All notable changes to GekkoFS project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.9.4] - 2025-03]
## Unreleased
### New
  - Added cppcheck code checking capabilities ([!214](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/214))

### Changed 


### Fixed



## [0.9.4] - 2025-03
### New

- Add RISC-V profile ([!220](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/220))
+20 −0
Original line number Diff line number Diff line
FROM debian:bookworm-slim

LABEL Description="Environment to generate cppcheck reports in GekkoFS"

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        wget \
        git \
        python3 \
        python3-pip \
        python3-setuptools \
        cppcheck && \
    rm -rf /var/lib/apt/lists/* && \
    apt-get clean && \
    apt-get autoclean && \
    git clone https://gitlab.com/ahogen/cppcheck-codequality.git && \
    cd cppcheck-codequality && \
    python3 -m pip install --upgrade pip --break-system-packages && \
    pip3 install . --break-system-packages
+10 −0
Original line number Diff line number Diff line
.PHONY: all

amd64:
	docker build --platform amd64 -t gekkofs/cppcheck:0.9.4-dev .

aarch64:
	docker build --platform aarch64 -t gekkofs/cppcheck:0.9.4-dev .

all:
	docker build -t gekkofs/cppcheck:0.9.4-dev .
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
sonar.projectKey=hpc_gekkofs_f327dcaa-2f78-4b9a-96b0-079902420c12
sonar.qualitygate.wait=true
sonar.cxx.file.suffixes=.h,.cpp,.hpp
sonar.cxx.cppcheck.reportPaths=cppcheck_out.xml
 No newline at end of file