0 files; Empty Project

I am using Sonarqube first time and facing issue. Please help

My YML file in gitlab:

sonarqubetest:
  image: sonarsource/sonar-scanner-cli:latest
  variables:
    SONAR_PROJECT_BASE_DIR: "${CI_PROJECT_DIR}"
    GIT_DEPTH: 0
  cache:
    key: "sonar-${CI_PROJECT_ID}"
    paths:
      - ".scannerwork"
      - ".sonar"  
  script:
      - /opt/sonar-scanner/bin/sonar-scanner -Dsonar.qualitygate.wait=true  
 
  allow_failure: true

Property file:

sonar.projectKey=routing
sonar.projectName=cpp-lib-routing
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.scm.disabled=true
sonar.projectBaseDir=/builds/mappingfactory/cpp-lib-routing
sonar.sources=./src
sonar.scm.provider.disabled=true
sonar.scm.enabled=true
sonar.verbose=true
sonar.scm.provider=git

==============================================================

18:00:41.198 INFO: Load plugins index (done) | time=54ms
18:00:41.247 INFO: Load/download plugins (done) | time=103ms
18:00:41.290 DEBUG: Plugins:
18:00:41.290 DEBUG: * Java Code Quality and Security 6.3.0.21585 (java)
18:00:41.290 DEBUG: * Code Smells 4.0.0 (smells)
18:00:41.290 DEBUG: * Git 1.11.1.2008 (scmgit)
18:00:41.291 DEBUG: * JaCoCo 1.1.0.898 (jacoco)
18:00:41.291 DEBUG: * SonarTS 2.1.0.4359 (typescript)
18:00:41.291 DEBUG: * Checkstyle 4.33 (checkstyle)
18:00:41.291 DEBUG: * SonarJS 6.2.1.12157 (javascript)
18:00:41.696 INFO: Process project properties
18:00:41.707 INFO: Process project properties (done) | time=10ms
18:00:41.711 INFO: Project key: routing
18:00:41.711 INFO: Base dir: /builds/mappingfactory/cpp-lib-routing
18:00:41.711 INFO: Working dir: /builds/mappingfactory/cpp-lib-routing/.scannerwork
18:00:41.711 DEBUG: Project global encoding: UTF-8, default locale: en_US
18:00:41.713 DEBUG: Creating module hierarchy
18:00:41.713 DEBUG: Init module 'cpp-lib-routing'
18:00:41.717 DEBUG: Base dir: /builds/mappingfactory/cpp-lib-routing
18:00:41.717 DEBUG: Working dir: /builds/mappingfactory/cpp-lib-routing/.scannerwork
18:00:41.718 DEBUG: Module global encoding: UTF-8, default locale: en_US
18:00:41.724 INFO: Load project settings for component key: 'routing'
18:00:41.747 DEBUG: GET 200 [sonarqube.ci.mtp.cloud/api/setting...](https://sonarqube.ci.mtp.cloud/api/settings/values.protobuf?component=routing) | time=23ms
18:00:41.750 INFO: Load project settings for component key: 'routing' (done) | time=26ms
18:00:41.838 DEBUG: Available languages:
18:00:41.838 DEBUG: * Java => "java"
18:00:41.838 DEBUG: * JavaScript => "js"
18:00:41.838 DEBUG: * TypeScript => "ts"
18:00:41.854 INFO: Load quality profiles
18:00:41.898 DEBUG: GET 200 [sonarqube.ci.mtp.cloud/api/quality...](https://sonarqube.ci.mtp.cloud/api/qualityprofiles/search.protobuf?project=routing) | time=42ms
18:00:41.931 INFO: Load quality profiles (done) | time=77ms
18:00:41.941 INFO: Auto-configuring with CI 'Gitlab CI'
18:00:41.945 INFO: Load active rules
18:00:42.038 DEBUG: GET 200 [sonarqube.ci.mtp.cloud/api/rules/s...](https://sonarqube.ci.mtp.cloud/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt&activation=true&qprofile=AXK49DRUxMt1QmCtnIZw&ps=500&p=1) | time=91ms
18:00:42.270 DEBUG: GET 200 [sonarqube.ci.mtp.cloud/api/rules/s...](https://sonarqube.ci.mtp.cloud/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt&activation=true&qprofile=AXKiwBFTDSTNQNlS9Ia1&ps=500&p=1) | time=112ms
18:00:42.450 DEBUG: GET 200 [sonarqube.ci.mtp.cloud/api/rules/s...](https://sonarqube.ci.mtp.cloud/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt&activation=true&qprofile=AXK49DaqxMt1QmCtnIhQ&ps=500&p=1) | time=55ms
18:00:42.469 INFO: Load active rules (done) | time=524ms
18:00:42.475 DEBUG: SCM Step is disabled by configuration
18:00:42.503 DEBUG: Declared extensions of language Java were converted to sonar.lang.patterns.java :  **/*.java,** / <em>.jav
18:00:42.504 DEBUG: Declared extensions of language JavaScript were converted to sonar.lang.patterns.js : *</em> / *.js,* */* .jsx, <strong>/ <em>.vue
18:00:42.504 DEBUG: Declared extensions of language TypeScript were converted to sonar.lang.patterns.ts : *</em> /*.ts,</strong> /*.tsx
18:00:42.506 INFO: Indexing files...
18:00:42.511 INFO: Project configuration:
18:00:42.527 DEBUG: 'src/contraction/routingkit_custom_contractor_hierarchy.cc' indexed with no language
18:00:42.529 DEBUG: 'src/contraction/routingkit_raw_mtp_graph_wrapper.cc' indexed with no language
18:00:42.531 DEBUG: 'src/CMakeLists.txt' indexed with no language
18:00:42.532 DEBUG: 'src/conversions.cc' indexed with no language
18:00:42.533 DEBUG: 'src/routing/cch_router_wrapper.cc' indexed with no language
18:00:42.534 INFO: 5 files indexed
18:00:42.535 INFO: ------------- Run sensors on module cpp-lib-routing
18:00:42.589 INFO: Load metrics repository
18:00:42.603 DEBUG: GET 200 [sonarqube.ci.mtp.cloud/api/metrics...](https://sonarqube.ci.mtp.cloud/api/metrics/search?f=name,description,direction,qualitative,custom&ps=500&p=1) | time=14ms
18:00:42.628 INFO: Load metrics repository (done) | time=39ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/builds/mappingfactory/cpp-lib-routing/.sonar/cache/52f5340dd05620cd162e2b9a45a57124/sonar-javascript-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
18:00:43.911 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
18:00:43.912 DEBUG: 'Import external issues report' skipped because one of the required properties is missing
18:00:43.913 DEBUG: 'Import of Checkstyle issues' skipped because there is no related file in current project
18:00:43.913 DEBUG: 'Import of PMD issues' skipped because one of the required properties is missing
18:00:43.914 DEBUG: 'Import of SpotBugs issues' skipped because there is no related file in current project
18:00:43.914 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
18:00:43.915 DEBUG: 'Removed properties sensor' skipped because there is no related file in current project
18:00:43.915 DEBUG: 'SmellMeasuresSensor' skipped because there is no related file in current project
18:00:43.915 DEBUG: 'SonarTS' skipped because there is no related file in current project
18:00:43.915 DEBUG: 'CheckstyleSensor' skipped because there is no related file in current project
18:00:43.916 DEBUG: 'JavaScript analysis' skipped because there is no related file in current project
18:00:43.916 DEBUG: 'SonarJS Coverage' skipped because there is no related file in current project
18:00:43.917 DEBUG: 'Import of ESLint issues' skipped because one of the required properties is missing
18:00:43.917 DEBUG: 'TypeScript analysis' skipped because there is no related file in current project
18:00:43.917 DEBUG: 'Import of TSLint issues' skipped because one of the required properties is missing
18:00:43.919 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
18:00:43.920 DEBUG: Sensors : JavaXmlSensor -> JaCoCo XML Report Importer
18:00:43.920 INFO: Sensor JavaXmlSensor [java]
18:00:43.924 INFO: Sensor JavaXmlSensor [java](https://dev.todone/) | time=4ms
18:00:43.925 INFO: Sensor JaCoCo XML Report Importer [jacoco]
18:00:43.927 INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
18:00:43.929 INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
18:00:43.929 INFO: Sensor JaCoCo XML Report Importer [jacoco](https://dev.todone/) | time=4ms
18:00:43.933 INFO: ------------- Run sensors on project
18:00:43.937 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
18:00:43.938 DEBUG: 'Java CPD Block Indexer' skipped because there is no related file in current project
18:00:43.938 DEBUG: Sensors : Zero Coverage Sensor
18:00:43.938 INFO: Sensor Zero Coverage Sensor
18:00:43.940 INFO: Sensor Zero Coverage Sensor (done) | time=2ms
18:00:43.941 INFO: SCM Publisher is disabled
18:00:43.943 INFO: CPD Executor Calculating CPD for 0 files
18:00:43.946 INFO: CPD Executor CPD calculation finished (done) | time=0ms
18:00:43.957 DEBUG: SCM revision ID '78de2eb324e3c3546479b2c4afb34105e4242c9e'
18:00:44.029 INFO: Analysis report generated in 81ms, dir size=32 KB
18:00:44.043 INFO: Analysis report compressed in 14ms, zip size=4 KB
18:00:44.044 INFO: Analysis report generated in /builds/mappingfactory/cpp-lib-routing/.scannerwork/scanner-report
18:00:44.044 DEBUG: Upload report
18:00:44.069 DEBUG: POST 200 [sonarqube.ci.mtp.cloud/api/ce/subm...](https://sonarqube.ci.mtp.cloud/api/ce/submit?projectKey=routing&projectName=cpp-lib-routing) | time=24ms
18:00:44.071 INFO: Analysis report uploaded in 27ms
18:00:44.073 DEBUG: Report metadata written to /builds/mappingfactory/cpp-lib-routing/.scannerwork/report-task.txt
18:00:44.073 INFO: ------------- Check Quality Gate status
18:00:44.073 INFO: Waiting for the analysis report to be processed (max 300s)
18:00:44.089 DEBUG: GET 200 [sonarqube.ci.mtp.cloud/api/ce/task...](https://sonarqube.ci.mtp.cloud/api/ce/task?id=AXK5JAEfxMt1QmCtnImy) | time=16ms
18:00:49.104 DEBUG: GET 200 [sonarqube.ci.mtp.cloud/api/ce/task...](https://sonarqube.ci.mtp.cloud/api/ce/task?id=AXK5JAEfxMt1QmCtnImy) | time=11ms
18:00:49.117 DEBUG: GET 200 [sonarqube.ci.mtp.cloud/api/quality...](https://sonarqube.ci.mtp.cloud/api/qualitygates/project_status?analysisId=AXK5JAFudy2e_3UO2GdR) | time=12ms
18:00:49.123 INFO: QUALITY GATE STATUS: PASSED - View details on [sonarqube.ci.mtp.cloud/dashboard?i...](https://sonarqube.ci.mtp.cloud/dashboard?id=routing)
18:00:49.125 DEBUG: Post-jobs :
18:00:49.127 INFO: Analysis total time: 7.809 s
18:00:49.128 INFO: ------------------------------------------------------------------------
18:00:49.129 INFO: EXECUTION SUCCESS
18:00:49.129 INFO: ------------------------------------------------------------------------
18:00:49.129 INFO: Total time: 9.416s
18:00:49.161 INFO: Final Memory: 6M/34M
18:00:49.161 INFO: ------------------------------------------------------------------------
Running after_script
00:01
Saving cache
00:07
Creating cache sonar-6-2...
.scannerwork: found 9 matching files

.sonar: found 114 matching files

No URL provided, cache will be not uploaded to shared cache server. Cache will be stored only locally.
Created cache
Uploading artifacts for successful job
00:01
Job succeeded

Hi,

As far as I can tell, your problems stem from your analysis configuration, so let’s review your properties:

These first four look fine.

I’m not sure what you intended to accomplish with this set, but they’re not helping. You should drop all four.

This one turns on debug-level logging in your analysis. It’s not hurting anything, and it’s fine when you’re trying to diagnose a problem, but you probably don’t want to keep it long term.

That brings us to these two:

By default, the projectBaseDir is going to be the directory from which you run analysis. Except in very unusual circumstances you don’t need this. Additionally, I’m honestly not sure what the result is going to be when you combine resetting projectBaseDir to an absolute directory with a relative sources directory. You should drop the sonar.projectBaseDir setting and just make sure you’re running analysis from project root.

So to sum up, your new analysis properties should look like this:

sonar.projectKey=routing
sonar.projectName=cpp-lib-routing
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=./src
sonar.verbose=true

 
HTH,
Ann

My YML is like below:

sonar:
  image: sonarsource/sonar-scanner-cli
  needs: []
  dependencies: []
  script:
    - sonar-scanner -Dsonar.qualitygate.wait=true
  allow_failure: true
  variables:
    SONAR_PROJECT_BASE_DIR: "${CI_PROJECT_DIR}"
    GIT_DEPTH: 0
  cache:
    key: "sonar-${CI_PROJECT_ID}"
    paths:
      - ".scannerwork"
      - ".sonar"

Also my project is in c++ and from the documentation I have read that image: sonarsource/sonar-scanner-cli does not support C++ project. Can you please let me know about this and also tell me if my yml file is ok or not?

Hi,

It’s best to keep it to one topic per thread. Please open a new thread for your YAML question. Regarding the scanner, the ‘vanilla’ Sonar Scanner does work for C++, but you’ll need to use the Build Wrapper first. The docs will help with that.

 
Ann