Context :
After a migration sonarQube : 3.73 -> 4.5.5
Bug :
When i consult some rules with the link on the top of sonar, the description does not appear but rather a javascript :
Uncaught TypeError: Cannot read property 'parentKey' of undefined
of undefinedCodingRulesDetailQualityProfileView.getParent @ app.js:11149
CodingRulesDetailQualityProfileView.serializeData @ app.js:11187
Marionette.ItemView.Marionette.View.extend.render @ app.js:3073
Marionette.CollectionView.Marionette.View.extend.renderItemView @ app.js:3342
Marionette.CollectionView.Marionette.View.extend.addItemView @ app.js:3293
(anonymous function) @ app.js:3225_.each._.forEach @ sonar.js:27333
_.each.Collection.(anonymous function) @ app.js:956
Marionette.CollectionView.Marionette.View.extend.showCollection @ app.js:3223
Marionette.CollectionView.Marionette.View.extend._renderChildren @ app.js:3211
Marionette.CollectionView.Marionette.View.extend.render @ app.js:3196
_.extend.show @ app.js:2483CodingRulesDetailView.onRender @ app.js:11589
Marionette.triggerMethod.triggerMethod @ app.js:2134
Marionette.ItemView.Marionette.View.extend.render @ app.js:3082
Marionette.Layout.Marionette.ItemView.extend.render @ app.js:3647
_.extend.show @ app.js:2483(anonymous function) @ app.js:13862
jQuery.Callbacks.fire @ sonar.js:3200jQuery.Callbacks.self.fireWith @ sonar.js:3312
Investigation
When we see the javascript :
myProfile = _.findWhere(this.options.app.qualityProfiles, {
key: this.model.get('qProfile')
});
parentKey = myProfile.parentKey; // this line bug because myProfile is undefined
this.options.app.qualityProfiles -> contains all quality profiles of sonar
key: this.model.get('qProfile') -> get the key of a quality Profiles link to the rule
After some investigations, i found that this precise quality profile link to the rule cannot be found in database. So i supppose it's a old and deleted quality profile.
Thats can explain why the specific quality profile that’s does not exist in all quality Profiles
Questions
Have you ever seen this bugs ?
How sonar can resurrected theses old and deleted qualityProfiles ?
What can i do ?
My guess is that rebuilding ES indexes will do the job. For that delete, after backup ^^, the "data/es" folder of your SQ instance, then restart your server. Indexes will be rebuilt (it may take some time depending on the size/number of your projects).