Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-10311

Revert the renaming of a rule at startup in case of plugin downgrade

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.1
    • Labels:
      None

      Description

      Consider version 2 of a plugin that defines a rule renaming from foo:A to bar:B.
      When this new version of the plugin is installed, rule foo:A is renamed to bar:B and all issues of foo:A are kept in the current state (rather than being closed and reopened as new).

      Now, consider the user installing back version 1 of the plugin. Next analysis will include issues for rule foo:A but the database contains only issues for bar:B. Those issues will be closed and reopened.

      To avoid this, rule renaming should be reverted at startup when installing version 1 of the plugin.

      To achieve this, deprecated keys declared for a rule should be stored in DB (this will complete steps performed in SONAR-10307).

      In case of downgrade, the downgrades will be detected as such:

      • if rule foo:A can not be found in DB
      • but foo:A is the deprecated key of rule bar:B in DB, which id is 1234
      • then we must downgrade rule bar:B to foo:A

      To do do, SonarQube should at startup:

      1. rename the rule repository bar to foo and rule key B to A in table RULES for id 1234
      2. update the RULES.RULE index for id 1234 in the same fashion
      3. update the RULES.RULE_EXTENSION index for id 1234 in the same fashion
      4. remove foo:A from the deprecated keys stored in DB for id 1234

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sebastien.lesaint Sebastien Lesaint
              Reporter:
              sebastien.lesaint Sebastien Lesaint
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: