GRAPHQL - The main branch of this project is empty

Hello everyone.

Guys I’m having trouble using sonarquebe in a pipeline I’m creating (gitlab-ci.yml).
The image is checking the code, but it is not sending to Sonarqube, here is the stage:

unit_test:
  image: node:14.5.0
  stage: test
  before_script:
    - yarn add -D sonarqube-scanner
    - yarn add -D jest-sonar-reporter
  script:
    - yarn test
  artifacts:
    paths:
      - "reports/"
    name: "Pipeline $CI_PIPELINE_ID Coverage Report"

sonarqube-reports:
  stage: analyze
  image: ciricihq/gitlab-sonar-scanner
  dependencies:
    - unit_test
  variables:
    SONAR_URL: link:my.sonar.com
    SONAR_ANALYSIS_MODE: publish
  before_script:
    - echo "sonar.login=$SONAR_LOGIN" >> sonar-project.properties
    - echo "sonar.projectKey=$NOME_DO_PROJETO" >> sonar-project.properties
    - echo "sonar.exclusions=node_modules/**,coverage/**" >> sonar-project.properties
    - echo "sonar.sources=./src" >> sonar-project.properties
    - echo "sonar.verbose=true" >> sonar-project.properties
    - cat sonar-project.properties
  script:
    - gitlab-sonar-scanner -X

In project it is as follows: The main branch of this project is empty.

Log:

$ gitlab-sonar-scanner -X
14:48:51.910 INFO: Scanner configuration file: NONE
14:48:51.915 INFO: Project root configuration file: /builds/user/new-graphql/sonar-project.properties
14:48:51.957 INFO: SonarQube Scanner 3.3.0.1492
14:48:51.958 INFO: Java 1.8.0_201 Oracle Corporation (64-bit)
14:48:51.958 INFO: Linux 4.19.78-coreos amd64
14:48:52.277 DEBUG: keyStore is : 
14:48:52.279 DEBUG: keyStore type is : jks
14:48:52.279 DEBUG: keyStore provider is : 
14:48:52.279 DEBUG: init keystore
14:48:52.280 DEBUG: init keymanager of type SunX509
14:48:52.518 DEBUG: Create: /root/.sonar/cache
14:48:52.523 INFO: User cache: /root/.sonar/cache
14:48:52.524 DEBUG: Create: /root/.sonar/cache/_tmp
14:48:52.533 DEBUG: Extract sonar-scanner-api-batch in temp...
14:48:52.554 DEBUG: Get bootstrap index...
14:48:52.554 DEBUG: Download: link:my.sonar.com/batch/index
14:48:53.694 DEBUG: Get bootstrap completed
14:48:53.708 DEBUG: Download link:my.sonar.com/batch/file?name=scanner-developer-8.2.0.32929-all.jar to /root/.sonar/cache/_tmp/fileCache476517684967581014.tmp
14:48:58.086 DEBUG: Create isolated classloader...
14:48:58.105 DEBUG: Start temp cleaning...
14:48:58.124 DEBUG: Temp cleaning done
14:48:58.126 DEBUG: Execution getVersion
14:48:58.129 INFO: SonarQube server 8.2.0
14:48:58.130 INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
14:48:58.131 DEBUG: Work directory: /builds/user/new-graphql/.scannerwork
14:48:58.136 DEBUG: Execution execute
14:48:58.487 WARN: SonarScanner will require Java 11 to run starting in SonarQube 8.x
14:48:58.493 DEBUG: Developer 8.2.0.32929
14:48:58.716 INFO: Load global settings
14:48:59.442 DEBUG: GET 200 link:my.sonar.com/api/settings/values.protobuf | time=722ms
14:48:59.476 INFO: Load global settings (done) | time=760ms
14:48:59.482 INFO: Server id: 6CE3F8F7-AXHDz-JvxJVprrnp4o1y
14:48:59.494 DEBUG: Create : /root/.sonar/_tmp
14:48:59.495 INFO: User cache: /root/.sonar/cache
14:48:59.499 INFO: Load/download plugins
14:48:59.499 INFO: Load plugins index
14:48:59.634 DEBUG: GET 200 link:my.sonar.com/api/plugins/installed | time=135ms
14:48:59.671 INFO: Load plugins index (done) | time=172ms
14:48:59.673 DEBUG: Download plugin 'license' to '/root/.sonar/_tmp/fileCache3620069009581576300.tmp'
14:48:59.921 DEBUG: GET 200 link:my.sonar.com/api/plugins/download?plugin=license&acceptCompressions=pack200 | time=248ms
14:48:59.957 DEBUG: Download plugin 'ruby' to '/root/.sonar/_tmp/fileCache3174928247202167378.tmp'
14:49:00.090 DEBUG: GET 200 link:my.sonar.com/api/plugins/download?plugin=ruby&acceptCompressions=pack200 | time=132ms
14:49:02.366 DEBUG: Download plugin 'typescript' to '/root/.sonar/_tmp/fileCache402906075889912297.tmp'
14:49:02.500 DEBUG: GET 200 link:my.sonar.com/api/plugins/download?plugin=typescript&acceptCompressions=pack200 | time=132ms
14:49:02.503 DEBUG: Download plugin 'bitegardenSecurity' to '/root/.sonar/_tmp/fileCache771727459025339082.tmp'
14:49:02.631 DEBUG: GET 200 link:my.sonar.com/api/plugins/download?plugin=bitegardenSecurity&acceptCompressions=pack200 | time=128ms
14:49:06.522 INFO: Load/download plugins (done) | time=7024ms
14:49:06.744 DEBUG: Plugins:
14:49:06.746 DEBUG:   * License for SonarLint 8.2.0.32929 (license)
14:49:06.747 DEBUG:   * bitegarden Security 2.2.1 (bitegardenSecurity)
14:49:06.750 DEBUG:   * SonarTS 2.1.0.4359 (typescript)
14:49:06.751 DEBUG:   * SonarRuby 1.5.0.315 (ruby)
14:49:06.780 INFO: Loaded core extensions: developer-scanner
14:49:06.820 DEBUG: Installed core extension: developer-scanner
14:49:07.259 INFO: Process project properties
14:49:07.276 INFO: Process project properties (done) | time=17ms
14:49:07.282 INFO: Project key: rv-graphql
14:49:07.283 INFO: Base dir: /builds/user/new-graphql
14:49:07.283 INFO: Working dir: /builds/user/new-graphql/.scannerwork
14:49:07.284 DEBUG: Project global encoding: UTF-8, default locale: en_US
14:49:07.287 DEBUG: Creating module hierarchy
14:49:07.288 DEBUG:   Init module 'rv-graphql'
14:49:07.289 DEBUG:     Base dir: /builds/user/new-graphql
14:49:07.290 DEBUG:     Working dir: /builds/user/new-graphql/.scannerwork
14:49:07.292 DEBUG:     Module global encoding: UTF-8, default locale: en_US
14:49:07.301 INFO: Load project settings for component key: 'rv-graphql'
14:49:07.447 DEBUG: GET 200 link:my.sonar.com/api/settings/values.protobuf?component=rv-graphql | time=145ms
14:49:07.449 INFO: Load project settings for component key: 'rv-graphql' (done) | time=148ms
14:49:07.456 INFO: Load project branches
14:49:07.590 DEBUG: GET 200 link:my.sonar.com/api/project_branches/list?project=rv-graphql | time=132ms
14:49:07.602 INFO: Load project branches (done) | time=146ms
14:49:07.603 INFO: Load project pull requests
14:49:07.734 DEBUG: GET 200 link:my.sonar.com/api/project_pull_requests/list?project=rv-graphql | time=127ms
14:49:07.738 INFO: Load project pull requests (done) | time=134ms
14:49:07.739 INFO: Load branch configuration
14:49:07.744 INFO: Detected 'GitLab'
14:49:07.748 INFO: Auto-configuring branch 'master'
14:49:07.749 INFO: Load branch configuration (done) | time=10ms
14:49:07.752 DEBUG: Available languages:
14:49:07.752 DEBUG:   * Ruby => "ruby"
14:49:07.768 INFO: Load quality profiles
14:49:07.916 DEBUG: GET 200 link:my.sonar.com/api/qualityprofiles/search.protobuf?project=rv-graphql | time=145ms
14:49:07.939 INFO: Load quality profiles (done) | time=171ms
14:49:07.960 INFO: Detected Gitlab CI
14:49:07.966 INFO: Load active rules
14:49:08.220 DEBUG: GET 200 link:my.sonar.com/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt,updatedAt&activation=true&qprofile=AXHG20kG_gpM4DNulrj5&ps=500&p=1 | time=250ms
14:49:08.365 INFO: Load active rules (done) | time=399ms
14:49:08.375 WARN: SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project, or disable the SCM Sensor in the project settings.
14:49:08.391 INFO: Branch name: master
14:49:08.442 DEBUG: Declared extensions of language Ruby were converted to sonar.lang.patterns.ruby : **/*.rb
14:49:08.447 INFO: Indexing files...
14:49:08.448 INFO: Project configuration:
14:49:08.448 INFO:   Excluded sources: node_modules/**, coverage/**
14:49:08.467 DEBUG: 'src/Helpers/generateToken.ts' indexed with language 'null'
14:49:08.468 DEBUG: 'src/Adapters/Transactions/transactions.adapter.ts' indexed with language 'null'
14:49:08.472 DEBUG: 'src/Adapters/Providers/providers.adapter.ts' indexed with language 'null'
14:49:08.473 DEBUG: 'src/Adapters/Authorizations/authentication.adapter.ts' indexed with language 'null'
14:49:08.475 DEBUG: 'src/DataSources/TransactionsAPI.ts' indexed with language 'null'
14:49:08.476 DEBUG: 'src/DataSources/AuthorizationAPI.ts' indexed with language 'null'
14:49:08.477 DEBUG: 'src/DataSources/dataSources.ts' indexed with language 'null'
14:49:08.477 DEBUG: 'src/DataSources/ProvidersAPI.ts' indexed with language 'null'
14:49:08.478 DEBUG: 'src/typeDefs.ts' indexed with language 'null'
14:49:08.479 DEBUG: 'src/Types/transactions.types.ts' indexed with language 'null'
14:49:08.482 DEBUG: 'src/Types/providers.types.ts' indexed with language 'null'
14:49:08.483 DEBUG: 'src/Types/authorization.types.ts' indexed with language 'null'
14:49:08.484 DEBUG: 'src/Types/types.ts' indexed with language 'null'
14:49:08.486 DEBUG: 'src/Schemas/Authorization/authentications.resolvers.ts' indexed with language 'null'
14:49:08.488 DEBUG: 'src/Schemas/Authorization/authentications.schemas.ts' indexed with language 'null'
14:49:08.489 DEBUG: 'src/Schemas/Transactions/transactions.resolvers.ts' indexed with language 'null'
14:49:08.489 DEBUG: 'src/Schemas/Transactions/transactions.schemas.ts' indexed with language 'null'
14:49:08.491 DEBUG: 'src/Schemas/Providers/providers.schemas.ts' indexed with language 'null'
14:49:08.491 DEBUG: 'src/Schemas/Providers/providers.resolvers.ts' indexed with language 'null'
14:49:08.492 DEBUG: 'src/Schemas/schemas.graphql.ts' indexed with language 'null'
14:49:08.492 DEBUG: 'src/Shield/shield.ts' indexed with language 'null'
14:49:08.493 DEBUG: 'src/Shield/permissions.ts' indexed with language 'null'
14:49:08.496 INFO: 22 files indexed
14:49:08.496 INFO: 0 files ignored because of inclusion/exclusion patterns
14:49:08.497 INFO: ------------- Run sensors on module rv-graphql
14:49:08.525 INFO: Load metrics repository
14:49:08.683 DEBUG: GET 200 link:my.sonar.com/api/metrics/search?f=name,description,direction,qualitative,custom&ps=500&p=1 | time=152ms
14:49:08.715 INFO: Load metrics repository (done) | time=184ms
14:49:08.857 DEBUG: 'Import external issues report' skipped because one of the required properties is missing
14:49:08.864 DEBUG: 'SonarTS' skipped because there is no related file in current project
14:49:08.864 DEBUG: 'Ruby Sensor' skipped because there is no related file in current project
14:49:08.865 DEBUG: 'Import of RuboCop issues' skipped because one of the required properties is missing
14:49:08.866 DEBUG: 'SimpleCov Sensor for Ruby coverage' skipped because there is no related file in current project
14:49:08.867 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
14:49:08.867 DEBUG: Sensors : 
14:49:08.874 INFO: ------------- Run sensors on project
14:49:08.885 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
14:49:08.886 DEBUG: 'Java CPD Block Indexer' skipped because there is no related file in current project
14:49:08.887 DEBUG: Sensors : Zero Coverage Sensor
14:49:08.888 INFO: Sensor Zero Coverage Sensor
14:49:08.890 INFO: Sensor Zero Coverage Sensor (done) | time=2ms
14:49:08.891 INFO: SCM Publisher No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
14:49:08.893 INFO: CPD Executor Calculating CPD for 0 files
14:49:08.894 INFO: CPD Executor CPD calculation finished (done) | time=0ms
14:49:08.993 INFO: Analysis report generated in 97ms, dir size=3 KB
14:49:09.004 INFO: Analysis report compressed in 10ms, zip size=2 KB
14:49:09.005 INFO: Analysis report generated in /builds/user/new-graphql/.scannerwork/scanner-report
14:49:09.005 DEBUG: Upload report
14:49:09.173 DEBUG: POST 200 link:my.sonar.com/api/ce/submit?projectKey=rv-graphql&characteristic=branch%3Dmaster&characteristic=branchType%3DBRANCH | time=167ms
14:49:09.175 INFO: Analysis report uploaded in 170ms
14:49:09.179 DEBUG: Report metadata written to /builds/user/new-graphql/.scannerwork/report-task.txt
14:49:09.179 INFO: ANALYSIS SUCCESSFUL, you can browse link:my.sonar.com/dashboard?id=rv-graphql&branch=master
14:49:09.179 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
14:49:09.180 INFO: More about the report processing at link:my.sonar.com/api/ce/task?id=AXRPSv71VXBukg5YOJHz
14:49:09.183 DEBUG: Post-jobs : 
14:49:09.185 INFO: Analysis total time: 2.404 s
14:49:09.187 INFO: ------------------------------------------------------------------------
14:49:09.187 INFO: EXECUTION SUCCESS
14:49:09.187 INFO: ------------------------------------------------------------------------
14:49:09.187 INFO: Total time: 17.302s
14:49:09.228 INFO: Final Memory: 8M/56M
14:49:09.231 INFO: ------------------------------------------------------------------------
Job succeeded

Hi,

Welcome to the community!

You don’t mention which languages you expect to be analyzed in this project, but a few sections of your analysis log are of particular interest, IMO:

So first, this looks like a very short list of plugins to me. If you’ve manually interfered with your SonarQube installation to remove language analyzers, that could be having an impact here.

It seems that your TypeScript files aren’t recognized by analysis as such. Which extensions are claimed by which language is editable at the global and project levels (Languages -> [select language] -> File suffixes). It seems perhaps that this has been edited to omit .ts.

So this empty project message may be the result of the analysis not recognizing any files in the project as belonging to languages it knows how to handle.

 
HTH,
Ann

Thank you Ann,

I got resolved this problem, the error were in modules not installed in image. I’m using language Typescript, was necessary install plugin Typescript and Javascript in Sonarqube too.

You can closed this ticket.