Inconsistent number of rules shown for quality profiles

Versions:

  • SonarQube 8.3.1.34397
  • Postgresql 12.1

Installed Plugins:

  • SonarCSS 1.2
  • SonarHTML 3.2
  • SonarJS 6.2.1
  • SonarPython 2.7
  • SonarTS 2.1

Behaviour Observed:
Quality profiles reported number of active rules as seen on the overall quality profiles page does not match the number reported on the individual quality profile’s page or the rules page.

Steps to Reproduce:

  1. Originally configured SonarQube with a local postgresql DB provided by bitnami as a docker container.
  2. Later migrated to IBM Cloud postgresql instance for the DB.
  3. Took a backup of the original DB and restored into the new one.
  4. Upon starting SonarQube and connecting to the new DB with data restored, saw no rules or plugins.
  5. After reading documentation in SonarQube community about how DB does not persist the actual plugin installation, only record of installation, manually installed the plugins again from marketplace.

SonarWay and SonarWay Recommended for TS, for example, show 80 and 134 active rules, respectively, yet from the rules view, I can only see 0 and 1, respectively.

Upon checking the database rules table, I noticed a couple differences between the rules visible in both of the aforementioned locations.

The 1 visible in the rules view of SonarQube for SonarWay Recommended (TS):

plugin_rule_key='DuplicatedBlocks'
plugin_key=NULL
plugin_name='common-ts'

The other rules not visible in the rules view for SonarWay Recommended (TS):

plugin_rule_key='S###' where ### is a sequence of digits
plugin_key='javascript'
plugin_name='typescript'

Behaviour above is observed for SonarWay and SonarWay Recommended profiles in following languages:

  • JS
  • HTML
  • TS
  • Python

Hello @oetlinge,

A possible root cause for this would be that the search index was not properly built at first startup of SonarQube.
Could you:

  • Stop SonarQube
  • Make sure you have sufficient disk space on SonarQube install partition (disk usage < 85% and at least 10 GB disk space available for each 10M LoCs you have in your platform)
  • Delete the <SONARQUBE_HOME>/data/es6 directory
  • Restart SonarQube
  • Wait for the index rebuild (SonarQube UI won’t show as long as the index is not ready)
  • Check your quality profiles

If the problem is still present, please send a zip of the <SONARQUBE_HOME>/logs directory

Regards,

Deleting the data/es6 folder and restarting SonarQube to rebuild the Elastic Search index seems to have resolved the problem. Thank you!

Glad to help. Closing this thread then

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.