I have created a bitbucket pipeline for a repository which has PHP files in majority of files but also has a little bit of cpp files which is making it difficult to deploy the code in sonarcloud .
image: composer:2.0 # Choose an image matching your project needs
options:
docker: true
size: 2x
clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
definitions:
services:
docker:
memory: 4096
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- composer # See https://confluence.atlassian.com/bitbucket/caching-dependencies-895552876.html
- sonar
script: # Build your project and run
- pipe: sonarsource/sonarcloud-scan:1.2.0
- step: &check-quality-gate-sonarcloud
name: Check the Quality Gate on SonarCloud
script:
- pipe: sonarsource/sonarcloud-quality-gate:0.1.4
pipelines: # More info here: https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html
branches:
feature/*:
- step: *build-test-sonarcloud
- step: *check-quality-gate-sonarcloud
pull-requests:
"**":
- step: *build-test-sonarcloud
- step: *check-quality-gate-sonarcloud
The error I am receiving is : If you don't want to analyze C/C++/Objective-C files, then prevent them from being analyzed by setting the following properties:
Hello @Ali_Hussaini. I think this message is a warning, not an error. SonarCloud proceed with the analysis of the CPP files and the message is telling you how to avoid them to be scanned, otherwise the analysis results will include those files. I imagine that you don’t want this, right? them you can just add the properties as suggested.
@Ali_Hussaini, to proceed with the analysis of C/CPP files you need to fulfill the prerequisites. If you don’t want/need to analyse such files, then proceed with the error instructions (suffixes properties) to ignore those files.
@Alexandre_Holzhey how would I ignore those files is it just putting those
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-
in the bitbucket pipeline and modify the code like this :
image: python:3.8
options:
docker: true
size: 2x
clone:
depth: full
definitions:
services:
docker:
memory: 4096
caches:
sonar: ~/.sonar/cache
steps:
- step: &build-test-sonarcloud
name: Build, test and analyze on SonarCloud
caches:
- pip
- sonar
script:
Hi thanks for the solution I actually got a solution using the Administration -> General settings -> Analysis scope and simply added file extensions for ignore in sonar cloud it worked this way !
I also had the same problem, after days of searching, I finally read this page Bitbucket
Then to ignore analyze C/C++/Objective-C files in bitbucket-pipelines.ylm file i add: