Hello,
I didn’t see content about this topic at sonarsource community.
I want to match my branchs at repository branch with Sonarcloud branch.
But I wasn’t be successful.
If I work anohther branches (outside of master), I can’t see all code file.
I tried at Bitbucket pipelines and local.
And unfortunatelly there is a problem. I think these two problems are related.
I am adding bugs and duplications in my code because I want to test sonar-scanner at different situations. Sonar didn’t get completely and correct result outside of master.
I hope this is my fault. Because I worked on code analysis a lot of time.
I attached bitbucket-pipelines.yml, sonar-project.properties file and log file.
Properties file;
sonar.organization = ******
sonar.projectKey = *************
sonar.host.url = https://sonarcloud.io
sonar.login = ****************************
sonar.projectName = code-analysis
sonar.sources=src
sonar.tests=test
sonar.branch.name=sonar_local_test
sonar.projectVersion = 1.1.5
sonar.cfamily.build-wrapper-output = bw-output
sonar.cxx.cppcheck.reportPath=build/cppcheck-report.xml
sonar.language= c
sonar.sourceEncoding=UTF-8
sonar.cFamily.gcov.reportsPath=.
sonar.branch.name = sonar_local_test
sonar.branch.target = master
Log File;
INFO: Scanner configuration file: /home/msergenergen/Masaüstü/Dosyalar/sonar-scanner-3.3.0.1492-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/msergenergen/Masaüstü/Repo/code-analysis/sonar-project.properties
INFO: SonarQube Scanner 3.3.0.1492
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Linux 4.15.0-46-generic amd64
INFO: User cache: /home/msergenergen/.sonar/cache
INFO: SonarQube server 7.7.0
INFO: Default locale: "tr_TR", source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=443ms
INFO: Server id: BD367519-AWHW8ct9-T_TB3XqouNu
INFO: User cache: /home/msergenergen/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=187ms
INFO: Load/download plugins (done) | time=19638ms
INFO: Loaded core extensions: developer-scanner
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=2ms
INFO: Project key: ********_code-analysis
INFO: Base dir: /home/msergenergen/Masaüstü/Repo/code-analysis
INFO: Working dir: /home/msergenergen/Masaüstü/Repo/code-analysis/.scannerwork
INFO: Load project settings for component key: '**********_code-analysis'
INFO: Load project settings for component key: '**********_code-analysis' (done) | time=84ms
INFO: Load project branches
INFO: Load project branches (done) | time=83ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=67ms
INFO: Load branch configuration
INFO: Load branch configuration (done) | time=20ms
INFO: Load project repositories
INFO: Load project repositories (done) | time=125ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=107ms
INFO: Load active rules
INFO: Load active rules (done) | time=2103ms
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=74ms
INFO: Organization key: **********
INFO: Branch name: sonar_local_test, type: short living
INFO: SCM collecting changed files in the branch
INFO: SCM collecting changed files in the branch (done) | time=155ms
INFO: Language is forced to c
INFO: Indexing files...
INFO: Project configuration:
INFO: 12 files indexed
INFO: Quality profile for c: Sonar way - ******** extension
INFO: ------------- Run sensors on module code-analysis
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=1ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=61ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms
INFO: Sensor CFamily [cpp]
INFO: Using build-wrapper output: /home/msergenergen/Masaüstü/Repo/code-analysis/bw-output/build-wrapper-dump.json
INFO: Available processors: 8
INFO: Using 1 thread for analysis according to value of "sonar.cfamily.threads" property.
WARN: Metric 'comment_lines_data' is deprecated. Provided value is ignored.
INFO: 0 compilation units analyzed
INFO: Sensor CFamily [cpp] (done) | time=1431ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=8ms
INFO: Sensor JavaSecuritySensor [security]
INFO: Reading UCFGs from: /home/msergenergen/Masaüstü/Repo/code-analysis/.scannerwork/ucfg2/java
INFO: 11:17:09.994 Building Type propagation graph
INFO: 11:17:09.997 Running Tarjan on 0 nodes
INFO: 11:17:09.998 Tarjan found 0 components
INFO: 11:17:09.998 Variable type analysis: done
INFO: UCFGs: 0, excluded: 0, source entrypoints: 0
INFO: No UCFGs have been included for analysis.
INFO: Sensor JavaSecuritySensor [security] (done) | time=53ms
INFO: Sensor CSharpSecuritySensor [security]
INFO: Reading UCFGs from: /home/msergenergen/Masaüstü/Repo/code-analysis/ucfg_cs2
INFO: 11:17:10 Building Type propagation graph
INFO: 11:17:10 Running Tarjan on 0 nodes
INFO: 11:17:10 Tarjan found 0 components
INFO: 11:17:10 Variable type analysis: done
INFO: UCFGs: 0, excluded: 0, source entrypoints: 0
INFO: No UCFGs have been included for analysis.
INFO: Sensor CSharpSecuritySensor [security] (done) | time=1ms
INFO: ------------- Run sensors on project
INFO: SCM provider for this project is: git
INFO: 4 files to be analyzed
INFO: 4/4 files analyzed
INFO: Calculating CPD for 6 files
INFO: CPD calculation finished
INFO: SCM writing changed lines
INFO: SCM writing changed lines (done) | time=55ms
INFO: Analysis report generated in 154ms, dir size=174 KB
INFO: Analysis report compressed in 17ms, zip size=45 KB
INFO: Analysis report uploaded in 365ms
INFO: ANALYSIS SUCCESSFUL, you can browse https://sonarcloud.io/dashboard?id=****************&branch=sonar_local_test&resolved=false
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at https://sonarcloud.io/api/ce/task?id=AWk4VB8djzkievm53cm_
INFO: Analysis total time: 12.999 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 43.458s
INFO: Final Memory: 30M/346M
INFO: ------------------------------------------------------------------------
Bitbucket-pipelines.yml file;
image: atlassian/default-image:2
clone:
depth: full
pipelines:
default:
- step:
# sonar-scanner ve build-wrapper indirme işlemlerinin yapılacağı adım
script:
- pwd
- mkdir /opt/sonar
- wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.3.0.1492-linux.zip
- unzip sonar-scanner-cli-3.3.0.1492-linux.zip -d /opt/sonar/
- wget -q https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
- unzip build-wrapper-linux-x86.zip -d /home/build-wrapper/
# chmod +x ile izin işlemleri için gerekli configler yapılacak
- chmod +x /opt/sonar/sonar-scanner-3.3.0.1492-linux/bin/sonar-scanner
- chmod +x /home/build-wrapper/build-wrapper-linux-x86/build-wrapper-linux-x86-64
- export OS=linux
- make clean -f makefile
- make -f makefile
- export PATH=$PATH:/opt/sonar/sonar-scanner-3.3.0.1492-linux/bin
- export PATH=$PATH:/home/build-wrapper/build-wrapper-linux-x86
- echo $PATH
- cd /opt/atlassian/pipelines/agent/build
- ls -al
# build wrapper dosyasının çalıştırılması gerekmektedir
- build-wrapper-linux-x86-64 --out-dir bw-output make clean all
- /opt/sonar/sonar-scanner-3.3.0.1492-linux/bin/./sonar-scanner
How can I do?
Thanks.