Hello all!
Running sonarqube cloud and bitbucket cloud.
Any reason why my compile_commands.json would be empty? It looks like everything is compiling correctly, but my file is always empty. This repo is rather large and I am trying to focus on analyzing the C,C++, Python code. Log file, pipeline, and properties files are attached.
Thanks!
pipelineLog-{ad1a6a4a-2426-4b4a-9b2e-d0bc5e2d47fc}.txt (3.5 MB)
image: dkostspk/custom-qtbuild-gcc
clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test, and analyze on SonarCloud
size: 2x
caches:
- sonar
script:
# Setup git and permissions
- git config --global --add safe.directory /opt/atlassian/pipelines/agent/build
# Debug: Show directory structure
- echo "Current directory structure:"
- ls -la
# Setup SonarCloud scanner
- curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.2.1.4610-linux-x64.zip
- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
- unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
# Create build directory and run CMake
- mkdir -p build
- cd build
- echo "Running cmake..."
- cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSKIP_EXTRACTION=ON ..
# Debug: Show CMake output files
- echo "CMake generated files:"
- ls -la
- echo "CMakeCache.txt contents:"
- cat CMakeCache.txt | grep -i "source"
# Build with wrapper
- echo "Running build-wrapper..."
- $HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir . make all
# Debug: Show compile commands
- echo "Compile commands content:"
- cat compile_commands.json
# Run sonar-scanner
- cd ..
- echo "Running sonar-scanner..."
- export SONAR_SCANNER_OPTS="-Xmx2048m"
- $HOME/.sonar/sonar-scanner-6.2.1.4610-linux-x64/bin/sonar-scanner -X
pipelines:
branches:
sonarcloud:
- step: *build-test-sonarcloud
pull-requests:
'**':
- step: *build-test-sonarcloud
# Organization and project keys are displayed in the right sidebar of the project homepage
sonar.organization=evidentvascular
sonar.projectKey=evidentvascular_data-management
sonar.host.url=https://sonarcloud.io
sonar.projectVersion=1.0
# Source file configuration
sonar.sources=.
sonar.sourceEncoding=UTF-8
sonar.inclusions=**/*.h,**/*.cc,**/*.cpp,**/*.py
sonar.languages=c++,py
# C/C++ specific configuration
sonar.cfamily.compile-commands=build/compile_commands.json
sonar.cfamily.threads=4
sonar.cfamily.cache.enabled=false
# File extensions to analyze
sonar.c.file.suffixes=.c,.h
sonar.cpp.file.suffixes=.cpp,.hpp,.cc,.hh,.cxx,.hxx
sonar.python.file.suffixes=.py
# Debug logging
sonar.verbose=true
sonar.log.level=DEBUG
# Exclude third-party code and other languages
sonar.exclusions=boost_1_80_0/**/*,**/boost/**/*,**/*.java,**/*.js,**/*.ts,**/*.php,**/*.rb,**/*.cs,**/*.html,**/*.css,**/*.xml
# Disable unnecessary modules
sonar.java.enabled=false
sonar.javascript.enabled=false
sonar.typescript.enabled=false
sonar.php.enabled=false
sonar.ruby.enabled=false
sonar.csharp.enabled=false