Missing PL/SQL rules from quality profile after upgrade from SonarQube 5 to SonarQube 8

Hello,

I have a quality profile with PL/SQL rules I do not see (only some) in the Rules tab when I select the Quality Profile. But when I backup the profile and do fulltext search I can see them there. The backup has about 4.5MB. When I rename the profile and import the XML I get the same result. But when I backup the imported profile, the size of the XML is now only about 80KB. No errors in UI, nothing in the log.

What happened? How to fix it?

Example of such rule I do not see:

<rule>
<repositoryKey>plsql</repositoryKey>
<key>R2_Char_semantics_specification</key>
<type>CODE_SMELL</type>
<priority>CRITICAL</priority>
<name>R2: Char semantics specification</name>
<templateKey>XPathCheckPlSql</templateKey>
<description>
Our databases are installed with BYTE semantics but we want to work witch CHAR semantics. So you need to explicitly specify CHAR semantics in all CHAR and/or VARCHAR2 declarations. = Noncompliant Code Example `` DECLARE lsChar CHAR(1); lsString VARCHAR2(100); BEGIN NULL; END; / `` = Compliant Solution `` DECLARE lsChar CHAR(1 CHAR); lsString VARCHAR2(100 CHAR); BEGIN NULL; END; / `` We cannot switch database to CHAR semantics because of errors in fulltext search functionality. Above that oracle don't recommends to use database in CHAR semantics.
</description>
<parameters>
<parameter>
<key>message</key>
<value>You need to specify explicitly CHAR semantics</value>
</parameter>
<parameter>
<key>xpathQuery</key>
<value>
//CHARACTER_DATATYPES//DATATYPE_SIZE_CONSTRAINT[not(DATATYPE_SIZE_CHAR_LENGTH) and not(DATATYPE_SIZE_BYTE_LENGTH)] |//EXPRESSION_PRIMARY[@tokenValue="CAST"] /AS[ name(following-sibling::node()[1])="IDENTIFIER" and following-sibling::node()[1][ @tokenValue ="CHAR" or @tokenValue ="VARCHAR2" ] and name( following-sibling::node()[2])="PAREN_L" and following-sibling::node()[2][ @tokenValue="(" ] and name( following-sibling::node()[3])="INTEGER" and name( following-sibling::node()[4])="PAREN_R" and following-sibling::node()[4][ @tokenValue=")" ] ]
</value>
</parameter>
<parameter>
<key>message</key>
<value>You need to specify explicitly CHAR semantics</value>
</parameter>
<parameter>
<key>xpathQuery</key>
<value>
//CHARACTER_DATATYPES//DATATYPE_SIZE_CONSTRAINT[not(DATATYPE_SIZE_CHAR_LENGTH) and not(DATATYPE_SIZE_BYTE_LENGTH)] |//EXPRESSION_PRIMARY[@tokenValue="CAST"] /AS[ name(following-sibling::node()[1])="IDENTIFIER" and following-sibling::node()[1][ @tokenValue ="CHAR" or @tokenValue ="VARCHAR2" ] and name( following-sibling::node()[2])="PAREN_L" and following-sibling::node()[2][ @tokenValue="(" ] and name( following-sibling::node()[3])="INTEGER" and name( following-sibling::node()[4])="PAREN_R" and following-sibling::node()[4][ @tokenValue=")" ] ]
</value>
</parameter>
</parameters>
</rule>

This was newly created (and I see it):

<rule>
<repositoryKey>plsql</repositoryKey>
<key>Leveris__Char_semantics_specification</key>
<type>CODE_SMELL</type>
<priority>CRITICAL</priority>
<name>Leveris: Char semantics specification</name>
<templateKey>XPathCheckPlSql</templateKey>
<description>You need to specify explicitly CHAR semantics</description>
<parameters>
<parameter>
<key>xpathQuery</key>
<value>
//CHARACTER_DATATYPES//DATATYPE_SIZE_CONSTRAINT[not(DATATYPE_SIZE_CHAR_LENGTH) and not(DATATYPE_SIZE_BYTE_LENGTH)] |//EXPRESSION_PRIMARY[@tokenValue="CAST"] /AS[ name(following-sibling::node()[1])="IDENTIFIER" and following-sibling::node()[1][ @tokenValue ="CHAR" or @tokenValue ="VARCHAR2" ] and name( following-sibling::node()[2])="PAREN_L" and following-sibling::node()[2][ @tokenValue="(" ] and name( following-sibling::node()[3])="INTEGER" and name( following-sibling::node()[4])="PAREN_R" and following-sibling::node()[4][ @tokenValue=")" ] ]
</value>
</parameter>
<parameter>
<key>message</key>
<value>You need to specify explicitly CHAR semantics</value>
</parameter>
</parameters>
</rule>

Hi,

It sounds like a corrupt Elasticsearch index. Try this:

  • stop server
  • delete $SONARQUBE-HOME/data/es6
  • start server

It will take a little while for the indices to rebuild, but it should solve the problem.

 
HTH,
Ann

Yes, that helped. Thanks a lot!